Re: [PATCH v10 2/3] crypto: ti - Add support for AES-GCM in DTHEv2 driver
From: T Pratham
Date: Tue Mar 10 2026 - 13:08:08 EST
On 07-03-2026 10:53, Herbert Xu wrote:
> On Thu, Feb 26, 2026 at 06:24:40PM +0530, T Pratham wrote:
>>
>> + src = dthe_aead_prep_src(req->src, req->assoclen, cryptlen,
>> + src_assoc_padbuf, src_crypt_padbuf);
>> + if (IS_ERR(src)) {
>> + ret = PTR_ERR(src);
>> + goto aead_prep_src_err;
>> + }
>> +
>> + if (req->assoclen % AES_BLOCK_SIZE)
>> + assoclen += AES_BLOCK_SIZE - (req->assoclen % AES_BLOCK_SIZE);
>> + if (cryptlen % AES_BLOCK_SIZE)
>> + cryptlen += AES_BLOCK_SIZE - (cryptlen % AES_BLOCK_SIZE);
>> +
>> + src_nents = sg_nents_for_len(src, assoclen + cryptlen);
>> +
>> + if (cryptlen != 0) {
>> + dst = dthe_aead_prep_dst(req->dst, req->assoclen, unpadded_cryptlen,
>> + dst_crypt_padbuf);
>> + if (IS_ERR(dst)) {
>> + ret = PTR_ERR(dst);
>> + goto aead_prep_dst_err;
>> + }
>> +
>> + dst_nents = sg_nents_for_len(dst, cryptlen);
>> + }
>> + /* Prep finished */
>
> How does this handle the case where req->src == req->dst?
What potential issue do you see? Both `dthe_aead_prep_src` and
`dthe_prep_aead_dst` functions use `sg_split`, which anyway allocates a
new scatterlist. Even if req->src == req->dst, the src and dst from here
on will be different.
--
Regards
T Pratham <t-pratham@xxxxxx>