提交 3b30460c 编写于 作者: A Ard Biesheuvel 提交者: Herbert Xu

crypto: ccm - move cbcmac input off the stack

Commit f15f05b0 ("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: NJohannes Berg <johannes@sipsolutions.net>
Fixes: f15f05b0 ("crypto: ccm - switch to separate cbcmac driver")
Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 89027579
...@@ -45,6 +45,7 @@ struct crypto_rfc4309_req_ctx { ...@@ -45,6 +45,7 @@ struct crypto_rfc4309_req_ctx {
struct crypto_ccm_req_priv_ctx { struct crypto_ccm_req_priv_ctx {
u8 odata[16]; u8 odata[16];
u8 idata[16];
u8 auth_tag[16]; u8 auth_tag[16];
u32 flags; u32 flags;
struct scatterlist src[3]; struct scatterlist src[3];
...@@ -183,8 +184,8 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain, ...@@ -183,8 +184,8 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain,
AHASH_REQUEST_ON_STACK(ahreq, ctx->mac); AHASH_REQUEST_ON_STACK(ahreq, ctx->mac);
unsigned int assoclen = req->assoclen; unsigned int assoclen = req->assoclen;
struct scatterlist sg[3]; struct scatterlist sg[3];
u8 odata[16]; u8 *odata = pctx->odata;
u8 idata[16]; u8 *idata = pctx->idata;
int ilen, err; int ilen, err;
/* format control data for input */ /* format control data for input */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册