Skip to contentSkip to conversation

Patch "crypto: nx - Fix timing leak in GCM and CCM decryption" has been added to the 4.3-stable tree

PATCH [email protected] 1 participant 1 message Feb 2, 2016

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

crypto: nx - Fix timing leak in GCM and CCM decryption

to the 4.3-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
crypto-nx-fix-timing-leak-in-gcm-and-ccm-decryption.patch
and it can be found in the queue-4.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From cb8affb55c7e64816f3effcd9b2fc3268c016fac Mon Sep 17 00:00:00 2001

From: David Gstir <[email protected]>
Date: Sun, 15 Nov 2015 17:14:41 +0100
Subject: crypto: nx - Fix timing leak in GCM and CCM decryption

From: David Gstir <[email protected]>

commit cb8affb55c7e64816f3effcd9b2fc3268c016fac upstream.

Using non-constant time memcmp() makes the verification of the authentication tag in the decrypt path vulnerable to timing attacks. Fix this by using crypto_memneq() instead.

---
 drivers/crypto/nx/nx-aes-ccm.c |    2 +-
 drivers/crypto/nx/nx-aes-gcm.c |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/nx/nx-aes-ccm.c +1 -1
@@ -409,7 +409,7 @@ static int ccm_nx_decrypt(struct aead_re
 		processed += to_process;
 	} while (processed < nbytes);
 
-	rc = memcmp(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
+	rc = crypto_memneq(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
 		    authsize) ? -EBADMSG : 0;
 out:
 	spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
drivers/crypto/nx/nx-aes-gcm.c +2 -1
@@ -21,6 +21,7 @@
 
 #include <crypto/internal/aead.h>
 #include <crypto/aes.h>
+#include <crypto/algapi.h>
 #include <crypto/scatterwalk.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -418,7 +419,7 @@ mac:
 			itag, req->src, req->assoclen + nbytes,
 			crypto_aead_authsize(crypto_aead_reqtfm(req)),
 			SCATTERWALK_FROM_SG);
-		rc = memcmp(itag, otag,
+		rc = crypto_memneq(itag, otag,
 			    crypto_aead_authsize(crypto_aead_reqtfm(req))) ?
 		     -EBADMSG : 0;
 	}

Patches currently in stable-queue which might be from [email protected] are

queue-4.3/crypto-nx-fix-timing-leak-in-gcm-and-ccm-decryption.patch queue-4.3/crypto-talitos-fix-timing-leak-in-esp-icv-verification.patch