summaryrefslogtreecommitdiff
path: root/crypto/blkcipher.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-12-04 12:46:48 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2008-01-11 08:16:46 +1100
commit5bbeab9ff41e1fdcb317062605fb0674d8f19635 (patch)
tree5baa3ce0ca05e1722cd0dc7742dac600995115c8 /crypto/blkcipher.c
parentf517d94feb936131f62a5ba3568cd7c7aee1c50c (diff)
downloadlinux-crypto-5bbeab9ff41e1fdcb317062605fb0674d8f19635.tar.gz
linux-crypto-5bbeab9ff41e1fdcb317062605fb0674d8f19635.zip
[CRYPTO] skcipher: Create default givcipher instances
This patch makes crypto_alloc_ablkcipher/crypto_grab_skcipher always return algorithms that are capable of generating their own IVs through givencrypt and givdecrypt. Each algorithm may specify its default IV generator through the geniv field. For algorithms that do not set the geniv field, the blkcipher layer will pick a default. Currently it's chainiv for synchronous algorithms and eseqiv for asynchronous algorithms. Note that if these wrappers do not work on an algorithm then that algorithm must specify its own geniv or it can't be used at all. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/blkcipher.c')
-rw-r--r--crypto/blkcipher.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index ca6ef065..4a7e65c4 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -450,6 +450,10 @@ static int crypto_init_blkcipher_ops_async(struct crypto_tfm *tfm)
crt->setkey = async_setkey;
crt->encrypt = async_encrypt;
crt->decrypt = async_decrypt;
+ if (!alg->ivsize) {
+ crt->givencrypt = skcipher_null_givencrypt;
+ crt->givdecrypt = skcipher_null_givdecrypt;
+ }
crt->base = __crypto_ablkcipher_cast(tfm);
crt->ivsize = alg->ivsize;