aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-11-17 14:54:21 -0500
committerJack Lloyd <[email protected]>2018-11-17 22:50:26 -0500
commit432d31546eb335bb96c6b2a8c58f0168266387ec (patch)
tree2397468c243906a08eea08b9376a9922346e6856 /src/lib/hash
parent6b3a827fb493ad884c7443092ba8f9967636b3c8 (diff)
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.
Diffstat (limited to 'src/lib/hash')
-rw-r--r--src/lib/hash/streebog/streebog.cpp4
1 files changed, 3 insertions, 1 deletions
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<const uint8_t*>(m_S.data()), true);
+ // FIXME
std::memcpy(output, &m_h[8 - output_length() / 8], output_length());
clear();
}