diff mbox

crypto: keywrap - memzero the correct memory

Message ID 20160130143828.GC3462@mwanda (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Dan Carpenter Jan. 30, 2016, 2:38 p.m. UTC
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: e28facde3c39 ('crypto: keywrap - add key wrapping block chaining mode')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Stephan Mueller Jan. 31, 2016, 1 p.m. UTC | #1
Am Samstag, 30. Januar 2016, 17:38:28 schrieb Dan Carpenter:

Hi Dan,

> 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: e28facde3c39 ('crypto: keywrap - add key wrapping block chaining
> mode') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Stephan Mueller <smueller@chronox.de>

Thanks
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu Feb. 1, 2016, 2:35 p.m. UTC | #2
On Sat, Jan 30, 2016 at 05:38:28PM +0300, Dan Carpenter wrote:
> 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: e28facde3c39 ('crypto: keywrap - add key wrapping block chaining mode')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.
diff mbox

Patch

diff --git a/crypto/keywrap.c b/crypto/keywrap.c
index b1d106c..72014f9 100644
--- a/crypto/keywrap.c
+++ b/crypto/keywrap.c
@@ -212,7 +212,7 @@  static int crypto_kw_decrypt(struct blkcipher_desc *desc,
 			  SEMIBSIZE))
 		ret = -EBADMSG;
 
-	memzero_explicit(&block, sizeof(struct crypto_kw_block));
+	memzero_explicit(block, sizeof(struct crypto_kw_block));
 
 	return ret;
 }
@@ -297,7 +297,7 @@  static int crypto_kw_encrypt(struct blkcipher_desc *desc,
 	/* establish the IV for the caller to pick up */
 	memcpy(desc->info, block->A, SEMIBSIZE);
 
-	memzero_explicit(&block, sizeof(struct crypto_kw_block));
+	memzero_explicit(block, sizeof(struct crypto_kw_block));
 
 	return 0;
 }