summaryrefslogtreecommitdiff
path: root/drivers/crypto/ccp/ccp-crypto-sha.c
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2016-04-13 10:52:25 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2016-04-15 22:13:56 +0800
commitf709b45ec461b548c41a00044dba1f1b572783bf (patch)
tree8bf82dcdad57d141c1ff585865bff2ced1fc7c6a /drivers/crypto/ccp/ccp-crypto-sha.c
parent0851561d9c965df086ef8a53f981f5f95a57c2c8 (diff)
crypto: ccp - Prevent information leakage on export
Prevent information from leaking to userspace by doing a memset to 0 of the export state structure before setting the structure values and copying it. This prevents un-initialized padding areas from being copied into the export area. Cc: <stable@vger.kernel.org> # 3.14.x- Reported-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-crypto-sha.c')
-rw-r--r--drivers/crypto/ccp/ccp-crypto-sha.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c
index b5ad72897dc2..8f36af62fe95 100644
--- a/drivers/crypto/ccp/ccp-crypto-sha.c
+++ b/drivers/crypto/ccp/ccp-crypto-sha.c
@@ -212,6 +212,9 @@ static int ccp_sha_export(struct ahash_request *req, void *out)
struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
struct ccp_sha_exp_ctx state;
+ /* Don't let anything leak to 'out' */
+ memset(&state, 0, sizeof(state));
+
state.type = rctx->type;
state.msg_bits = rctx->msg_bits;
state.first = rctx->first;