summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2018-06-18 10:22:37 -0700
committerBen Hutchings <ben@decadent.org.uk>2018-12-16 22:08:07 +0000
commite9754e4a01403ebcbec6e5384e78e92b0e26a5a1 (patch)
tree83b3143c31f0607c09c40994e4bda78420a20212 /crypto
parente43438a210722d334bab39637343a95503b56d3e (diff)
downloadlinux-stable-e9754e4a01403ebcbec6e5384e78e92b0e26a5a1.tar.gz
linux-stable-e9754e4a01403ebcbec6e5384e78e92b0e26a5a1.tar.bz2
linux-stable-e9754e4a01403ebcbec6e5384e78e92b0e26a5a1.zip
crypto: vmac - require a block cipher with 128-bit block size
commit 73bf20ef3df262026c3470241ae4ac8196943ffa upstream. The VMAC template assumes the block cipher has a 128-bit block size, but it failed to check for that. Thus it was possible to instantiate it using a 64-bit block size cipher, e.g. "vmac(cast5)", causing uninitialized memory to be used. Add the needed check when instantiating the template. Fixes: f1939f7c5645 ("crypto: vmac - New hash algorithm for intel_txt support") Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/vmac.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/vmac.c b/crypto/vmac.c
index bf2d3a89845f..4d7a7d232a4f 100644
--- a/crypto/vmac.c
+++ b/crypto/vmac.c
@@ -655,6 +655,10 @@ static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
if (IS_ERR(alg))
return PTR_ERR(alg);
+ err = -EINVAL;
+ if (alg->cra_blocksize != 16)
+ goto out_put_alg;
+
inst = shash_alloc_instance("vmac", alg);
err = PTR_ERR(inst);
if (IS_ERR(inst))