diff options
author | Jack Lloyd <[email protected]> | 2018-08-17 17:33:25 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-17 17:33:25 -0400 |
commit | a2bcf08c6e18216bfded012fe8d35d91f4396e62 (patch) | |
tree | b7c6aeb48c6c88e3a2cd46a291295b40f052291e /src/lib/modes/aead/ocb | |
parent | a86d2dea373053a045e6dd97a40b92b8607be0de (diff) |
In EAX, CCM, OCB verify nonce is set before processing
Diffstat (limited to 'src/lib/modes/aead/ocb')
-rw-r--r-- | src/lib/modes/aead/ocb/ocb.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/modes/aead/ocb/ocb.cpp b/src/lib/modes/aead/ocb/ocb.cpp index 35366260d..cfc805e72 100644 --- a/src/lib/modes/aead/ocb/ocb.cpp +++ b/src/lib/modes/aead/ocb/ocb.cpp @@ -37,6 +37,8 @@ class L_computer final m_offset = offset; } + bool initialized() const { return m_offset.empty() == false; } + const secure_vector<uint8_t>& star() const { return m_L_star; } const secure_vector<uint8_t>& dollar() const { return m_L_dollar; } const secure_vector<uint8_t>& offset() const { return m_offset; } @@ -341,6 +343,7 @@ void OCB_Mode::start_msg(const uint8_t nonce[], size_t nonce_len) void OCB_Encryption::encrypt(uint8_t buffer[], size_t blocks) { verify_key_set(m_L != nullptr); + BOTAN_STATE_CHECK(m_L->initialized()); const size_t BS = block_size(); @@ -430,6 +433,7 @@ void OCB_Encryption::finish(secure_vector<uint8_t>& buffer, size_t offset) void OCB_Decryption::decrypt(uint8_t buffer[], size_t blocks) { verify_key_set(m_L != nullptr); + BOTAN_STATE_CHECK(m_L->initialized()); const size_t BS = block_size(); |