Re: [PATCH v5 2/4] crypto: ti - Add support for AES-CTR in DTHEv2 driver
From: T Pratham
Date: Thu Nov 06 2025 - 03:25:52 EST
On 06/11/25 12:53, Herbert Xu wrote:
> On Fri, Oct 31, 2025 at 08:11:34PM +0530, T Pratham wrote:
>>
>> Let me know if this is fine.
>
> Yes I think this should work.
>
>> However, I suppose we similarly cannot do allocations in AEADs as well?
>> If that is the case, my current code relies a lot on it (using sg_split
>> to separate AAD from {plain, cipher}text and applying padding like CTR
>> here, both of which allocate memory).
>>
>> I can change padding to avoid kmallocs like CTR easily. But separating
>> AAD and plaintext/ciphertext without using sg_split will be a task. Let
>> me know if this is correct, so that I'll split the series and send
>> ciphers now, and AEADs later.
>
> OK it's not totally forbidden to allocate memory. However, you
> should only use GFP_ATOMIC to avoid dead-lock (GFP_KERNEL can
> trigger writes to storage, which can in turn call crypto), and
> provide a fallback path to software crypto when the allocation
> fails.
>
> Cheers,
Understood. Thanks for the insights. I'll re-spin the series with
necessary changes.
--
Regards
T Pratham <t-pratham@xxxxxx>