2012-05-10 09:33:41

by Kasatkin, Dmitry

[permalink] [raw]
Subject: CRYPTO_ALG_ASYNC

Hello Herbert,

CRYPTO_ALG_ASYNC is heavily used like:

crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC);
or
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC;
.cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,

I see that only place where it is tested is in
ablockcipher.c:crypto_default_geniv()

What is actually meaning of that?

and setting it for hash??

Thanks,
Dmitry


2012-05-10 10:16:13

by Herbert Xu

[permalink] [raw]
Subject: Re: CRYPTO_ALG_ASYNC

On Thu, May 10, 2012 at 12:33:40PM +0300, Kasatkin, Dmitry wrote:
> Hello Herbert,
>
> CRYPTO_ALG_ASYNC is heavily used like:
>
> crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC);

Where did you see that? There is no need to specify ASYNC in the
mask for shash since they're always synchronous.

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

2012-05-10 10:31:11

by Kasatkin, Dmitry

[permalink] [raw]
Subject: Re: CRYPTO_ALG_ASYNC

On Thu, May 10, 2012 at 1:16 PM, Herbert Xu <[email protected]> wrote:
> On Thu, May 10, 2012 at 12:33:40PM +0300, Kasatkin, Dmitry wrote:
>> Hello Herbert,
>>
>> CRYPTO_ALG_ASYNC is heavily used like:
>>
>>     crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC);
>
> Where did you see that? There is no need to specify ASYNC in the
> mask for shash since they're always synchronous.
>

Yes, that is why I wonder...

For example in security/keys/

But why do we need it for AHASH or ABLKCIPHER?
It is obvious without it that they can be async?

- Dmitry

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

2012-05-10 10:47:38

by Herbert Xu

[permalink] [raw]
Subject: Re: CRYPTO_ALG_ASYNC

On Thu, May 10, 2012 at 01:31:10PM +0300, Kasatkin, Dmitry wrote:
>
> But why do we need it for AHASH or ABLKCIPHER?
> It is obvious without it that they can be async?

It makes sense for ahash/ablkcipher since even though you're
using the async API you can still request for a sync implementation.

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

2012-05-10 10:52:01

by Kasatkin, Dmitry

[permalink] [raw]
Subject: Re: CRYPTO_ALG_ASYNC

On Thu, May 10, 2012 at 1:47 PM, Herbert Xu <[email protected]> wrote:
> On Thu, May 10, 2012 at 01:31:10PM +0300, Kasatkin, Dmitry wrote:
>>
>> But why do we need it for AHASH or ABLKCIPHER?
>> It is obvious without it that they can be async?
>
> It makes sense for ahash/ablkcipher since even though you're
> using the async API you can still request for a sync implementation.

What I can see this flag is not tested and used.
Where is the place of code where it "returns" sync implementation?

- Dmitry

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