From 432d31546eb335bb96c6b2a8c58f0168266387ec Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 17 Nov 2018 14:54:21 -0500 Subject: Avoid calling memset, memcpy within library code Prefer using wrappers in mem_utils for this. Current exception is where memcpy is being used to convert between two different types, since copy_mem requires input and output pointers have the same type. There should be a new function to handle conversion-via-memcpy operation. --- src/lib/hash/streebog/streebog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib/hash') diff --git a/src/lib/hash/streebog/streebog.cpp b/src/lib/hash/streebog/streebog.cpp index cd67256cb..8bb56ccc9 100644 --- a/src/lib/hash/streebog/streebog.cpp +++ b/src/lib/hash/streebog/streebog.cpp @@ -35,9 +35,10 @@ static inline void addm(const uint8_t* m, uint64_t* h) } } -inline void lps(uint64_t* block) +inline void lps(uint64_t block[8]) { uint8_t r[64]; + // FIXME std::memcpy(r, block, 64); for(int i = 0; i < 8; ++i) @@ -171,6 +172,7 @@ void Streebog::final_result(uint8_t output[]) compress(m_buffer.data(), true); compress(reinterpret_cast(m_S.data()), true); + // FIXME std::memcpy(output, &m_h[8 - output_length() / 8], output_length()); clear(); } -- cgit v1.2.3