diff options
author | Jack Lloyd <[email protected]> | 2021-04-17 09:49:56 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2021-04-17 09:49:56 -0400 |
commit | 8fe0f5ba9dfa82db6768666cac559ef7994434c6 (patch) | |
tree | da29fa88a7e3590873d9d059a8e7f9c4ee60f91a | |
parent | 04fc4b81f0ef44bcfe3a64ffd45bb61f0a92b60d (diff) | |
parent | edffe8aecfb1bad9831cbde971bec6ddf6a32e94 (diff) |
Merge GH #2713 Remove MDx_HashFunction::write_count
-rw-r--r-- | src/lib/hash/mdx_hash/mdx_hash.cpp | 20 | ||||
-rw-r--r-- | src/lib/hash/mdx_hash/mdx_hash.h | 6 |
2 files changed, 6 insertions, 20 deletions
diff --git a/src/lib/hash/mdx_hash/mdx_hash.cpp b/src/lib/hash/mdx_hash/mdx_hash.cpp index 092cfffe1..e1122d15c 100644 --- a/src/lib/hash/mdx_hash/mdx_hash.cpp +++ b/src/lib/hash/mdx_hash/mdx_hash.cpp @@ -95,27 +95,19 @@ void MDx_HashFunction::final_result(uint8_t output[]) zeroise(m_buffer); } - write_count(&m_buffer[block_len - m_counter_size]); - - compress_n(m_buffer.data(), 1); - copy_out(output); - clear(); - } - -/* -* Write the count bits to the buffer -*/ -void MDx_HashFunction::write_count(uint8_t out[]) - { BOTAN_ASSERT_NOMSG(m_counter_size <= output_length()); BOTAN_ASSERT_NOMSG(m_counter_size >= 8); const uint64_t bit_count = m_count * 8; if(m_count_big_endian) - store_be(bit_count, out + m_counter_size - 8); + store_be(bit_count, &m_buffer[block_len - 8]); else - store_le(bit_count, out + m_counter_size - 8); + store_le(bit_count, &m_buffer[block_len - 8]); + + compress_n(m_buffer.data(), 1); + copy_out(output); + clear(); } } diff --git a/src/lib/hash/mdx_hash/mdx_hash.h b/src/lib/hash/mdx_hash/mdx_hash.h index fa1f89e75..aceafdd04 100644 --- a/src/lib/hash/mdx_hash/mdx_hash.h +++ b/src/lib/hash/mdx_hash/mdx_hash.h @@ -49,12 +49,6 @@ class MDx_HashFunction : public HashFunction * @param buffer to put the output into */ virtual void copy_out(uint8_t buffer[]) = 0; - - /** - * Write the count, if used, to this spot - * @param out where to write the counter to - */ - virtual void write_count(uint8_t out[]); private: const uint8_t m_pad_char; const uint8_t m_counter_size; |