* [PATCH] crypto: ccree - use crypto_memneq() to compare AEAD tag
@ 2026-08-15 17:09 David C.C.M. Gall
2026-09-04 10:02 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: David C.C.M. Gall @ 2026-08-15 17:09 UTC (permalink / raw)
To: Gilad Ben-Yossef, Herbert Xu, David S. Miller, linux-crypto,
linux-kernel
Cc: gregkh
cc_aead_complete() compares the computed MAC against the received ICV
with memcmp(), which short-circuits on the first differing byte and
leaks tag-match length via timing. Use crypto_memneq() instead.
Assisted-by: gregkh_clanker_t1000
Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com>
---
drivers/crypto/ccree/cc_aead.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c
index 088c4603047f..d57a98f89e53 100644
--- a/drivers/crypto/ccree/cc_aead.c
+++ b/drivers/crypto/ccree/cc_aead.c
@@ -226,8 +226,8 @@ static void cc_aead_complete(struct device *dev, void *cc_req, int err)
goto done;
if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
- if (memcmp(areq_ctx->mac_buf, areq_ctx->icv_virt_addr,
- ctx->authsize) != 0) {
+ if (crypto_memneq(areq_ctx->mac_buf, areq_ctx->icv_virt_addr,
+ ctx->authsize)) {
dev_dbg(dev, "Payload authentication failure, (auth-size=%d, cipher=%d)\n",
ctx->authsize, ctx->cipher_mode);
/* In case of payload authentication failure, MUST NOT
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: ccree - use crypto_memneq() to compare AEAD tag
2026-08-15 17:09 [PATCH] crypto: ccree - use crypto_memneq() to compare AEAD tag David C.C.M. Gall
@ 2026-09-04 10:02 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-09-04 10:02 UTC (permalink / raw)
To: David C.C.M. Gall
Cc: Gilad Ben-Yossef, David S. Miller, linux-crypto, linux-kernel, gregkh
On Sat, Aug 15, 2026 at 07:09:58PM +0200, David C.C.M. Gall wrote:
> cc_aead_complete() compares the computed MAC against the received ICV
> with memcmp(), which short-circuits on the first differing byte and
> leaks tag-match length via timing. Use crypto_memneq() instead.
>
> Assisted-by: gregkh_clanker_t1000
> Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com>
> ---
> drivers/crypto/ccree/cc_aead.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-04 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-15 17:09 [PATCH] crypto: ccree - use crypto_memneq() to compare AEAD tag David C.C.M. Gall
2026-09-04 10:02 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®