Commit fcb7160a authored by David Gstir's avatar David Gstir Committed by Kamal Mostafa

crypto: talitos - Fix timing leak in ESP ICV verification

commit 79960943 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: default avatarDavid Gstir <david@sigma-star.at>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
[ kamal: backport to 3.19-stable: context ]
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 5ef3d4b2
...@@ -870,7 +870,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, ...@@ -870,7 +870,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,
icvdata = &edesc->link_tbl[0]; icvdata = &edesc->link_tbl[0];
sg = sg_last(req->dst, edesc->dst_nents ? : 1); sg = sg_last(req->dst, edesc->dst_nents ? : 1);
err = memcmp(icvdata, (char *)sg_virt(sg) + sg->length - err = crypto_memneq(icvdata, (char *)sg_virt(sg) + sg->length -
ctx->authsize, ctx->authsize) ? -EBADMSG : 0; ctx->authsize, ctx->authsize) ? -EBADMSG : 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment