Skip to content

Commit 73bf20e

Browse files
ebiggersherbertx
authored andcommitted
crypto: vmac - require a block cipher with 128-bit block size
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: f1939f7 ("crypto: vmac - New hash algorithm for intel_txt support") Cc: <stable@vger.kernel.org> # v2.6.32+ Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 38641b8 commit 73bf20e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crypto/vmac.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
655655
if (IS_ERR(alg))
656656
return PTR_ERR(alg);
657657

658+
err = -EINVAL;
659+
if (alg->cra_blocksize != 16)
660+
goto out_put_alg;
661+
658662
inst = shash_alloc_instance("vmac", alg);
659663
err = PTR_ERR(inst);
660664
if (IS_ERR(inst))

0 commit comments

Comments
 (0)