diff options
-rw-r--r-- | checks/ocb.cpp | 3 | ||||
-rw-r--r-- | src/algo_base/transform.h | 2 | ||||
-rw-r--r-- | src/filters/transform_filter.cpp | 3 | ||||
-rw-r--r-- | src/modes/aead/aead.h | 8 | ||||
-rw-r--r-- | src/modes/cbc/cbc.h | 4 | ||||
-rw-r--r-- | src/modes/cfb/cfb.h | 4 | ||||
-rw-r--r-- | src/modes/cipher_mode.h | 30 | ||||
-rw-r--r-- | src/modes/ecb/ecb.h | 6 | ||||
-rw-r--r-- | src/modes/xts/xts.h | 4 | ||||
-rw-r--r-- | src/tls/tls_policy.h | 2 |
10 files changed, 51 insertions, 15 deletions
diff --git a/checks/ocb.cpp b/checks/ocb.cpp index abd84df7a..d9a76236e 100644 --- a/checks/ocb.cpp +++ b/checks/ocb.cpp @@ -2,6 +2,7 @@ #include "validate.h" #include <botan/ocb.h> +#include <botan/cbc.h> #include <botan/hex.h> #include <botan/sha2_32.h> #include <botan/aes.h> @@ -18,6 +19,8 @@ std::vector<byte> ocb_encrypt(const SymmetricKey& key, { //std::unique_ptr<AEAD_Mode> ocb = get_aead("AES-128/OCB", ENCRYPTION); + CBC_Encryption cbc(new AES_128, nullptr); + OCB_Encryption ocb(new AES_128); ocb.set_key(key); diff --git a/src/algo_base/transform.h b/src/algo_base/transform.h index 672b39ed0..8c5dd82ed 100644 --- a/src/algo_base/transform.h +++ b/src/algo_base/transform.h @@ -15,7 +15,7 @@ namespace Botan { /** * Interface for general transformations on data */ -class Transformation : public SymmetricAlgorithm +class BOTAN_DLL Transformation : public SymmetricAlgorithm { public: /** diff --git a/src/filters/transform_filter.cpp b/src/filters/transform_filter.cpp index c6a52a257..20fbec72a 100644 --- a/src/filters/transform_filter.cpp +++ b/src/filters/transform_filter.cpp @@ -21,7 +21,8 @@ Transformation_Filter::Transformation_Filter(Transformation* transform) : std::string Transformation_Filter::name() const { - return m_transform->name(); + return ""; + //return m_transform->name(); } void Transformation_Filter::Nonce_State::update(const InitializationVector& iv) diff --git a/src/modes/aead/aead.h b/src/modes/aead/aead.h index 97f156d60..25958a36a 100644 --- a/src/modes/aead/aead.h +++ b/src/modes/aead/aead.h @@ -8,7 +8,7 @@ #ifndef BOTAN_AEAD_MODE_H__ #define BOTAN_AEAD_MODE_H__ -#include <botan/transform.h> +#include <botan/cipher_mode.h> namespace Botan { @@ -19,9 +19,11 @@ namespace Botan { * which is not included in the ciphertext (for instance a sequence * number). */ -class AEAD_Mode : public Transformation +class BOTAN_DLL AEAD_Mode : public Cipher_Mode { public: + bool authenticated() const override { return true; } + /** * Set associated data that is not included in the ciphertext but * that should be authenticated. Must be called after set_key @@ -44,7 +46,7 @@ class AEAD_Mode : public Transformation /** * Default AEAD nonce size (a commonly supported value among AEAD - * modes, and, large enough that random collisions are unlikely). + * modes, and large enough that random collisions are unlikely). */ size_t default_nonce_size() const override { return 12; } }; diff --git a/src/modes/cbc/cbc.h b/src/modes/cbc/cbc.h index 68a1f7bcd..8638c8a05 100644 --- a/src/modes/cbc/cbc.h +++ b/src/modes/cbc/cbc.h @@ -8,7 +8,7 @@ #ifndef BOTAN_MODE_CBC_H__ #define BOTAN_MODE_CBC_H__ -#include <botan/transform.h> +#include <botan/cipher_mode.h> #include <botan/block_cipher.h> #include <botan/mode_pad.h> #include <memory> @@ -18,7 +18,7 @@ namespace Botan { /** * CBC Mode */ -class CBC_Mode : public Transformation +class BOTAN_DLL CBC_Mode : public Cipher_Mode { public: secure_vector<byte> start(const byte nonce[], size_t nonce_len) override; diff --git a/src/modes/cfb/cfb.h b/src/modes/cfb/cfb.h index 19e5b4bb0..46b1997d2 100644 --- a/src/modes/cfb/cfb.h +++ b/src/modes/cfb/cfb.h @@ -8,7 +8,7 @@ #ifndef BOTAN_MODE_CFB_H__ #define BOTAN_MODE_CFB_H__ -#include <botan/transform.h> +#include <botan/cipher_mode.h> #include <botan/block_cipher.h> #include <botan/mode_pad.h> #include <memory> @@ -18,7 +18,7 @@ namespace Botan { /** * CFB Mode */ -class CFB_Mode : public Transformation +class BOTAN_DLL CFB_Mode : public Cipher_Mode { public: secure_vector<byte> start(const byte nonce[], size_t nonce_len) override; diff --git a/src/modes/cipher_mode.h b/src/modes/cipher_mode.h new file mode 100644 index 000000000..91e2af5a9 --- /dev/null +++ b/src/modes/cipher_mode.h @@ -0,0 +1,30 @@ +/* +* Cipher Modes +* (C) 2013 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_CIPHER_MODE_H__ +#define BOTAN_CIPHER_MODE_H__ + +#include <botan/transform.h> + +namespace Botan { + +/** +* Interface for cipher modes +*/ +class BOTAN_DLL Cipher_Mode : public Transformation + { + public: + /** + * Returns true iff this mode provides authentication as well as + * confidentiality. + */ + virtual bool authenticated() const { return false; } + }; + +} + +#endif diff --git a/src/modes/ecb/ecb.h b/src/modes/ecb/ecb.h index 459ac939a..8ab62fa45 100644 --- a/src/modes/ecb/ecb.h +++ b/src/modes/ecb/ecb.h @@ -8,7 +8,7 @@ #ifndef BOTAN_MODE_ECB_H__ #define BOTAN_MODE_ECB_H__ -#include <botan/transform.h> +#include <botan/cipher_mode.h> #include <botan/block_cipher.h> #include <botan/mode_pad.h> #include <memory> @@ -16,9 +16,9 @@ namespace Botan { /** -* ECB Mode. Only handles full blocks, padding is handled higher up +* ECB mode */ -class ECB_Mode : public Transformation +class BOTAN_DLL ECB_Mode : public Cipher_Mode { public: secure_vector<byte> start(const byte nonce[], size_t nonce_len) override; diff --git a/src/modes/xts/xts.h b/src/modes/xts/xts.h index 0aea3293d..a1f0f1626 100644 --- a/src/modes/xts/xts.h +++ b/src/modes/xts/xts.h @@ -8,7 +8,7 @@ #ifndef BOTAN_MODE_XTS_H__ #define BOTAN_MODE_XTS_H__ -#include <botan/transform.h> +#include <botan/cipher_mode.h> #include <botan/block_cipher.h> #include <memory> @@ -17,7 +17,7 @@ namespace Botan { /** * IEEE P1619 XTS Mode */ -class XTS_Mode : public Transformation +class BOTAN_DLL XTS_Mode : public Cipher_Mode { public: std::string name() const override; diff --git a/src/tls/tls_policy.h b/src/tls/tls_policy.h index 6cc41fc50..0b7a10ca5 100644 --- a/src/tls/tls_policy.h +++ b/src/tls/tls_policy.h @@ -146,7 +146,7 @@ class BOTAN_DLL Policy /** * NSA Suite B 128-bit security level (see @rfc 6460) */ -class NSA_Suite_B_128 : public Policy +class BOTAN_DLL NSA_Suite_B_128 : public Policy { public: std::vector<std::string> allowed_ciphers() const override |