diff options
Diffstat (limited to 'contrib/epee/src')
-rw-r--r-- | contrib/epee/src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | contrib/epee/src/connection_basic.cpp | 2 | ||||
-rw-r--r-- | contrib/epee/src/hex.cpp | 2 | ||||
-rw-r--r-- | contrib/epee/src/http_auth.cpp | 2 | ||||
-rw-r--r-- | contrib/epee/src/memwipe.c | 9 | ||||
-rw-r--r-- | contrib/epee/src/network_throttle-detail.cpp | 2 | ||||
-rw-r--r-- | contrib/epee/src/network_throttle.cpp | 2 | ||||
-rw-r--r-- | contrib/epee/src/readline_buffer.cpp | 1 | ||||
-rw-r--r-- | contrib/epee/src/wipeable_string.cpp | 18 |
9 files changed, 21 insertions, 19 deletions
diff --git a/contrib/epee/src/CMakeLists.txt b/contrib/epee/src/CMakeLists.txt index 538c7ce91..c4750cea0 100644 --- a/contrib/epee/src/CMakeLists.txt +++ b/contrib/epee/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2017, The Monero Project +# Copyright (c) 2014-2018, The Monero Project # # All rights reserved. # diff --git a/contrib/epee/src/connection_basic.cpp b/contrib/epee/src/connection_basic.cpp index 5848d1268..dea1928a7 100644 --- a/contrib/epee/src/connection_basic.cpp +++ b/contrib/epee/src/connection_basic.cpp @@ -2,7 +2,7 @@ /// @author rfree (current maintainer in monero.cc project) /// @brief base for connection, contains e.g. the ratelimit hooks -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/contrib/epee/src/hex.cpp b/contrib/epee/src/hex.cpp index cfbd3cf87..c143b2dc2 100644 --- a/contrib/epee/src/hex.cpp +++ b/contrib/epee/src/hex.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017, The Monero Project +// Copyright (c) 2017-2018, The Monero Project // // All rights reserved. // diff --git a/contrib/epee/src/http_auth.cpp b/contrib/epee/src/http_auth.cpp index 5b8d892ff..dc968d971 100644 --- a/contrib/epee/src/http_auth.cpp +++ b/contrib/epee/src/http_auth.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/contrib/epee/src/memwipe.c b/contrib/epee/src/memwipe.c index da7e9f346..e3a2f76c8 100644 --- a/contrib/epee/src/memwipe.c +++ b/contrib/epee/src/memwipe.c @@ -1,4 +1,4 @@ -// Copyright (c) 2017, The Monero Project +// Copyright (c) 2017-2018, The Monero Project // // All rights reserved. // @@ -31,6 +31,8 @@ #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> #include <stdlib.h> +#include <stdio.h> +#include <unistd.h> #ifdef HAVE_EXPLICIT_BZERO #include <strings.h> #endif @@ -50,7 +52,12 @@ void *memwipe(void *ptr, size_t n) { if (memset_s(ptr, n, 0, n)) { +#ifdef NDEBUG + fprintf(stderr, "Error: memset_s failed\n"); + _exit(1); +#else abort(); +#endif } SCARECROW // might as well... return ptr; diff --git a/contrib/epee/src/network_throttle-detail.cpp b/contrib/epee/src/network_throttle-detail.cpp index ed6bc07ed..7eeade3a1 100644 --- a/contrib/epee/src/network_throttle-detail.cpp +++ b/contrib/epee/src/network_throttle-detail.cpp @@ -2,7 +2,7 @@ /// @author rfree (current maintainer in monero.cc project) /// @brief implementaion for throttling of connection (count and rate-limit speed etc) -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/contrib/epee/src/network_throttle.cpp b/contrib/epee/src/network_throttle.cpp index dd1640a2e..167738855 100644 --- a/contrib/epee/src/network_throttle.cpp +++ b/contrib/epee/src/network_throttle.cpp @@ -26,7 +26,7 @@ Throttling work by: */ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp index 00c2ddd62..076a63612 100644 --- a/contrib/epee/src/readline_buffer.cpp +++ b/contrib/epee/src/readline_buffer.cpp @@ -1,7 +1,6 @@ #include "readline_buffer.h" #include <readline/readline.h> #include <readline/history.h> -#include <sys/select.h> #include <unistd.h> #include <iostream> #include <boost/thread.hpp> diff --git a/contrib/epee/src/wipeable_string.cpp b/contrib/epee/src/wipeable_string.cpp index 08a975e58..cc43b8988 100644 --- a/contrib/epee/src/wipeable_string.cpp +++ b/contrib/epee/src/wipeable_string.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017, The Monero Project +// Copyright (c) 2017-2018, The Monero Project // // All rights reserved. // @@ -27,14 +27,13 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <string.h> +#include "memwipe.h" #include "misc_log_ex.h" #include "wipeable_string.h" namespace epee { -void *(*wipeable_string::wipefunc)(void*, size_t) = NULL; - wipeable_string::wipeable_string(const wipeable_string &other): buffer(other.buffer) { @@ -55,12 +54,11 @@ wipeable_string::wipeable_string(const std::string &other) wipeable_string::wipeable_string(std::string &&other) { - CHECK_AND_ASSERT_THROW_MES(wipefunc, "wipefunc is not set"); grow(other.size()); memcpy(buffer.data(), other.c_str(), size()); if (!other.empty()) { - wipefunc(&other[0], other.size()); // we're kinda left with this again aren't we + memwipe(&other[0], other.size()); // we're kinda left with this again aren't we other = std::string(); } } @@ -78,30 +76,28 @@ wipeable_string::~wipeable_string() void wipeable_string::wipe() { - CHECK_AND_ASSERT_THROW_MES(wipefunc, "wipefunc is not set"); - wipefunc(buffer.data(), buffer.size() * sizeof(char)); + memwipe(buffer.data(), buffer.size() * sizeof(char)); } void wipeable_string::grow(size_t sz, size_t reserved) { - CHECK_AND_ASSERT_THROW_MES(wipefunc, "wipefunc is not set"); if (reserved < sz) reserved = sz; if (reserved <= buffer.capacity()) { if (sz < buffer.size()) - wipefunc(buffer.data() + sz, buffer.size() - sz); + memwipe(buffer.data() + sz, buffer.size() - sz); buffer.resize(sz); return; } size_t old_sz = buffer.size(); std::unique_ptr<char[]> tmp{new char[old_sz]}; memcpy(tmp.get(), buffer.data(), old_sz * sizeof(char)); - wipefunc(buffer.data(), old_sz * sizeof(char)); + memwipe(buffer.data(), old_sz * sizeof(char)); buffer.reserve(reserved); buffer.resize(sz); memcpy(buffer.data(), tmp.get(), old_sz * sizeof(char)); - wipefunc(tmp.get(), old_sz * sizeof(char)); + memwipe(tmp.get(), old_sz * sizeof(char)); } void wipeable_string::push_back(char c) |