# HG changeset patch # User Matt Johnston # Date 1458142779 -28800 # Node ID 94d4038bb34c473bf84d0a74fe281bffdcb739cb # Parent f107cef4be68ef76e7a943c9fee89a7f4e60eacd Use memset_s or explicit_bzero diff -r f107cef4be68 -r 94d4038bb34c configure.ac --- a/configure.ac Wed Mar 16 23:04:55 2016 +0800 +++ b/configure.ac Wed Mar 16 23:39:39 2016 +0800 @@ -375,6 +375,9 @@ AC_CHECK_HEADERS([mach/mach_time.h]) AC_CHECK_FUNCS(mach_absolute_time) +AC_CHECK_FUNCS(explicit_bzero memset_s) + + AC_ARG_ENABLE(bundled-libtom, [ --enable-bundled-libtom Force using bundled libtomcrypt/libtommath even if a system version exists. --disable-bundled-libtom Force using system libtomcrypt/libtommath, fail if it does not exist. diff -r f107cef4be68 -r 94d4038bb34c dbutil.c --- a/dbutil.c Wed Mar 16 23:04:55 2016 +0800 +++ b/dbutil.c Wed Mar 16 23:39:39 2016 +0800 @@ -564,6 +564,12 @@ /* Beware of calling this from within dbutil.c - things might get * optimised away */ void m_burn(void *data, unsigned int len) { + +#if defined(HAVE_MEMSET_S) + memset_s(data, len, 0x0, len); +#elif defined(HAVE_EXPLICIT_BZERO) + explicit_bzero(data, len); +#else volatile char *p = data; if (data == NULL) @@ -571,6 +577,7 @@ while (len--) { *p++ = 0x0; } +#endif }