diff options
author | Jack Lloyd <[email protected]> | 2015-09-10 02:42:48 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-09-10 02:42:48 -0400 |
commit | 8211fdc11fa3bbe692b50d42126f74d259a4a96a (patch) | |
tree | 4c86467f85cae8e09190d91eb1299aa45c806ee1 /src/lib/modes/aead | |
parent | d21de17f070863c7e0b7e8d254eb35689001a53a (diff) |
Same treatment for cipher modes
Diffstat (limited to 'src/lib/modes/aead')
-rw-r--r-- | src/lib/modes/aead/aead.cpp | 51 | ||||
-rw-r--r-- | src/lib/modes/aead/aead.h | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/ccm/ccm.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp | 3 | ||||
-rw-r--r-- | src/lib/modes/aead/eax/eax.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/gcm/gcm.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/ocb/ocb.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/siv/siv.cpp | 2 |
8 files changed, 53 insertions, 13 deletions
diff --git a/src/lib/modes/aead/aead.cpp b/src/lib/modes/aead/aead.cpp index 1f2099d2e..c101480b4 100644 --- a/src/lib/modes/aead/aead.cpp +++ b/src/lib/modes/aead/aead.cpp @@ -7,8 +7,59 @@ #include <botan/internal/mode_utils.h> #include <botan/aead.h> +#if defined(BOTAN_HAS_AEAD_CCM) +#include <botan/ccm.h> +#endif + +#if defined(BOTAN_HAS_AEAD_CHACHA20_POLY1305) +#include <botan/chacha20poly1305.h> +#endif + +#if defined(BOTAN_HAS_AEAD_EAX) +#include <botan/eax.h> +#endif + +#if defined(BOTAN_HAS_AEAD_GCM) +#include <botan/gcm.h> +#endif + +#if defined(BOTAN_HAS_AEAD_OCB) +#include <botan/ocb.h> +#endif + +#if defined(BOTAN_HAS_AEAD_SIV) +#include <botan/siv.h> +#endif + namespace Botan { +AEAD_Mode::~AEAD_Mode() {} + +#if defined(BOTAN_HAS_AEAD_CCM) +BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN2(CCM_Encryption, CCM_Decryption, 16, 3); +#endif + +#if defined(BOTAN_HAS_AEAD_CHACHA20_POLY1305) +BOTAN_REGISTER_TRANSFORM_NOARGS(ChaCha20Poly1305_Encryption); +BOTAN_REGISTER_TRANSFORM_NOARGS(ChaCha20Poly1305_Decryption); +#endif + +#if defined(BOTAN_HAS_AEAD_EAX) +BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(EAX_Encryption, EAX_Decryption, 0); +#endif + +#if defined(BOTAN_HAS_AEAD_GCM) +BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(GCM_Encryption, GCM_Decryption, 16); +#endif + +#if defined(BOTAN_HAS_AEAD_OCB) +BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(OCB_Encryption, OCB_Decryption, 16); +#endif + +#if defined(BOTAN_HAS_AEAD_SIV) +BOTAN_REGISTER_BLOCK_CIPHER_MODE(SIV_Encryption, SIV_Decryption); +#endif + AEAD_Mode* get_aead(const std::string& algo_spec, Cipher_Dir direction) { std::unique_ptr<Cipher_Mode> mode(get_cipher_mode(algo_spec, direction)); diff --git a/src/lib/modes/aead/aead.h b/src/lib/modes/aead/aead.h index 1fff41f97..3214187db 100644 --- a/src/lib/modes/aead/aead.h +++ b/src/lib/modes/aead/aead.h @@ -55,6 +55,8 @@ class BOTAN_DLL AEAD_Mode : public Cipher_Mode * modes, and large enough that random collisions are unlikely). */ size_t default_nonce_length() const override { return 12; } + + virtual ~AEAD_Mode(); }; /** diff --git a/src/lib/modes/aead/ccm/ccm.cpp b/src/lib/modes/aead/ccm/ccm.cpp index b40e6e62b..bd4e0f4be 100644 --- a/src/lib/modes/aead/ccm/ccm.cpp +++ b/src/lib/modes/aead/ccm/ccm.cpp @@ -11,8 +11,6 @@ namespace Botan { -BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN2(CCM_Encryption, CCM_Decryption, 16, 3); - /* * CCM_Mode Constructor */ diff --git a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp index 3dc9d7f6d..329e2e713 100644 --- a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp +++ b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp @@ -10,9 +10,6 @@ namespace Botan { -BOTAN_REGISTER_TRANSFORM_NOARGS(ChaCha20Poly1305_Encryption); -BOTAN_REGISTER_TRANSFORM_NOARGS(ChaCha20Poly1305_Decryption); - ChaCha20Poly1305_Mode::ChaCha20Poly1305_Mode() : m_chacha(make_stream_cipher("ChaCha")), m_poly1305(make_message_auth("Poly1305")) diff --git a/src/lib/modes/aead/eax/eax.cpp b/src/lib/modes/aead/eax/eax.cpp index 22e772d75..4b928cd31 100644 --- a/src/lib/modes/aead/eax/eax.cpp +++ b/src/lib/modes/aead/eax/eax.cpp @@ -13,8 +13,6 @@ namespace Botan { -BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(EAX_Encryption, EAX_Decryption, 0); - namespace { /* diff --git a/src/lib/modes/aead/gcm/gcm.cpp b/src/lib/modes/aead/gcm/gcm.cpp index 130ff6aad..7dcdd0d31 100644 --- a/src/lib/modes/aead/gcm/gcm.cpp +++ b/src/lib/modes/aead/gcm/gcm.cpp @@ -16,8 +16,6 @@ namespace Botan { -BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(GCM_Encryption, GCM_Decryption, 16); - void GHASH::gcm_multiply(secure_vector<byte>& x) const { #if defined(BOTAN_HAS_GCM_CLMUL) diff --git a/src/lib/modes/aead/ocb/ocb.cpp b/src/lib/modes/aead/ocb/ocb.cpp index ee5583bea..ff3317dd9 100644 --- a/src/lib/modes/aead/ocb/ocb.cpp +++ b/src/lib/modes/aead/ocb/ocb.cpp @@ -11,8 +11,6 @@ namespace Botan { -BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN(OCB_Encryption, OCB_Decryption, 16); - // Has to be in Botan namespace so unique_ptr can reference it class L_computer { diff --git a/src/lib/modes/aead/siv/siv.cpp b/src/lib/modes/aead/siv/siv.cpp index 5b22216cf..a4cb65a94 100644 --- a/src/lib/modes/aead/siv/siv.cpp +++ b/src/lib/modes/aead/siv/siv.cpp @@ -13,8 +13,6 @@ namespace Botan { -BOTAN_REGISTER_BLOCK_CIPHER_MODE(SIV_Encryption, SIV_Decryption); - SIV_Mode::SIV_Mode(BlockCipher* cipher) : m_name(cipher->name() + "/SIV"), m_ctr(new CTR_BE(cipher->clone())), |