summaryrefslogtreecommitdiff
path: root/poly1305.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-05 16:43:29 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-05 16:43:29 -0400
commit09023bf45e5bb32ac31c5ddce0105a4e0afe3b83 (patch)
treefcf5e5a20b7a5c2b486188118e044abb11f4c478 /poly1305.cpp
parent37e02f9e0e2ee627f0f95b7bc0a09f4ba1ce562e (diff)
downloadcryptopp-git-09023bf45e5bb32ac31c5ddce0105a4e0afe3b83.tar.gz
Align buffers for Poly1305 and VMAC
Diffstat (limited to 'poly1305.cpp')
-rw-r--r--poly1305.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/poly1305.cpp b/poly1305.cpp
index 9bef7585..6f778677 100644
--- a/poly1305.cpp
+++ b/poly1305.cpp
@@ -34,7 +34,9 @@ void Poly1305_Base<T>::UncheckedSetKey(const byte *key, unsigned int length, con
if (params.GetValue(Name::IV(), t) && t.begin() && t.size())
{
// Nonce key is a class member to avoid the zeroizer on a temporary
- m_cipher.ProcessBlock(t.begin(), m_nk.begin());
+ CRYPTOPP_ASSERT(t.size() == m_nk.size());
+ std::memcpy(m_nk.begin(), t.begin(), m_nk.size());
+ m_cipher.ProcessBlock(m_nk.begin());
m_n[0] = GetWord<word32>(false, LITTLE_ENDIAN_ORDER, m_nk + 0);
m_n[1] = GetWord<word32>(false, LITTLE_ENDIAN_ORDER, m_nk + 4);