summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-06-11 23:20:23 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2017-06-20 11:21:19 +0800
commitfec17cb2231733174e039ad9054fa16bb358e2ec (patch)
treeb3fef173dac11fb9c6c7927e659a79c8f9df3bce
parentffe55266e36bef40b940b38bfef4fcff4957624d (diff)
downloadlinux-stable-fec17cb2231733174e039ad9054fa16bb358e2ec.tar.gz
linux-stable-fec17cb2231733174e039ad9054fa16bb358e2ec.tar.bz2
linux-stable-fec17cb2231733174e039ad9054fa16bb358e2ec.zip
crypto: rsa-pkcs1pad - use constant time memory comparison for MACs
Otherwise, we enable all sorts of forgeries via timing attack. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Suggested-by: Stephan Müller <smueller@chronox.de> Cc: stable@vger.kernel.org Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: linux-crypto@vger.kernel.org Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/rsa-pkcs1pad.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c
index 044bcfa69cba..407c64bdcdd9 100644
--- a/crypto/rsa-pkcs1pad.c
+++ b/crypto/rsa-pkcs1pad.c
@@ -490,7 +490,7 @@ static int pkcs1pad_verify_complete(struct akcipher_request *req, int err)
goto done;
pos++;
- if (memcmp(out_buf + pos, digest_info->data, digest_info->size))
+ if (crypto_memneq(out_buf + pos, digest_info->data, digest_info->size))
goto done;
pos += digest_info->size;