Skip to content

Commit

Permalink
crypto: keywrap - memzero the correct memory
Browse files Browse the repository at this point in the history
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: e28facd ('crypto: keywrap - add key wrapping block chaining mode')
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Dan Carpenter authored and herbertx committed Feb 1, 2016
1 parent d166216 commit 2b8b28f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/keywrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2b8b28f

Please sign in to comment.