2016-12-22 15:00:57

by Cabiddu, Giovanni

[permalink] [raw]
Subject: [PATCH] crypto: qat - initialize cra_flags before register into kpp

Initialize dh.base.cra_flags before registering the dh algorithm.
Without this fix, the registration of the dh algorithm might fail
if the qat driver is restarted.

Signed-off-by: Sushil Kumar <[email protected]>
Signed-off-by: Giovanni Cabiddu <[email protected]>
---
drivers/crypto/qat/qat_common/qat_asym_algs.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c
index 0d35dca..d3518e6 100644
--- a/drivers/crypto/qat/qat_common/qat_asym_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c
@@ -1343,6 +1343,7 @@ int qat_asym_algs_register(void)
ret = crypto_register_akcipher(&rsa);
if (ret)
goto unlock;
+ dh.base.cra_flags = 0;
ret = crypto_register_kpp(&dh);
}
unlock:
--
2.9.3


2016-12-28 10:30:33

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: qat - initialize cra_flags before register into kpp

On Thu, Dec 22, 2016 at 03:00:51PM +0000, Giovanni Cabiddu wrote:
> Initialize dh.base.cra_flags before registering the dh algorithm.
> Without this fix, the registration of the dh algorithm might fail
> if the qat driver is restarted.
>
> Signed-off-by: Sushil Kumar <[email protected]>
> Signed-off-by: Giovanni Cabiddu <[email protected]>

Please patch the crypto API instead. I think unsetting the bit
CRYPTO_ALG_DEAD at the top of crypto_register_alg should do the
trick.

Thanks,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt