diff options
Diffstat (limited to 'src/lib/base')
-rw-r--r-- | src/lib/base/algo_registry.h | 4 | ||||
-rw-r--r-- | src/lib/base/info.txt | 3 | ||||
-rw-r--r-- | src/lib/base/transform.cpp | 20 | ||||
-rw-r--r-- | src/lib/base/transform.h | 182 |
4 files changed, 0 insertions, 209 deletions
diff --git a/src/lib/base/algo_registry.h b/src/lib/base/algo_registry.h index ebc23bfca..f7e66b3e2 100644 --- a/src/lib/base/algo_registry.h +++ b/src/lib/base/algo_registry.h @@ -294,10 +294,6 @@ make_new_T_1X(const typename Algo_Registry<T>::Spec& spec) #define BOTAN_REGISTER_NAMED_T_2LEN(T, type, name, provider, len1, len2) \ BOTAN_REGISTER_TYPE(T, type, name, (make_new_T_2len<type,len1,len2>), provider, BOTAN_DEFAULT_ALGORITHM_PRIO) -// TODO move elsewhere: -#define BOTAN_REGISTER_TRANSFORM(name, maker) BOTAN_REGISTER_T(Transform, name, maker) -#define BOTAN_REGISTER_TRANSFORM_NOARGS(name) BOTAN_REGISTER_T_NOARGS(Transform, name) - } #endif diff --git a/src/lib/base/info.txt b/src/lib/base/info.txt index 33d22a279..7553007e5 100644 --- a/src/lib/base/info.txt +++ b/src/lib/base/info.txt @@ -8,15 +8,12 @@ secmem.h scan_name.h sym_algo.h symkey.h -transform.h </header:public> <header:internal> algo_registry.h </header:internal> -define TRANSFORM 20131209 - <requires> block hash diff --git a/src/lib/base/transform.cpp b/src/lib/base/transform.cpp deleted file mode 100644 index 8f05a33ad..000000000 --- a/src/lib/base/transform.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* -* (C) 2015 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include <botan/internal/algo_registry.h> -#include <botan/transform.h> - -namespace Botan { - -Transform* get_transform(const std::string& specstr, - const std::string& provider, - const std::string& dirstr) - { - Algo_Registry<Transform>::Spec spec(specstr, dirstr); - return Algo_Registry<Transform>::global_registry().make(spec, provider); - } - -} diff --git a/src/lib/base/transform.h b/src/lib/base/transform.h deleted file mode 100644 index cd4ee9880..000000000 --- a/src/lib/base/transform.h +++ /dev/null @@ -1,182 +0,0 @@ -/* -* Transforms of data -* (C) 2013 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_TRANSFORM_H__ -#define BOTAN_TRANSFORM_H__ - -#include <botan/secmem.h> -#include <botan/key_spec.h> -#include <botan/exceptn.h> -#include <botan/symkey.h> -#include <botan/scan_name.h> -#include <string> -#include <vector> - -namespace Botan { - -/** -* Interface for general transformations on data -*/ -class BOTAN_DLL Transform - { - public: - typedef SCAN_Name Spec; - - /** - * Begin processing a message. - * @param nonce the per message nonce - */ - template<typename Alloc> - secure_vector<byte> start(const std::vector<byte, Alloc>& nonce) - { - return start(nonce.data(), nonce.size()); - } - - /** - * Begin processing a message. - * @param nonce the per message nonce - */ - template<typename Alloc> - BOTAN_DEPRECATED("Use Transform::start") - secure_vector<byte> start_vec(const std::vector<byte, Alloc>& nonce) - { - return start(nonce.data(), nonce.size()); - } - - /** - * Begin processing a message. - * @param nonce the per message nonce - * @param nonce_len length of nonce - */ - secure_vector<byte> start(const byte nonce[], size_t nonce_len) - { - return start_raw(nonce, nonce_len); - } - - /** - * Begin processing a message. - */ - secure_vector<byte> start() - { - return start_raw(nullptr, 0); - } - - virtual secure_vector<byte> start_raw(const byte nonce[], size_t nonce_len) = 0; - - /** - * Process some data. Input must be in size update_granularity() byte blocks. - * @param blocks in/out parameter which will possibly be resized - * @param offset an offset into blocks to begin processing - */ - virtual void update(secure_vector<byte>& blocks, size_t offset = 0) = 0; - - /** - * Complete processing of a message. - * - * @param final_block in/out parameter which must be at least - * minimum_final_size() bytes, and will be set to any final output - * @param offset an offset into final_block to begin processing - */ - virtual void finish(secure_vector<byte>& final_block, size_t offset = 0) = 0; - - /** - * Returns the size of the output if this transform is used to process a - * message with input_length bytes. Will throw if unable to give a precise - * answer. - */ - virtual size_t output_length(size_t input_length) const = 0; - - /** - * @return size of required blocks to update - */ - virtual size_t update_granularity() const = 0; - - /** - * @return required minimium size to finalize() - may be any - * length larger than this. - */ - virtual size_t minimum_final_size() const = 0; - - /** - * Return the default size for a nonce - */ - virtual size_t default_nonce_length() const = 0; - - /** - * Return true iff nonce_len is a valid length for the nonce - */ - virtual bool valid_nonce_length(size_t nonce_len) const = 0; - - /** - * Return some short name describing the provider of this tranformation. - * Useful in cases where multiple implementations are available (eg, - * different implementations of AES). Default "core" is used for the - * 'standard' implementation included in the library. - */ - virtual std::string provider() const { return "core"; } - - virtual std::string name() const = 0; - - virtual void clear() = 0; - - virtual ~Transform() {} - }; - -class BOTAN_DLL Keyed_Transform : public Transform - { - public: - /** - * @return object describing limits on key size - */ - virtual Key_Length_Specification key_spec() const = 0; - - /** - * Check whether a given key length is valid for this algorithm. - * @param length the key length to be checked. - * @return true if the key length is valid. - */ - bool valid_keylength(size_t length) const - { - return key_spec().valid_keylength(length); - } - - template<typename Alloc> - void set_key(const std::vector<byte, Alloc>& key) - { - set_key(key.data(), key.size()); - } - - void set_key(const SymmetricKey& key) - { - set_key(key.begin(), key.length()); - } - - /** - * Set the symmetric key of this transform - * @param key contains the key material - * @param length in bytes of key param - */ - void set_key(const byte key[], size_t length) - { - if(!valid_keylength(length)) - throw Invalid_Key_Length(name(), length); - key_schedule(key, length); - } - - private: - virtual void key_schedule(const byte key[], size_t length) = 0; - }; - -typedef Transform Transformation; - -BOTAN_DLL Transform* get_transform(const std::string& specstr, - const std::string& provider = "", - const std::string& dirstr = ""); - -} - -#endif |