summaryrefslogtreecommitdiff
path: root/poly1305.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-04 19:28:19 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-04 19:28:19 -0400
commitd0eefdf32a5ee7ba515d468b52fc2ea92d87fb84 (patch)
treea272e0e7f02a37a4035ea723359058810dc4c537 /poly1305.cpp
parentfe0a5ee8e83ae08b97b495b8e13d551d23216d24 (diff)
downloadcryptopp-git-d0eefdf32a5ee7ba515d468b52fc2ea92d87fb84.tar.gz
Use aligned buffer for Poly1305 nonce
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 7125b102..416b462a 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(), t.size());
+ m_cipher.ProcessBlock(m_nk.begin(), 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);