aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/mac
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-07-19 16:33:38 +0200
committerDaniel Neus <[email protected]>2016-07-20 14:21:04 +0200
commitb7005fdc0094cd77d83e982b2d9c586303a09b80 (patch)
tree6dc82baef1070ba0271c40665315e0d511260be9 /src/lib/mac
parent308c7d5eda678566edd26e9ab20edbe772f46363 (diff)
fix SipHash::clear() and MAC test improvements
Fix for SipHash::clear() which does not clear the complete state. Test additions: - add a test for MessageAuthenticationCode::verify_mac() - test MessageAuthenticationCode::clear()
Diffstat (limited to 'src/lib/mac')
-rw-r--r--src/lib/mac/siphash/siphash.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/mac/siphash/siphash.cpp b/src/lib/mac/siphash/siphash.cpp
index 4a9ffe8ea..cb72f771c 100644
--- a/src/lib/mac/siphash/siphash.cpp
+++ b/src/lib/mac/siphash/siphash.cpp
@@ -85,9 +85,7 @@ void SipHash::final_result(byte mac[])
store_le(X, mac);
- m_mbuf = 0;
- m_mbuf_pos = 0;
- m_words = 0;
+ clear();
}
void SipHash::key_schedule(const byte key[], size_t)
@@ -105,6 +103,9 @@ void SipHash::key_schedule(const byte key[], size_t)
void SipHash::clear()
{
m_V.clear();
+ m_mbuf = 0;
+ m_mbuf_pos = 0;
+ m_words = 0;
}
std::string SipHash::name() const