[EXT] Re: [PATCH v5 4/5] crypto: caam - add in-kernel interface for blob generator
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 14 15:33:39 UTC 2022
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 |
More information about the Linux-security-module-archive
mailing list