aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-11-14 21:25:29 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2012-11-14 21:25:29 +0000
commitd9b50a8cfdfa0b327629dc18076dbd1563dfba3e (patch)
tree57ba691f55b45511ff5f4f277175c03796689c4a /src/serialize.h
parent220de9aafbdb76fa620531fc5c0b01ffa6616d7b (diff)
parent65cee0bbbdea49c08bc84be7824ab004cc19f57e (diff)
downloadbitcoin-d9b50a8cfdfa0b327629dc18076dbd1563dfba3e.tar.xz
Merge branch '0.4.x' into 0.5.x
Conflicts: src/bitcoinrpc.cpp
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/serialize.h b/src/serialize.h
index ed5c501353..a96ea25f74 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -14,6 +14,8 @@
#include <cstring>
#include <cstdio>
+#include <openssl/crypto.h> // for OPENSSL_cleanse()
+
#include <boost/type_traits/is_fundamental.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
@@ -824,7 +826,7 @@ struct secure_allocator : public std::allocator<T>
{
if (p != NULL)
{
- memset(p, 0, sizeof(T) * n);
+ OPENSSL_cleanse(p, sizeof(T) * n);
munlock(p, sizeof(T) * n);
}
std::allocator<T>::deallocate(p, n);
@@ -858,7 +860,7 @@ struct zero_after_free_allocator : public std::allocator<T>
void deallocate(T* p, std::size_t n)
{
if (p != NULL)
- memset(p, 0, sizeof(T) * n);
+ OPENSSL_cleanse(p, sizeof(T) * n);
std::allocator<T>::deallocate(p, n);
}
};