diff options
author | Jack Lloyd <[email protected]> | 2017-08-31 07:13:58 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-08-31 07:13:58 -0400 |
commit | df4287c3c763de14b262ed39d54b3de552adbefb (patch) | |
tree | 10b839bab8d2e36a806951bb2e5e5f0212f7a0f9 /src/lib/hash/streebog | |
parent | 17ef09021892afc4c0e9fe7ba97423bf832e6dc5 (diff) |
Fix various MSVC warnings
Based on VC2017 output
Diffstat (limited to 'src/lib/hash/streebog')
-rw-r--r-- | src/lib/hash/streebog/streebog.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/hash/streebog/streebog.cpp b/src/lib/hash/streebog/streebog.cpp index c58320bca..ae2fe1fef 100644 --- a/src/lib/hash/streebog/streebog.cpp +++ b/src/lib/hash/streebog/streebog.cpp @@ -115,12 +115,10 @@ void Streebog::clear() m_count = 0; m_position = 0; zeroise(m_buffer); - if(m_output_bits == 256) - { std::fill(m_h.begin(), m_h.end(), 0x0101010101010101ULL); } - else - { std::fill(m_h.begin(), m_h.end(), 0x0ULL); } - zeroise(m_S); + + const uint64_t fill = (m_output_bits == 512) ? 0 : 0x0101010101010101; + std::fill(m_h.begin(), m_h.end(), fill); } /* @@ -148,7 +146,9 @@ void Streebog::add_data(const uint8_t input[], size_t length) void Streebog::final_result(uint8_t output[]) { m_buffer[m_position++] = 0x01; - std::fill(m_buffer.begin() + m_position, m_buffer.end(), 0x00); + + if(m_position != m_buffer.size()) + clear_mem(&m_buffer[m_position], m_buffer.size() - m_position); compress(m_buffer.data()); m_count += (m_position - 1) * 8; |