Re: [PATCH v12 02/10] pkcs7: Allow the signing algo to calculate the digest itself
From: David Howells
Date: Tue Jan 20 2026 - 11:11:09 EST
Ignat Korchagin <ignat@xxxxxxxxxxxxxx> wrote:
> > + sig->digest = kmalloc(umax(sinfo->authattrs_len, sig->digest_size),
> > + GFP_KERNEL);
>
> I'm still bothered by this "reallocation". You mentioned we need to do
> some parsing for attributes, but it seems by the time this function is
> called we have all the data to do something like
> kmalloc(sig->algo_does_hash ? umax(sinfo->authattrs_len,
> sig->digest_size) : sig->digest_size, GFP_KERNEL) during the initial
> allocation. Or am I missing something?
Actually, you're right, we do have that info at this point
David