aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp
index 38c2c2813..0961f1dc8 100644
--- a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp
+++ b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp
@@ -69,8 +69,8 @@ secure_vector<byte> ChaCha20Poly1305_Mode::start_raw(const byte nonce[], size_t
if(cfrg_version())
{
- for(size_t i = 0; i != 16 - m_ad.size() % 16; ++i)
- m_poly1305->update(0);
+ std::vector<byte> padding(16 - m_ad.size() % 16);
+ m_poly1305->update(padding);
}
else
{
@@ -96,8 +96,8 @@ void ChaCha20Poly1305_Encryption::finish(secure_vector<byte>& buffer, size_t off
update(buffer, offset);
if(cfrg_version())
{
- for(size_t i = 0; i != 16 - m_ctext_len % 16; ++i)
- m_poly1305->update(0);
+ std::vector<byte> padding(16 - m_ctext_len % 16);
+ m_poly1305->update(padding);
update_len(m_ad.size());
}
update_len(m_ctext_len);