diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-04 09:01:36 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-12 20:16:17 +0100 |
commit | 867c10a03f84599af1c0c4d820b78aabd5308c65 (patch) | |
tree | 754de41c00946750d068cbaf4f7e198cc404d79e /crypto | |
parent | ff7397add93551647269785a03583aec2ba9f99a (diff) | |
download | linux-stable-867c10a03f84599af1c0c4d820b78aabd5308c65.tar.gz linux-stable-867c10a03f84599af1c0c4d820b78aabd5308c65.tar.bz2 linux-stable-867c10a03f84599af1c0c4d820b78aabd5308c65.zip |
crypto: asym_tpm: correct zero out potential secrets
commit f93274ef0fe972c120c96b3207f8fce376231a60 upstream.
The function derive_pub_key() should be calling memzero_explicit()
instead of memset() in case the complier decides to optimize away the
call to memset() because it "knows" no one is going to touch the memory
anymore.
Cc: stable <stable@vger.kernel.org>
Reported-by: Ilil Blum Shem-Tov <ilil.blum.shem-tov@intel.com>
Tested-by: Ilil Blum Shem-Tov <ilil.blum.shem-tov@intel.com>
Link: https://lore.kernel.org/r/X8ns4AfwjKudpyfe@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asymmetric_keys/asym_tpm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/asymmetric_keys/asym_tpm.c b/crypto/asymmetric_keys/asym_tpm.c index 5154e280ada2..08baa10a254b 100644 --- a/crypto/asymmetric_keys/asym_tpm.c +++ b/crypto/asymmetric_keys/asym_tpm.c @@ -370,7 +370,7 @@ static uint32_t derive_pub_key(const void *pub_key, uint32_t len, uint8_t *buf) memcpy(cur, e, sizeof(e)); cur += sizeof(e); /* Zero parameters to satisfy set_pub_key ABI. */ - memset(cur, 0, SETKEY_PARAMS_SIZE); + memzero_explicit(cur, SETKEY_PARAMS_SIZE); return cur - buf; } |