add explicit_bzero implementation

maintainer's note: past sentiment was that, despite being imperfect
and unable to force clearing of all possible copies of sensitive data
(e.g. in registers, register spills, signal contexts left on the
stack, etc.) this function would be added if major implementations
agreed on it, which has happened -- several BSDs and glibc all include
it.
This commit is contained in:
David Carlier authored and Rich Felker committed 2018-06-26 16:59:12 -04:00
1 parent 5c8e69267b
commit 05ac345f89
2 files changed
+9

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
#define _BSD_SOURCE
#include <string.h>
void explicit_bzero(void *d, size_t n)
{
memset(d, 0, n);
__asm__ __volatile__ ("" : : "r"(d) : "memory");
}