]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: ccp - memset request context to zero during import
authorTom Lendacky <thomas.lendacky@amd.com>
Thu, 25 Feb 2016 22:48:13 +0000 (16:48 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 30 Apr 2016 22:05:51 +0000 (00:05 +0200)
commit ce0ae266feaf35930394bd770c69778e4ef03ba9 upstream.

Since a crypto_ahash_import() can be called against a request context
that has not had a crypto_ahash_init() performed, the request context
needs to be cleared to insure there is no random data present. If not,
the random data can result in a kernel oops during crypto_ahash_update().

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/crypto/ccp/ccp-crypto-aes-cmac.c
drivers/crypto/ccp/ccp-crypto-sha.c

index bc19c1ee69e003b7e0ea875c4153d317fecf7d42..5c93afb1841a614ee9d19733884fb60fd1f4e793 100644 (file)
@@ -225,6 +225,7 @@ static int ccp_aes_cmac_import(struct ahash_request *req, const void *in)
        /* 'in' may not be aligned so memcpy to local variable */
        memcpy(&state, in, sizeof(state));
 
+       memset(rctx, 0, sizeof(*rctx));
        rctx->null_msg = state.null_msg;
        memcpy(rctx->iv, state.iv, sizeof(rctx->iv));
        rctx->buf_count = state.buf_count;
index 5c9d75bd155891e8f4e5cdcee72293a99e71660b..4c6742fc214670e74944e36715ebd306c238bfd1 100644 (file)
@@ -219,6 +219,7 @@ static int ccp_sha_import(struct ahash_request *req, const void *in)
        /* 'in' may not be aligned so memcpy to local variable */
        memcpy(&state, in, sizeof(state));
 
+       memset(rctx, 0, sizeof(*rctx));
        rctx->type = state.type;
        rctx->msg_bits = state.msg_bits;
        rctx->first = state.first;