aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-01-11 09:02:42 -0500
committerNick Mathewson <nickm@torproject.org>2016-01-11 09:02:42 -0500
commit1d6dd288e1c084a5118785899cca910e8c69fbb1 (patch)
tree1d4bd022cc8faf1fd573dae8b5b4a6cdf484f17b /src/common/crypto.c
parentd10ea49588701b29148a27c87701961227d63ba9 (diff)
downloadtor-1d6dd288e1c084a5118785899cca910e8c69fbb1.tar.gz
tor-1d6dd288e1c084a5118785899cca910e8c69fbb1.zip
Try a little harder to only use SecureZeroMemory when it's present
We could be using AC_CHECK_FUNC_DECL too, but it shouldn't be needed.
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 2f498ac6be..9cc5ee01fa 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -2960,9 +2960,11 @@ memwipe(void *mem, uint8_t byte, size_t sz)
* have this function call "memset". A smart compiler could inline it, then
* eliminate dead memsets, and declare itself to be clever. */
-#ifdef _WIN32
+#if defined(SecureZeroMemory) || defined(HAVE_SECUREZEROMEMORY)
/* Here's what you do on windows. */
SecureZeroMemory(mem,sz);
+#elif defined(HAVE_RTLSECUREZEROMEMORY)
+ RtlSecureZeroMemory(mem,sz);
#elif defined(HAVE_EXPLICIT_BZERO)
/* The BSDs provide this. */
explicit_bzero(mem, sz);