[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f1e4cbd-2d02-2345-493b-68ded3357f26@pengutronix.de>
Date: Mon, 14 Mar 2022 16:33:39 +0100
From: Ahmad Fatoum <a.fatoum@...gutronix.de>
To: Pankaj Gupta <pankaj.gupta@....com>,
Jarkko Sakkinen <jarkko@...nel.org>
Cc: David Gstir <david@...ma-star.at>,
Aymen Sghaier <aymen.sghaier@....com>,
Mimi Zohar <zohar@...ux.ibm.com>,
David Howells <dhowells@...hat.com>,
"keyrings@...r.kernel.org" <keyrings@...r.kernel.org>,
Matthias Schiffer <matthias.schiffer@...tq-group.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Horia Geanta <horia.geanta@....com>,
Richard Weinberger <richard@....at>,
James Morris <jmorris@...ei.org>,
Eric Biggers <ebiggers@...nel.org>,
James Bottomley <jejb@...ux.ibm.com>,
"Serge E. Hallyn" <serge@...lyn.com>,
"tharvey@...eworks.com" <tharvey@...eworks.com>,
Franck Lenormand <franck.lenormand@....com>,
Jan Luebbe <j.luebbe@...gutronix.de>,
Sumit Garg <sumit.garg@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
"linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [EXT] Re: [PATCH v5 4/5] crypto: caam - add in-kernel interface
for blob generator
Hello Pankaj,
On 25.02.22 13:20, Pankaj Gupta wrote:
>>>> +static u32 *caam_blob_alloc_desc(size_t keymod_len) {
>>>> + size_t len;
>>>> +
>>>> + /* header + (key mod immediate) + 2x pointers + op */
>>>> + len = 4 + (4 + ALIGN(keymod_len, 4)) + 2*(4 + 4 +
>>>> + CAAM_PTR_SZ_MAX) + 4;
>>>
>>> Nit: the amount of magic numbers is overwhelming here. I neither
>>> understand the statement nor how that comment should help me to
>> understand it.
>>
>> header = 4
>> (key mod immediate) = (4 + ALIGN(keymod_len, 4))
>> 2x pointer = 2 * (4 + 4 + CAAM_PTR_SZ_MAX)
>> op = 4
>
> Instead of the function caam_blob_alloc_desc(), it will be great if the caller functions caam_encap_blob()/caam_encap_blob (), could add local array:
> uint32_t desc[CAAM_DESC_BYTES_MAX];
I just looked into this and placing desc on stack is not possible
as it is used for DMA inside caam_jr_enqueue().
Cheers,
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists