aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanabodee Charoenpiriyakij <wingyminus@gmail.com>2016-10-16 02:42:02 +0800
committerThanabodee Charoenpiriyakij <wingyminus@gmail.com>2016-10-16 02:42:02 +0800
commitc86d58b2e97fd7d5cd791dfb1596205947e2a89f (patch)
treed6c94d294fe141ad97755d80e3f75d16fad346bb
parentcc2a6867a7986b04c3f8013f508df77eab738d19 (diff)
downloaddexon-solidity-c86d58b2e97fd7d5cd791dfb1596205947e2a89f.tar.gz
dexon-solidity-c86d58b2e97fd7d5cd791dfb1596205947e2a89f.tar.zst
dexon-solidity-c86d58b2e97fd7d5cd791dfb1596205947e2a89f.zip
Removed 'vector_ref::cleanse'
Close #785
-rw-r--r--libdevcore/vector_ref.h20
1 files changed, 0 insertions, 20 deletions
diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h
index 698377c9..0f543181 100644
--- a/libdevcore/vector_ref.h
+++ b/libdevcore/vector_ref.h
@@ -69,26 +69,6 @@ public:
void copyTo(vector_ref<typename std::remove_const<_T>::type> _t) const { if (overlapsWith(_t)) memmove(_t.data(), m_data, std::min(_t.size(), m_count) * sizeof(_T)); else memcpy(_t.data(), m_data, std::min(_t.size(), m_count) * sizeof(_T)); }
/// Copies the contents of this vector_ref to the contents of @a _t, and zeros further trailing elements in @a _t.
void populate(vector_ref<typename std::remove_const<_T>::type> _t) const { copyTo(_t); memset(_t.data() + m_count, 0, std::max(_t.size(), m_count) - m_count); }
- /// Securely overwrite the memory.
- /// @note adapted from OpenSSL's implementation.
- void cleanse()
- {
- static unsigned char s_cleanseCounter = 0;
- uint8_t* p = (uint8_t*)begin();
- size_t const len = (uint8_t*)end() - p;
- size_t loop = len;
- size_t count = s_cleanseCounter;
- while (loop--)
- {
- *(p++) = (uint8_t)count;
- count += (17 + ((size_t)p & 0xf));
- }
- p = (uint8_t*)memchr((uint8_t*)begin(), (uint8_t)count, len);
- if (p)
- count += (63 + (size_t)p);
- s_cleanseCounter = (uint8_t)count;
- memset((uint8_t*)begin(), 0, len);
- }
_T* begin() { return m_data; }
_T* end() { return m_data + m_count; }