Re: [PATCH 1/3] KEYS: trusted_tpm1: Compare HMAC values in constant time

From: Jarkko Sakkinen
Date: Sat Aug 09 2025 - 06:38:06 EST


On Tue, Aug 05, 2025 at 10:32:27AM -0700, Eric Biggers wrote:
> On Tue, Aug 05, 2025 at 04:44:27PM +0300, Jarkko Sakkinen wrote:
> > On Thu, Jul 31, 2025 at 02:23:52PM -0700, Eric Biggers wrote:
> > > To prevent timing attacks, HMAC value comparison needs to be constant
> > > time. Replace the memcmp() with the correct function, crypto_memneq().
> > >
> > > Fixes: d00a1c72f7f4 ("keys: add new trusted key-type")
> > > Cc: stable@xxxxxxxxxxxxxxx
> > > Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> >
> > Was crypto_memneq() available at the time?
>
> No. The Fixes commit is still correct, though, as it's the commit that
> introduced the memcmp(). Technically it was still a bug at that time,
> even if there wasn't a helper function available yet.

Add a remark to the commit message.

>
> - Eric

BR, Jarkko