summaryrefslogtreecommitdiff
path: root/drivers/crypto/nx/nx-aes-ccm.c
diff options
context:
space:
mode:
authorDavid Gstir <david@sigma-star.at>2015-11-15 19:14:41 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2015-11-16 16:39:23 +0300
commitcb8affb55c7e64816f3effcd9b2fc3268c016fac (patch)
treea4db924f12ad7421f71ca0ca10a374b4eb814267 /drivers/crypto/nx/nx-aes-ccm.c
parent8005c49d9aea74d382f474ce11afbbc7d7130bec (diff)
downloadlinux-cb8affb55c7e64816f3effcd9b2fc3268c016fac.tar.xz
crypto: nx - Fix timing leak in GCM and CCM decryption
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. Cc: stable@vger.kernel.org Signed-off-by: David Gstir <david@sigma-star.at> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/nx/nx-aes-ccm.c')
-rw-r--r--drivers/crypto/nx/nx-aes-ccm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/nx/nx-aes-ccm.c b/drivers/crypto/nx/nx-aes-ccm.c
index 73ef49922788..7038f364acb5 100644
--- a/drivers/crypto/nx/nx-aes-ccm.c
+++ b/drivers/crypto/nx/nx-aes-ccm.c
@@ -409,7 +409,7 @@ static int ccm_nx_decrypt(struct aead_request *req,
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);