diff options
author | Jack Lloyd <[email protected]> | 2017-11-02 13:47:26 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-11-02 13:47:26 -0400 |
commit | d9a456e0b0fe2c3a3f8197f2a3daf7325495010f (patch) | |
tree | a34d249299f2f77d36184f85eab733cf95bfb028 /src/lib/modes | |
parent | c9f3da32344479d43c221d035d14ecdd45f6b320 (diff) |
Minor SIV/CMAC optimizations
Diffstat (limited to 'src/lib/modes')
-rw-r--r-- | src/lib/modes/aead/siv/siv.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/modes/aead/siv/siv.cpp b/src/lib/modes/aead/siv/siv.cpp index df9a0ef37..3a960e0af 100644 --- a/src/lib/modes/aead/siv/siv.cpp +++ b/src/lib/modes/aead/siv/siv.cpp @@ -16,7 +16,7 @@ namespace Botan { SIV_Mode::SIV_Mode(BlockCipher* cipher) : m_name(cipher->name() + "/SIV"), - m_ctr(new CTR_BE(cipher->clone())), + m_ctr(new CTR_BE(cipher->clone(), 8)), m_mac(new CMAC(cipher)), m_bs(cipher->block_size()) { @@ -173,8 +173,11 @@ void SIV_Decryption::finish(secure_vector<uint8_t>& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); - buffer.insert(buffer.begin() + offset, msg_buf().begin(), msg_buf().end()); - msg_buf().clear(); + if(msg_buf().size() > 0) + { + buffer.insert(buffer.begin() + offset, msg_buf().begin(), msg_buf().end()); + msg_buf().clear(); + } const size_t sz = buffer.size() - offset; |