summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto/getentropy_solaris.c
diff options
context:
space:
mode:
authorguenther <>2014-07-21 20:19:47 +0000
committerguenther <>2014-07-21 20:19:47 +0000
commit020061f74efb2de9e81b625947d12fd92d08952b (patch)
tree588eebfad0a28f66ac52ceda81d8469ab9e5f975 /src/lib/libcrypto/crypto/getentropy_solaris.c
parent73be6bb9aaf4024e2879d17858a2de7863fea9f5 (diff)
downloadopenbsd-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_solaris.c')
-rw-r--r--src/lib/libcrypto/crypto/getentropy_solaris.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/crypto/getentropy_solaris.c b/src/lib/libcrypto/crypto/getentropy_solaris.c
index fed0eeb53a..6ec2fe584c 100644
--- a/src/lib/libcrypto/crypto/getentropy_solaris.c
+++ b/src/lib/libcrypto/crypto/getentropy_solaris.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getentropy_solaris.c,v 1.8 2014/07/19 16:12:00 deraadt Exp $ */ 1/* $OpenBSD: getentropy_solaris.c,v 1.9 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>
@@ -434,7 +434,8 @@ getentropy_fallback(void *buf, size_t len)
434 memcpy((char *)buf + i, results, min(sizeof(results), len - i)); 434 memcpy((char *)buf + i, results, min(sizeof(results), len - i));
435 i += min(sizeof(results), len - i); 435 i += min(sizeof(results), len - i);
436 } 436 }
437 memset(results, 0, sizeof results); 437 explicit_bzero(&ctx, sizeof ctx);
438 explicit_bzero(results, sizeof results);
438 if (gotdata(buf, len) == 0) { 439 if (gotdata(buf, len) == 0) {
439 errno = save_errno; 440 errno = save_errno;
440 return 0; /* satisfied */ 441 return 0; /* satisfied */