diff options
author | guenther <> | 2014-07-21 20:19:47 +0000 |
---|---|---|
committer | guenther <> | 2014-07-21 20:19:47 +0000 |
commit | 020061f74efb2de9e81b625947d12fd92d08952b (patch) | |
tree | 588eebfad0a28f66ac52ceda81d8469ab9e5f975 /src/lib/libcrypto/crypto/getentropy_linux.c | |
parent | 73be6bb9aaf4024e2879d17858a2de7863fea9f5 (diff) | |
download | openbsd-020061f74efb2de9e81b625947d12fd92d08952b.tar.gz openbsd-020061f74efb2de9e81b625947d12fd92d08952b.tar.bz2 openbsd-020061f74efb2de9e81b625947d12fd92d08952b.zip |
Use explicit_bzero() instead of memset() on buffers going out of scope.
Also, zero the SHA256 context.
suggested by "eric" in a comment on an opensslrampage.org post
ok miod@ deraadt@
Diffstat (limited to 'src/lib/libcrypto/crypto/getentropy_linux.c')
-rw-r--r-- | src/lib/libcrypto/crypto/getentropy_linux.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/crypto/getentropy_linux.c b/src/lib/libcrypto/crypto/getentropy_linux.c index 6947102136..eeaf9a4ef9 100644 --- a/src/lib/libcrypto/crypto/getentropy_linux.c +++ b/src/lib/libcrypto/crypto/getentropy_linux.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getentropy_linux.c,v 1.29 2014/07/21 19:15:56 deraadt Exp $ */ | 1 | /* $OpenBSD: getentropy_linux.c,v 1.30 2014/07/21 20:19:47 guenther Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> | 4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> |
@@ -539,7 +539,8 @@ getentropy_fallback(void *buf, size_t len) | |||
539 | memcpy((char *)buf + i, results, min(sizeof(results), len - i)); | 539 | memcpy((char *)buf + i, results, min(sizeof(results), len - i)); |
540 | i += min(sizeof(results), len - i); | 540 | i += min(sizeof(results), len - i); |
541 | } | 541 | } |
542 | memset(results, 0, sizeof results); | 542 | explicit_bzero(&ctx, sizeof ctx); |
543 | explicit_bzero(results, sizeof results); | ||
543 | if (gotdata(buf, len) == 0) { | 544 | if (gotdata(buf, len) == 0) { |
544 | errno = save_errno; | 545 | errno = save_errno; |
545 | return 0; /* satisfied */ | 546 | return 0; /* satisfied */ |