Re: [PATCH v2 02/20] crypto: testmgr to use CRYPTO_ALG_INTERNAL

From: Stephan Mueller
Date: Mon Mar 30 2015 - 15:32:09 EST


Am Dienstag, 31. März 2015, 00:10:34 schrieb Herbert Xu:

Hi Herbert,

> 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;

Thank you for the hint. It works and I will release a patch shortly.
>
> Thanks,


--
Ciao
Stephan
--
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/