author | Eric Biggers <ebiggers@google.com> | 2018-12-05 00:46:54 (GMT) |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2019-01-18 20:43:34 (GMT) |
commit | b1711f7899c8520978fc62d169409ebf68a04d13 (patch) | |
tree | 414b2106da34c43e306ec13e6dde190930ec15d4 | |
parent | 736cb63e53e4bbcea86700ef59a96dd2d7e2a6e2 (diff) | |
download | common-b1711f7899c8520978fc62d169409ebf68a04d13.zip common-b1711f7899c8520978fc62d169409ebf68a04d13.tar.gz common-b1711f7899c8520978fc62d169409ebf68a04d13.tar.bz2 |
UPSTREAM: crypto: adiantum - propagate CRYPTO_ALG_ASYNC flag to instance
If the stream cipher implementation is asynchronous, then the Adiantum
instance must be flagged as asynchronous as well. Otherwise someone
asking for a synchronous algorithm can get an asynchronous algorithm.
There are no asynchronous xchacha12 or xchacha20 implementations yet
which makes this largely a theoretical issue, but it should be fixed.
Fixes: 059c2a4d8e16 ("crypto: adiantum - add Adiantum support")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit b299362ee48db8eab34208302ee9730ff9d6091c)
Test: Adiantum self-tests
Change-Id: Ic7207e4036a0f03fba81375ffe36f511af2eb08c
-rw-r--r-- | crypto/adiantum.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/adiantum.c b/crypto/adiantum.c index 2dfcf12..ca27e0d 100644 --- a/crypto/adiantum.c +++ b/crypto/adiantum.c @@ -590,6 +590,8 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb) hash_alg->base.cra_driver_name) >= CRYPTO_MAX_ALG_NAME) goto out_drop_hash; + inst->alg.base.cra_flags = streamcipher_alg->base.cra_flags & + CRYPTO_ALG_ASYNC; inst->alg.base.cra_blocksize = BLOCKCIPHER_BLOCK_SIZE; inst->alg.base.cra_ctxsize = sizeof(struct adiantum_tfm_ctx); inst->alg.base.cra_alignmask = streamcipher_alg->base.cra_alignmask | |