@@ -148,6 +148,11 @@ static int crypto_cbc_create(struct crypto_template *tmpl, struct rtattr **tb)
if (!is_power_of_2(inst->alg.co.base.cra_blocksize))
goto out_free_inst;
+ if (inst->alg.co.ivsize)
+ goto out_free_inst;
+
+ inst->alg.co.ivsize = inst->alg.co.base.cra_blocksize;
+
inst->alg.encrypt = crypto_cbc_encrypt;
inst->alg.decrypt = crypto_cbc_decrypt;
@@ -630,10 +630,6 @@ struct lskcipher_instance *lskcipher_alloc_instance_simple(
goto err_free_inst;
}
- err = -EINVAL;
- if (cipher_alg->co.ivsize)
- goto err_free_inst;
-
inst->free = lskcipher_free_instance_simple;
/* Default algorithm properties, can be overridden */
@@ -642,7 +638,7 @@ struct lskcipher_instance *lskcipher_alloc_instance_simple(
inst->alg.co.base.cra_priority = cipher_alg->co.base.cra_priority;
inst->alg.co.min_keysize = cipher_alg->co.min_keysize;
inst->alg.co.max_keysize = cipher_alg->co.max_keysize;
- inst->alg.co.ivsize = cipher_alg->co.base.cra_blocksize;
+ inst->alg.co.ivsize = cipher_alg->co.ivsize;
inst->alg.co.statesize = cipher_alg->co.statesize;
/* Use struct crypto_lskcipher * by default, can be overridden */
Remove the ivsize check for lskcipher simple templates so that it can be used for cts. Check for the ivsize in users such as cbc instead. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> --- crypto/cbc.c | 5 +++++ crypto/lskcipher.c | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-)