summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-03-23 23:27:52 +0000
committertedu <tedu@openbsd.org>2014-03-23 23:27:52 +0000
commit90e74185ccf25d4ed608c2a50bf088724a20f818 (patch)
tree9d2ebe28b5af1bccfd3daa97dda3a321bde9133e /lib/libc
parentRemove the MD4 functions. (diff)
downloadwireguard-openbsd-90e74185ccf25d4ed608c2a50bf088724a20f818.tar.xz
wireguard-openbsd-90e74185ccf25d4ed608c2a50bf088724a20f818.zip
clear stack variables, suggested by djm
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/crypt/bcrypt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/crypt/bcrypt.c b/lib/libc/crypt/bcrypt.c
index 7d388cf2ea8..4fa36bf6e25 100644
--- a/lib/libc/crypt/bcrypt.c
+++ b/lib/libc/crypt/bcrypt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcrypt.c,v 1.34 2014/03/23 23:25:05 tedu Exp $ */
+/* $OpenBSD: bcrypt.c,v 1.35 2014/03/23 23:27:52 tedu Exp $ */
/*
* Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
@@ -218,6 +218,7 @@ bcrypt_newhash(const char *pass, int log_rounds, char *hash, size_t hashlen)
if (bcrypt_hashpass(pass, salt, hash, hashlen) != 0)
return -1;
+ explicit_bzero(salt, sizeof(salt));
return 0;
}
@@ -231,6 +232,8 @@ bcrypt_checkpass(const char *pass, const char *goodhash)
if (strlen(hash) != strlen(goodhash) ||
timingsafe_bcmp(hash, goodhash, strlen(goodhash)) != 0)
return -1;
+
+ explicit_bzero(hash, sizeof(hash));
return 0;
}