diff options
author | lloyd <[email protected]> | 2013-12-31 18:31:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-12-31 18:31:55 +0000 |
commit | 4e665d0ba321ff91173e0516392c59a70c710157 (patch) | |
tree | fa2b5fc4b814a8958390282c245600193f6624d7 | |
parent | 24bfc2734b25c0df447413f6cee187745ff90079 (diff) |
Have default EAX tag size match block size
-rw-r--r-- | src/modes/aead/eax/eax.cpp | 4 | ||||
-rw-r--r-- | src/modes/aead/eax/eax.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/modes/aead/eax/eax.cpp b/src/modes/aead/eax/eax.cpp index c6aaa9e85..249bf5f7e 100644 --- a/src/modes/aead/eax/eax.cpp +++ b/src/modes/aead/eax/eax.cpp @@ -36,12 +36,12 @@ secure_vector<byte> eax_prf(byte tag, size_t block_size, * EAX_Mode Constructor */ EAX_Mode::EAX_Mode(BlockCipher* cipher, size_t tag_size) : - m_tag_size(tag_size), + m_tag_size(tag_size ? tag_size : cipher->block_size()), m_cipher(cipher), m_ctr(new CTR_BE(m_cipher->clone())), m_cmac(new CMAC(m_cipher->clone())) { - if(tag_size < 8 || tag_size > m_cmac->output_length()) + if(m_tag_size < 8 || m_tag_size > m_cmac->output_length()) throw Invalid_Argument(name() + ": Bad tag size " + std::to_string(tag_size)); } diff --git a/src/modes/aead/eax/eax.h b/src/modes/aead/eax/eax.h index b6f1653bb..224fb5298 100644 --- a/src/modes/aead/eax/eax.h +++ b/src/modes/aead/eax/eax.h @@ -70,7 +70,7 @@ class BOTAN_DLL EAX_Encryption : public EAX_Mode * @param cipher a 128-bit block cipher * @param tag_size is how big the auth tag will be */ - EAX_Encryption(BlockCipher* cipher, size_t tag_size = 16) : + EAX_Encryption(BlockCipher* cipher, size_t tag_size = 0) : EAX_Mode(cipher, tag_size) {} size_t output_length(size_t input_length) const override @@ -93,7 +93,7 @@ class BOTAN_DLL EAX_Decryption : public EAX_Mode * @param cipher a 128-bit block cipher * @param tag_size is how big the auth tag will be */ - EAX_Decryption(BlockCipher* cipher, size_t tag_size = 16) : + EAX_Decryption(BlockCipher* cipher, size_t tag_size = 0) : EAX_Mode(cipher, tag_size) {} size_t output_length(size_t input_length) const override |