* Incorrect use of CRYPTO_ALG_ASYNC in crypto_alloc_sync_skcipher()?
@ 2024-04-09 9:51 David Howells
2024-04-09 9:56 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2024-04-09 9:51 UTC (permalink / raw)
To: Herbert Xu; +Cc: dhowells, David S. Miller, linux-crypto
Hi Herbert,
Is the following code in crypto_alloc_sync_skcipher() wrong:
/* Only sync algorithms allowed. */
mask |= CRYPTO_ALG_ASYNC | CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE;
in its specification of CRYPTO_ALG_ASYNC? Given what the docs say:
The mask flag restricts the type of cipher. The only allowed flag is
CRYPTO_ALG_ASYNC to restrict the cipher lookup function to
asynchronous ciphers. Usually, a caller provides a 0 for the mask flag.
^^^^^^^^^^^^
or are the docs wrong?
David
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Incorrect use of CRYPTO_ALG_ASYNC in crypto_alloc_sync_skcipher()?
2024-04-09 9:51 Incorrect use of CRYPTO_ALG_ASYNC in crypto_alloc_sync_skcipher()? David Howells
@ 2024-04-09 9:56 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2024-04-09 9:56 UTC (permalink / raw)
To: David Howells; +Cc: David S. Miller, linux-crypto
On Tue, Apr 09, 2024 at 10:51:30AM +0100, David Howells wrote:
> Hi Herbert,
>
> Is the following code in crypto_alloc_sync_skcipher() wrong:
>
> /* Only sync algorithms allowed. */
> mask |= CRYPTO_ALG_ASYNC | CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE;
>
> in its specification of CRYPTO_ALG_ASYNC? Given what the docs say:
>
> The mask flag restricts the type of cipher. The only allowed flag is
> CRYPTO_ALG_ASYNC to restrict the cipher lookup function to
> asynchronous ciphers. Usually, a caller provides a 0 for the mask flag.
> ^^^^^^^^^^^^
>
> or are the docs wrong?
The mask is used together with the type bitfield. You need to set
CRYPTO_ALG_ASYNC in both bitfields if you want to guarantee getting
an async cipher.
If you set CRYPTO_ALG_ASYNC in the mask but leave it unset in the
type bitfield then you are guaranteed to get an algorithm with this
bit turned off, in other words a synchronous cipher.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-09 9:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-09 9:51 Incorrect use of CRYPTO_ALG_ASYNC in crypto_alloc_sync_skcipher()? David Howells
2024-04-09 9:56 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.