diff options
author | Jouni Malinen <j@w1.fi> | 2019-05-25 21:47:17 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2019-05-26 13:11:56 (GMT) |
commit | 31bc66e4d1934dfc663a31e0bb450b2885e6a453 (patch) | |
tree | e008bb3e051db26908d6cec5c01388e17cefe999 /src/crypto/sha1-tlsprf.c | |
parent | e1923f5b6a48d6bb453d716568339be797e3ae7f (diff) | |
download | hostap-31bc66e4d1934dfc663a31e0bb450b2885e6a453.zip hostap-31bc66e4d1934dfc663a31e0bb450b2885e6a453.tar.gz hostap-31bc66e4d1934dfc663a31e0bb450b2885e6a453.tar.bz2 |
More forceful clearing of stack memory with keys
gcc 8.3.0 was apparently clever enough to optimize away the previously
used os_memset() to explicitly clear a stack buffer that contains keys
when that clearing happened just before returning from the function.
Since memset_s() is not exactly portable (or commonly available yet..),
use a less robust mechanism that is still pretty likely to prevent
current compilers from optimizing the explicit clearing of the memory
away.
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/crypto/sha1-tlsprf.c')
-rw-r--r-- | src/crypto/sha1-tlsprf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crypto/sha1-tlsprf.c b/src/crypto/sha1-tlsprf.c index a11649a..5e8d159 100644 --- a/src/crypto/sha1-tlsprf.c +++ b/src/crypto/sha1-tlsprf.c @@ -92,10 +92,10 @@ int tls_prf_sha1_md5(const u8 *secret, size_t secret_len, const char *label, SHA1_pos++; } - os_memset(A_MD5, 0, MD5_MAC_LEN); - os_memset(P_MD5, 0, MD5_MAC_LEN); - os_memset(A_SHA1, 0, SHA1_MAC_LEN); - os_memset(P_SHA1, 0, SHA1_MAC_LEN); + forced_memzero(A_MD5, MD5_MAC_LEN); + forced_memzero(P_MD5, MD5_MAC_LEN); + forced_memzero(A_SHA1, SHA1_MAC_LEN); + forced_memzero(P_SHA1, SHA1_MAC_LEN); return 0; } |