summaryrefslogtreecommitdiff
path: root/crypto/chacha20poly1305.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@lithui.me.apana.org.au>2017-12-22 20:00:50 +1100
committerHerbert Xu <herbert@lithui.me.apana.org.au>2017-12-22 20:00:50 +1100
commit9f65cbe00490ea235b4f9250b00dd606c6edb206 (patch)
treec6aa561f923c3c749d080a39c237e943731ee21c /crypto/chacha20poly1305.c
parent85d35da5374413041093f5bcb0c352ef9bbe7a5b (diff)
parent668802507e1796b14c57704545799b8fe6daf744 (diff)
downloadlinux-crypto-9f65cbe00490ea235b4f9250b00dd606c6edb206.tar.gz
linux-crypto-9f65cbe00490ea235b4f9250b00dd606c6edb206.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Merge the crypto tree to pick up inside-secure fixes.
Diffstat (limited to 'crypto/chacha20poly1305.c')
-rw-r--r--crypto/chacha20poly1305.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c
index db1bc314..600afa99 100644
--- a/crypto/chacha20poly1305.c
+++ b/crypto/chacha20poly1305.c
@@ -610,6 +610,11 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb,
algt->mask));
if (IS_ERR(poly))
return PTR_ERR(poly);
+ poly_hash = __crypto_hash_alg_common(poly);
+
+ err = -EINVAL;
+ if (poly_hash->digestsize != POLY1305_DIGEST_SIZE)
+ goto out_put_poly;
err = -ENOMEM;
inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
@@ -618,7 +623,6 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb,
ctx = aead_instance_ctx(inst);
ctx->saltlen = CHACHAPOLY_IV_SIZE - ivsize;
- poly_hash = __crypto_hash_alg_common(poly);
err = crypto_init_ahash_spawn(&ctx->poly, poly_hash,
aead_crypto_instance(inst));
if (err)