summaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorDavid Gstir <david@sigma-star.at>2015-11-15 17:14:42 +0100
committerLuis Henriques <luis.henriques@canonical.com>2016-01-05 11:22:18 +0000
commit20422a48839b1c869f014f7649cd1522c968d793 (patch)
tree0b238b5e0f98f480992b5d38a30a45255576e6e2 /drivers/crypto
parent437a88a58371aa4a3ea01dbe194337e3f97c4b29 (diff)
downloadlinux-stable-20422a48839b1c869f014f7649cd1522c968d793.tar.gz
linux-stable-20422a48839b1c869f014f7649cd1522c968d793.tar.bz2
linux-stable-20422a48839b1c869f014f7649cd1522c968d793.zip
crypto: talitos - Fix timing leak in ESP ICV verification
commit 79960943fdc114fd4583c9ab164b5c89da7aa601 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. Signed-off-by: David Gstir <david@sigma-star.at> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> [ luis: backported to 3.16: adjusted context ] Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/talitos.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 307931528eb2..da328ed633fb 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -870,8 +870,8 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,
icvdata = &edesc->link_tbl[0];
sg = sg_last(req->dst, edesc->dst_nents ? : 1);
- err = memcmp(icvdata, (char *)sg_virt(sg) + sg->length -
- ctx->authsize, ctx->authsize) ? -EBADMSG : 0;
+ err = crypto_memneq(icvdata, (char *)sg_virt(sg) + sg->length -
+ ctx->authsize, ctx->authsize) ? -EBADMSG : 0;
}
kfree(edesc);