Re: [PATCH v2 02/20] crypto: testmgr to use CRYPTO_ALG_INTERNAL
From: Herbert Xu
Date: Mon Mar 30 2015 - 09:10:46 EST
On Fri, Mar 27, 2015 at 11:50:42PM +0100, Stephan Mueller wrote:
> If a cipher allocation fails with -ENOENT, the testmgr now retries
> to allocate the cipher with CRYPTO_ALG_INTERNAL flag.
>
> As all ciphers, including the internal ciphers will be processed by
> the testmgr, it needs to be able to allocate those ciphers.
>
> Signed-off-by: Stephan Mueller <smueller@xxxxxxxxxx>
> ---
> crypto/testmgr.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> index 1f879ad..609bafa 100644
> --- a/crypto/testmgr.c
> +++ b/crypto/testmgr.c
> @@ -1506,6 +1506,9 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver,
> int err = 0;
>
> tfm = crypto_alloc_aead(driver, type, mask);
> + if (PTR_ERR(tfm) == -ENOENT)
> + tfm = crypto_alloc_aead(driver, type | CRYPTO_ALG_INTERNAL,
> + mask | CRYPTO_ALG_INTERNAL);
We need to be able to say give me an algorithm regardless of the
INTERNAL bit. How about treating (type & CRYPTO_ALG_INTERNAL) &&
!(mask & CRYPTO_ALG_INTERNAL) as that special case?
So in patch 1 you would do
if (!((type | mask) & CRYPTO_ALG_INTERNAL))
mask |= CRYPTO_ALG_INTERNAL;
Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/