diff options
author | lloyd <[email protected]> | 2013-08-25 16:46:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-08-25 16:46:08 +0000 |
commit | faa228db16fa6dad5856a861dc57f91bf92d80a7 (patch) | |
tree | b08bd32c55d489205c754ff8137f9e833c1cf12a /src/modes | |
parent | 958f0101fdfd69deeedb1350c0cc410a76c90cd5 (diff) | |
parent | 6ea24778e8e676a10d195c82b29c0474a9928ba5 (diff) |
merge of '59ddcb9c6e450b61f95165721510c583d6a9cde3'
and 'ec9ea0e8135ae0f0835c01c558a32db94e950535'
Diffstat (limited to 'src/modes')
-rw-r--r-- | src/modes/aead/aead.h | 5 | ||||
-rw-r--r-- | src/modes/aead/eax/eax.h | 4 | ||||
-rw-r--r-- | src/modes/aead/gcm/gcm.h | 4 | ||||
-rw-r--r-- | src/modes/aead/ocb/ocb.h | 4 |
4 files changed, 11 insertions, 6 deletions
diff --git a/src/modes/aead/aead.h b/src/modes/aead/aead.h index 25958a36a..d03cb295d 100644 --- a/src/modes/aead/aead.h +++ b/src/modes/aead/aead.h @@ -49,6 +49,11 @@ class BOTAN_DLL AEAD_Mode : public Cipher_Mode * modes, and large enough that random collisions are unlikely). */ size_t default_nonce_size() const override { return 12; } + + /** + * Return the size of the authentication tag used (in bytes) + */ + virtual size_t tag_size() const = 0; }; /** diff --git a/src/modes/aead/eax/eax.h b/src/modes/aead/eax/eax.h index 6815e3ce0..a4673a34f 100644 --- a/src/modes/aead/eax/eax.h +++ b/src/modes/aead/eax/eax.h @@ -35,6 +35,8 @@ class BOTAN_DLL EAX_Mode : public AEAD_Mode // EAX supports arbitrary nonce lengths bool valid_nonce_length(size_t) const override { return true; } + size_t tag_size() const { return m_tag_size; } + void clear(); protected: void key_schedule(const byte key[], size_t length) override; @@ -45,8 +47,6 @@ class BOTAN_DLL EAX_Mode : public AEAD_Mode */ EAX_Mode(BlockCipher* cipher, size_t tag_size); - size_t tag_size() const { return m_tag_size; } - size_t block_size() const { return m_cipher->block_size(); } size_t m_tag_size; diff --git a/src/modes/aead/gcm/gcm.h b/src/modes/aead/gcm/gcm.h index e1479c27f..e0789f960 100644 --- a/src/modes/aead/gcm/gcm.h +++ b/src/modes/aead/gcm/gcm.h @@ -34,14 +34,14 @@ class BOTAN_DLL GCM_Mode : public AEAD_Mode // GCM supports arbitrary nonce lengths bool valid_nonce_length(size_t) const override { return true; } + size_t tag_size() const { return m_tag_size; } + void clear(); protected: void key_schedule(const byte key[], size_t length) override; GCM_Mode(BlockCipher* cipher, size_t tag_size); - size_t tag_size() const { return m_tag_size; } - static const size_t BS = 16; const size_t m_tag_size; diff --git a/src/modes/aead/ocb/ocb.h b/src/modes/aead/ocb/ocb.h index ea7729348..c61983f44 100644 --- a/src/modes/aead/ocb/ocb.h +++ b/src/modes/aead/ocb/ocb.h @@ -42,6 +42,8 @@ class BOTAN_DLL OCB_Mode : public AEAD_Mode bool valid_nonce_length(size_t) const override; + size_t tag_size() const { return m_tag_size; } + void clear(); ~OCB_Mode(); @@ -56,8 +58,6 @@ class BOTAN_DLL OCB_Mode : public AEAD_Mode void key_schedule(const byte key[], size_t length) override; - size_t tag_size() const { return m_tag_size; } - // fixme make these private std::unique_ptr<BlockCipher> m_cipher; std::unique_ptr<L_computer> m_L; |