diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-12-03 20:46:48 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:46 -0500 |
commit | b9c55aa475599183d0eab6833ea23e70c52dd24b (patch) | |
tree | 74e011e9b95291f230d6e7200730e3bc3b9d7153 /crypto/blkcipher.c | |
parent | 806d183aa6cc565d0f6bd2fb7fc6bfb175cc4813 (diff) |
[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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index ca6ef065cded..4a7e65c4df4d 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -450,6 +450,10 @@ static int crypto_init_blkcipher_ops_async(struct crypto_tfm *tfm) | |||
450 | crt->setkey = async_setkey; | 450 | crt->setkey = async_setkey; |
451 | crt->encrypt = async_encrypt; | 451 | crt->encrypt = async_encrypt; |
452 | crt->decrypt = async_decrypt; | 452 | crt->decrypt = async_decrypt; |
453 | if (!alg->ivsize) { | ||
454 | crt->givencrypt = skcipher_null_givencrypt; | ||
455 | crt->givdecrypt = skcipher_null_givdecrypt; | ||
456 | } | ||
453 | crt->base = __crypto_ablkcipher_cast(tfm); | 457 | crt->base = __crypto_ablkcipher_cast(tfm); |
454 | crt->ivsize = alg->ivsize; | 458 | crt->ivsize = alg->ivsize; |
455 | 459 | ||