]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/crypto-chacha20poly1305-set-cra_name-correctly.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / crypto-chacha20poly1305-set-cra_name-correctly.patch
1 From 5e27f38f1f3f45a0c938299c3a34a2d2db77165a Mon Sep 17 00:00:00 2001
2 From: Eric Biggers <ebiggers@google.com>
3 Date: Sun, 31 Mar 2019 13:04:16 -0700
4 Subject: crypto: chacha20poly1305 - set cra_name correctly
5
6 From: Eric Biggers <ebiggers@google.com>
7
8 commit 5e27f38f1f3f45a0c938299c3a34a2d2db77165a upstream.
9
10 If the rfc7539 template is instantiated with specific implementations,
11 e.g. "rfc7539(chacha20-generic,poly1305-generic)" rather than
12 "rfc7539(chacha20,poly1305)", then the implementation names end up
13 included in the instance's cra_name. This is incorrect because it then
14 prevents all users from allocating "rfc7539(chacha20,poly1305)", if the
15 highest priority implementations of chacha20 and poly1305 were selected.
16 Also, the self-tests aren't run on an instance allocated in this way.
17
18 Fix it by setting the instance's cra_name from the underlying
19 algorithms' actual cra_names, rather than from the requested names.
20 This matches what other templates do.
21
22 Fixes: 71ebc4d1b27d ("crypto: chacha20poly1305 - Add a ChaCha20-Poly1305 AEAD construction, RFC7539")
23 Cc: <stable@vger.kernel.org> # v4.2+
24 Cc: Martin Willi <martin@strongswan.org>
25 Signed-off-by: Eric Biggers <ebiggers@google.com>
26 Reviewed-by: Martin Willi <martin@strongswan.org>
27 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30
31 ---
32 crypto/chacha20poly1305.c | 4 ++--
33 1 file changed, 2 insertions(+), 2 deletions(-)
34
35 --- a/crypto/chacha20poly1305.c
36 +++ b/crypto/chacha20poly1305.c
37 @@ -637,8 +637,8 @@ static int chachapoly_create(struct cryp
38
39 err = -ENAMETOOLONG;
40 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME,
41 - "%s(%s,%s)", name, chacha_name,
42 - poly_name) >= CRYPTO_MAX_ALG_NAME)
43 + "%s(%s,%s)", name, chacha->cra_name,
44 + poly->cra_name) >= CRYPTO_MAX_ALG_NAME)
45 goto out_drop_chacha;
46 if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME,
47 "%s(%s,%s)", name, chacha->cra_driver_name,