[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250801030210.GA1495@sol>
Date: Thu, 31 Jul 2025 20:02:10 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: James Bottomley <James.Bottomley@...senpartnership.com>
Cc: Peter Huewe <peterhuewe@....de>, Jarkko Sakkinen <jarkko@...nel.org>,
linux-integrity@...r.kernel.org, Jason Gunthorpe <jgg@...pe.ca>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH 1/2] tpm: Compare HMAC values in constant time
On Thu, Jul 31, 2025 at 10:28:49PM -0400, James Bottomley wrote:
> On Thu, 2025-07-31 at 14:52 -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().
>
> Um, OK, I'm all for more security but how could there possibly be a
> timing attack in the hmac final comparison code? All it's doing is
> seeing if the HMAC the TPM returns matches the calculated one. Beyond
> this calculation, there's nothing secret about the HMAC key.
I'm not sure I understand your question. Timing attacks on MAC
validation are a well-known issue that can allow a valid MAC to be
guessed without knowing the key. Whether it's practical in this
particular case for some architecture+compiler+kconfig combination is
another question, but there's no reason not to use the constant-time
comparison function that solves this problem.
Is your claim that in this case the key is public, so the MAC really
just serves as a checksum (and thus the wrong primitive is being used)?
- Eric
Powered by blists - more mailing lists