diff options
author | Jack Lloyd <[email protected]> | 2016-11-10 22:06:52 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-10 22:06:52 -0500 |
commit | 618f890fd7ede74c728612ca8bc590c72ee353f1 (patch) | |
tree | 3ac9016fe603525f04c194e8be9aa6152a049c40 /src/lib/modes/aead/chacha20poly1305 | |
parent | b7ae8043e963467eb222a44f48d66a1df36d9371 (diff) | |
parent | 06b44d8ed339b3a467f10a326fd209b0b9496060 (diff) |
Merge GH #552 Add Cipher_Mode::reset, better AEAD tests
Diffstat (limited to 'src/lib/modes/aead/chacha20poly1305')
-rw-r--r-- | src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp | 7 | ||||
-rw-r--r-- | src/lib/modes/aead/chacha20poly1305/chacha20poly1305.h | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp index d2f16c225..197d6f921 100644 --- a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp +++ b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp @@ -1,6 +1,7 @@ /* * ChaCha20Poly1305 AEAD * (C) 2014,2016 Jack Lloyd +* (C) 2016 Daniel Neus, Rohde & Schwarz Cybersecurity * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -26,8 +27,14 @@ void ChaCha20Poly1305_Mode::clear() { m_chacha->clear(); m_poly1305->clear(); + reset(); + } + +void ChaCha20Poly1305_Mode::reset() + { m_ad.clear(); m_ctext_len = 0; + m_nonce_len = 0; } void ChaCha20Poly1305_Mode::key_schedule(const byte key[], size_t length) diff --git a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.h b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.h index 553508854..f58bd48ac 100644 --- a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.h +++ b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.h @@ -1,6 +1,7 @@ /* * ChaCha20Poly1305 AEAD * (C) 2014 Jack Lloyd +* (C) 2016 Daniel Neus, Rohde & Schwarz Cybersecurity * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -37,6 +38,9 @@ class BOTAN_DLL ChaCha20Poly1305_Mode : public AEAD_Mode size_t tag_size() const override { return 16; } void clear() override; + + void reset() override; + protected: std::unique_ptr<StreamCipher> m_chacha; std::unique_ptr<MessageAuthenticationCode> m_poly1305; |