]> git.karo-electronics.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 16:08:45 +0000 (09:08 -0700)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/ccp/ccp-crypto-aes-cmac.c
drivers/crypto/ccp/ccp-crypto-sha.c

index d095452b8828e6c50b30c8ac3254975f9f8cef6c..3d9acc53d2473818d1e37c4af432a4afcbdf4ec4 100644 (file)
@@ -244,6 +244,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 7002c6b283e5763b48ce71bcb84d56963875ae40..8ef06fad8b141487a5546d33a509b3f0a40ba079 100644 (file)
@@ -233,6 +233,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;