diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2015-01-20 19:23:25 -0500 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2015-02-15 11:34:02 -0500 |
commit | 1630219d906f592c9258bfe2a0e0c4923df35782 (patch) | |
tree | 02b0ed9574290873f88bd0ebc1bd0a224c98e5b1 /src/support | |
parent | a9565863e09a32729bd6ce33f31889099b3d75cb (diff) |
openssl: abstract out OPENSSL_cleanse
This makes it easier for us to replace it if desired, since it's now only in
one spot. Also, it avoids the openssl include from allocators.h, which
essentially forced openssl to be included from every compilation unit.
Diffstat (limited to 'src/support')
-rw-r--r-- | src/support/cleanse.cpp | 13 | ||||
-rw-r--r-- | src/support/cleanse.h | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/support/cleanse.cpp b/src/support/cleanse.cpp new file mode 100644 index 0000000000..a2141b2449 --- /dev/null +++ b/src/support/cleanse.cpp @@ -0,0 +1,13 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "cleanse.h" + +#include <openssl/crypto.h> + +void memory_cleanse(void *ptr, size_t len) +{ + OPENSSL_cleanse(ptr, len); +} diff --git a/src/support/cleanse.h b/src/support/cleanse.h new file mode 100644 index 0000000000..3e02aa8fd1 --- /dev/null +++ b/src/support/cleanse.h @@ -0,0 +1,13 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_SUPPORT_CLEANSE_H +#define BITCOIN_SUPPORT_CLEANSE_H + +#include <stdlib.h> + +void memory_cleanse(void *ptr, size_t len); + +#endif // BITCOIN_SUPPORT_CLEANSE_H |