]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.7.3/crypto-caam-defer-aead_set_sh_desc-in-case-of-zero-authsize.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.7.3 / crypto-caam-defer-aead_set_sh_desc-in-case-of-zero-authsize.patch
1 From 2fdea258fde036a87d3396ec9c0ef66f10768530 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Horia=20Geant=C4=83?= <horia.geanta@nxp.com>
3 Date: Thu, 4 Aug 2016 20:02:47 +0300
4 Subject: crypto: caam - defer aead_set_sh_desc in case of zero authsize
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Horia Geantă <horia.geanta@nxp.com>
10
11 commit 2fdea258fde036a87d3396ec9c0ef66f10768530 upstream.
12
13 To be able to generate shared descriptors for AEAD, the authentication size
14 needs to be known. However, there is no imposed order of calling .setkey,
15 .setauthsize callbacks.
16
17 Thus, in case authentication size is not known at .setkey time, defer it
18 until .setauthsize is called.
19
20 The authsize != 0 check was incorrectly removed when converting the driver
21 to the new AEAD interface.
22
23 Fixes: 479bcc7c5b9e ("crypto: caam - Convert authenc to new AEAD interface")
24 Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
25 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 drivers/crypto/caam/caamalg.c | 3 +++
30 1 file changed, 3 insertions(+)
31
32 --- a/drivers/crypto/caam/caamalg.c
33 +++ b/drivers/crypto/caam/caamalg.c
34 @@ -441,6 +441,9 @@ static int aead_set_sh_desc(struct crypt
35 OP_ALG_AAI_CTR_MOD128);
36 const bool is_rfc3686 = alg->caam.rfc3686;
37
38 + if (!ctx->authsize)
39 + return 0;
40 +
41 /* NULL encryption / decryption */
42 if (!ctx->enckeylen)
43 return aead_null_set_sh_desc(aead);