]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KEYS: trusted_tpm1: Compare HMAC values in constant time
authorEric Biggers <ebiggers@kernel.org>
Sat, 9 Aug 2025 17:19:39 +0000 (10:19 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:23:14 +0000 (16:23 +0200)
commitebd9834f30b89e584274191ddb0303d509db235e
tree7260a11e09fef99012ce4363fc603a8dc957f84d
parent1bc0d9315ef5296abb2c9fd840336255850ded18
KEYS: trusted_tpm1: Compare HMAC values in constant time

commit eed0e3d305530066b4fc5370107cff8ef1a0d229 upstream.

To prevent timing attacks, HMAC value comparison needs to be constant
time.  Replace the memcmp() with the correct function, crypto_memneq().

[For the Fixes commit I used the commit that introduced the memcmp().
It predates the introduction of crypto_memneq(), but it was still a bug
at the time even though a helper function didn't exist yet.]

Fixes: d00a1c72f7f4 ("keys: add new trusted key-type")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/keys/trusted-keys/trusted_tpm1.c