diff options
Diffstat (limited to 'src/lib/modes')
-rw-r--r-- | src/lib/modes/aead/eax/eax.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/modes/aead/eax/eax.cpp b/src/lib/modes/aead/eax/eax.cpp index dbd916db9..a03c5e802 100644 --- a/src/lib/modes/aead/eax/eax.cpp +++ b/src/lib/modes/aead/eax/eax.cpp @@ -57,6 +57,12 @@ void EAX_Mode::reset() { m_ad_mac.clear(); m_nonce_mac.clear(); + + // Clear out any data added to the CMAC calculation + try { + m_cmac->final(); + } + catch(Key_Not_Set&) {} } std::string EAX_Mode::name() const @@ -115,6 +121,7 @@ void EAX_Mode::start_msg(const uint8_t nonce[], size_t nonce_len) size_t EAX_Encryption::process(uint8_t buf[], size_t sz) { + BOTAN_ASSERT_NOMSG(m_nonce_mac.empty() == false); m_ctr->cipher(buf, buf, sz); m_cmac->update(buf, sz); return sz; @@ -122,6 +129,7 @@ size_t EAX_Encryption::process(uint8_t buf[], size_t sz) void EAX_Encryption::finish(secure_vector<uint8_t>& buffer, size_t offset) { + BOTAN_ASSERT_NOMSG(m_nonce_mac.empty() == false); update(buffer, offset); secure_vector<uint8_t> data_mac = m_cmac->final(); |