aboutsummaryrefslogtreecommitdiffstats
path: root/src/crypto/sha1-internal.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2019-05-25 21:47:17 (GMT)
committerJouni Malinen <j@w1.fi>2019-05-26 13:11:56 (GMT)
commit31bc66e4d1934dfc663a31e0bb450b2885e6a453 (patch)
treee008bb3e051db26908d6cec5c01388e17cefe999 /src/crypto/sha1-internal.c
parente1923f5b6a48d6bb453d716568339be797e3ae7f (diff)
downloadhostap-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-internal.c')
-rw-r--r--src/crypto/sha1-internal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crypto/sha1-internal.c b/src/crypto/sha1-internal.c
index a491707..ffa04df 100644
--- a/src/crypto/sha1-internal.c
+++ b/src/crypto/sha1-internal.c
@@ -224,7 +224,7 @@ void SHA1Transform(u32 state[5], const unsigned char buffer[64])
/* Wipe variables */
a = b = c = d = e = 0;
#ifdef SHA1HANDSOFF
- os_memset(block, 0, 64);
+ forced_memzero(block, 64);
#endif
}
@@ -300,7 +300,7 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
os_memset(context->buffer, 0, 64);
os_memset(context->state, 0, 20);
os_memset(context->count, 0, 8);
- os_memset(finalcount, 0, 8);
+ forced_memzero(finalcount, sizeof(finalcount));
}
/* ===== end - public domain SHA1 implementation ===== */