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@xxxxxxxxxxxxxxxxxxx> --- crypto/cbc.c | 5 +++++ crypto/lskcipher.c | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crypto/cbc.c b/crypto/cbc.c index eedddef9ce40..173e47aecb1f 100644 --- a/crypto/cbc.c +++ b/crypto/cbc.c @@ -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; diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c index 2a602911f4fc..260666f34500 100644 --- a/crypto/lskcipher.c +++ b/crypto/lskcipher.c @@ -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 */ -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt