summaryrefslogtreecommitdiff
path: root/crypto/ablkcipher.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-06-21 19:11:41 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-06-22 15:49:16 +0800
commitf13a259a9ed4d39715c7e9d6231b8ed1ce2886c4 (patch)
treeaf9d800b0cda7b828f05b78b5f38a835479c81e8 /crypto/ablkcipher.c
parentfb0cf19afc46b3fccfe0b2c86e97253844fc62aa (diff)
downloadlinux-crypto-f13a259a9ed4d39715c7e9d6231b8ed1ce2886c4.tar.gz
linux-crypto-f13a259a9ed4d39715c7e9d6231b8ed1ce2886c4.zip
crypto: skcipher - Allow givencrypt to be NULL
Currently for skcipher IV generators they must provide givencrypt as that is the whole point. We are currently replacing skcipher IV generators with explicit IV generators. In order to maintain backwards compatibility, we need to allow the IV generators to still function as a normal skcipher when the RNG Is not present (e.g., in the initramfs during boot). IOW everything but givencrypt and givdecrypt will still work but those two will fail. Therefore this patch assigns a default givencrypt that simply returns an error should it be NULL. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/ablkcipher.c')
-rw-r--r--crypto/ablkcipher.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index b15d797f..b788f169 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -454,7 +454,7 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type,
alg->setkey : setkey;
crt->encrypt = alg->encrypt;
crt->decrypt = alg->decrypt;
- crt->givencrypt = alg->givencrypt;
+ crt->givencrypt = alg->givencrypt ?: no_givdecrypt;
crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt;
crt->base = __crypto_ablkcipher_cast(tfm);
crt->ivsize = alg->ivsize;