Commit f69c1b51 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

crypto: keywrap - memzero the correct memory

commit 2b8b28fd upstream.

We're clearing the wrong memory.  The memory corruption is likely
harmless because we weren't going to use that stack memory again but not
zeroing is a potential information leak.

Fixes: e28facde ('crypto: keywrap - add key wrapping block chaining mode')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarStephan Mueller <smueller@chronox.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0cdc91f5
...@@ -212,7 +212,7 @@ static int crypto_kw_decrypt(struct blkcipher_desc *desc, ...@@ -212,7 +212,7 @@ static int crypto_kw_decrypt(struct blkcipher_desc *desc,
SEMIBSIZE)) SEMIBSIZE))
ret = -EBADMSG; ret = -EBADMSG;
memzero_explicit(&block, sizeof(struct crypto_kw_block)); memzero_explicit(block, sizeof(struct crypto_kw_block));
return ret; return ret;
} }
...@@ -297,7 +297,7 @@ static int crypto_kw_encrypt(struct blkcipher_desc *desc, ...@@ -297,7 +297,7 @@ static int crypto_kw_encrypt(struct blkcipher_desc *desc,
/* establish the IV for the caller to pick up */ /* establish the IV for the caller to pick up */
memcpy(desc->info, block->A, SEMIBSIZE); memcpy(desc->info, block->A, SEMIBSIZE);
memzero_explicit(&block, sizeof(struct crypto_kw_block)); memzero_explicit(block, sizeof(struct crypto_kw_block));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment