As ECB could potentially be wrapped by other chaining modes to operate on larger chunks of data in parallel, we would like to distinguish between the generic ECB and accelerated implementations of ECB, as using the former will not result in any speedup. Therefore, update the driver name of generic ECB to 'ecb_generic(%s)'. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> --- crypto/ecb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crypto/ecb.c b/crypto/ecb.c index 935cfef4aa84..46a6a61fbcb9 100644 --- a/crypto/ecb.c +++ b/crypto/ecb.c @@ -134,6 +134,12 @@ static struct crypto_instance *crypto_ecb_alloc(struct rtattr **tb) if (IS_ERR(inst)) goto out_put_alg; + err = -ENAMETOOLONG; + if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, + "ecb_generic(%s)", alg->cra_driver_name) + >= CRYPTO_MAX_ALG_NAME) + goto out_err; + inst->alg.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER; inst->alg.cra_priority = alg->cra_priority; inst->alg.cra_blocksize = alg->cra_blocksize; @@ -155,6 +161,12 @@ static struct crypto_instance *crypto_ecb_alloc(struct rtattr **tb) out_put_alg: crypto_mod_put(alg); return inst; + +out_err: + crypto_drop_spawn(crypto_instance_ctx(inst)); + kfree(inst); + crypto_mod_put(alg); + return ERR_PTR(err); } static void crypto_ecb_free(struct crypto_instance *inst) -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html