Skip to content

Commit 3b30460

Browse files
Ard Biesheuvelherbertx
authored andcommitted
crypto: ccm - move cbcmac input off the stack
Commit f15f05b ("crypto: ccm - switch to separate cbcmac driver") refactored the CCM driver to allow separate implementations of the underlying MAC to be provided by a platform. However, in doing so, it moved some data from the linear region to the stack, which violates the SG constraints when the stack is virtually mapped. So move idata/odata back to the request ctx struct, of which we can reasonably expect that it has been allocated using kmalloc() et al. Reported-by: Johannes Berg <johannes@sipsolutions.net> Fixes: f15f05b ("crypto: ccm - switch to separate cbcmac driver") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 8902757 commit 3b30460

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crypto/ccm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct crypto_rfc4309_req_ctx {
4545

4646
struct crypto_ccm_req_priv_ctx {
4747
u8 odata[16];
48+
u8 idata[16];
4849
u8 auth_tag[16];
4950
u32 flags;
5051
struct scatterlist src[3];
@@ -183,8 +184,8 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain,
183184
AHASH_REQUEST_ON_STACK(ahreq, ctx->mac);
184185
unsigned int assoclen = req->assoclen;
185186
struct scatterlist sg[3];
186-
u8 odata[16];
187-
u8 idata[16];
187+
u8 *odata = pctx->odata;
188+
u8 *idata = pctx->idata;
188189
int ilen, err;
189190

190191
/* format control data for input */

0 commit comments

Comments
 (0)