summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-07-12 07:17:42 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2016-07-18 11:35:42 +0200
commitca0494c093371b1ca3cd4c8e14e1e7a19e6e21b6 (patch)
tree7c1003354c83a4937c53ad3f45b840e005a5004a /crypto
parentcrypto: chacha20poly1305 - Use skcipher (diff)
downloadlinux-ca0494c093371b1ca3cd4c8e14e1e7a19e6e21b6.tar.xz
linux-ca0494c093371b1ca3cd4c8e14e1e7a19e6e21b6.zip
crypto: aead - Add skcipher null for IV generators
This patch adds an skcipher null object alongside the existing null blkcipher so that IV generators using it can switch over to skcipher. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/aead.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/aead.c b/crypto/aead.c
index b155cbc3a0dd..a5d9a83f90e4 100644
--- a/crypto/aead.c
+++ b/crypto/aead.c
@@ -294,10 +294,15 @@ int aead_init_geniv(struct crypto_aead *aead)
if (err)
goto out;
+ ctx->sknull = crypto_get_default_null_skcipher2();
+ err = PTR_ERR(ctx->sknull);
+ if (IS_ERR(ctx->sknull))
+ goto out;
+
ctx->null = crypto_get_default_null_skcipher();
err = PTR_ERR(ctx->null);
if (IS_ERR(ctx->null))
- goto out;
+ goto drop_sknull;
child = crypto_spawn_aead(aead_instance_ctx(inst));
err = PTR_ERR(child);
@@ -315,6 +320,8 @@ out:
drop_null:
crypto_put_default_null_skcipher();
+drop_sknull:
+ crypto_put_default_null_skcipher2();
goto out;
}
EXPORT_SYMBOL_GPL(aead_init_geniv);
@@ -325,6 +332,7 @@ void aead_exit_geniv(struct crypto_aead *tfm)
crypto_free_aead(ctx->child);
crypto_put_default_null_skcipher();
+ crypto_put_default_null_skcipher2();
}
EXPORT_SYMBOL_GPL(aead_exit_geniv);