Also, zero the SHA256 context.
suggested by "eric" in a comment on an opensslrampage.org post
ok miod@ deraadt@
-/* $OpenBSD: getentropy_linux.c,v 1.29 2014/07/21 19:15:56 deraadt Exp $ */
+/* $OpenBSD: getentropy_linux.c,v 1.30 2014/07/21 20:19:47 guenther Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
memcpy((char *)buf + i, results, min(sizeof(results), len - i));
i += min(sizeof(results), len - i);
}
- memset(results, 0, sizeof results);
+ explicit_bzero(&ctx, sizeof ctx);
+ explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) {
errno = save_errno;
return 0; /* satisfied */
-/* $OpenBSD: getentropy_osx.c,v 1.7 2014/07/19 16:12:00 deraadt Exp $ */
+/* $OpenBSD: getentropy_osx.c,v 1.8 2014/07/21 20:19:47 guenther Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
memcpy((char *)buf + i, results, min(sizeof(results), len - i));
i += min(sizeof(results), len - i);
}
- memset(results, 0, sizeof results);
+ explicit_bzero(&ctx, sizeof ctx);
+ explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) {
errno = save_errno;
return 0; /* satisfied */
-/* $OpenBSD: getentropy_solaris.c,v 1.8 2014/07/19 16:12:00 deraadt Exp $ */
+/* $OpenBSD: getentropy_solaris.c,v 1.9 2014/07/21 20:19:47 guenther Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
memcpy((char *)buf + i, results, min(sizeof(results), len - i));
i += min(sizeof(results), len - i);
}
- memset(results, 0, sizeof results);
+ explicit_bzero(&ctx, sizeof ctx);
+ explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) {
errno = save_errno;
return 0; /* satisfied */
-/* $OpenBSD: getentropy_linux.c,v 1.29 2014/07/21 19:15:56 deraadt Exp $ */
+/* $OpenBSD: getentropy_linux.c,v 1.30 2014/07/21 20:19:47 guenther Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
memcpy((char *)buf + i, results, min(sizeof(results), len - i));
i += min(sizeof(results), len - i);
}
- memset(results, 0, sizeof results);
+ explicit_bzero(&ctx, sizeof ctx);
+ explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) {
errno = save_errno;
return 0; /* satisfied */
-/* $OpenBSD: getentropy_osx.c,v 1.7 2014/07/19 16:12:00 deraadt Exp $ */
+/* $OpenBSD: getentropy_osx.c,v 1.8 2014/07/21 20:19:47 guenther Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
memcpy((char *)buf + i, results, min(sizeof(results), len - i));
i += min(sizeof(results), len - i);
}
- memset(results, 0, sizeof results);
+ explicit_bzero(&ctx, sizeof ctx);
+ explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) {
errno = save_errno;
return 0; /* satisfied */
-/* $OpenBSD: getentropy_solaris.c,v 1.8 2014/07/19 16:12:00 deraadt Exp $ */
+/* $OpenBSD: getentropy_solaris.c,v 1.9 2014/07/21 20:19:47 guenther Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
memcpy((char *)buf + i, results, min(sizeof(results), len - i));
i += min(sizeof(results), len - i);
}
- memset(results, 0, sizeof results);
+ explicit_bzero(&ctx, sizeof ctx);
+ explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) {
errno = save_errno;
return 0; /* satisfied */