diff options
author | Yoichi Hirai <yhirai@pira.jp> | 2016-10-18 03:11:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-18 03:11:19 +0800 |
commit | f9733909786f7f6549014048025e1c98eece389c (patch) | |
tree | 6e0685c86497fefec4428df93cb8e9db93f9bebf | |
parent | 07d32937fd1aa0860611ce1307f08439317de449 (diff) | |
parent | c86d58b2e97fd7d5cd791dfb1596205947e2a89f (diff) | |
download | dexon-solidity-f9733909786f7f6549014048025e1c98eece389c.tar dexon-solidity-f9733909786f7f6549014048025e1c98eece389c.tar.gz dexon-solidity-f9733909786f7f6549014048025e1c98eece389c.tar.bz2 dexon-solidity-f9733909786f7f6549014048025e1c98eece389c.tar.lz dexon-solidity-f9733909786f7f6549014048025e1c98eece389c.tar.xz dexon-solidity-f9733909786f7f6549014048025e1c98eece389c.tar.zst dexon-solidity-f9733909786f7f6549014048025e1c98eece389c.zip |
Merge pull request #1234 from wingyplus/remove_vector_ref_cleanse
Removed 'vector_ref::cleanse'
-rw-r--r-- | libdevcore/vector_ref.h | 20 |
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; } |