diff options
-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; |