diff options
author | Jack Lloyd <[email protected]> | 2015-09-21 16:09:36 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-09-21 16:09:36 -0400 |
commit | 7ebe7511496b8a6950acced513a81516565354ed (patch) | |
tree | add1163c2afbd1ae3d163aaac8375a3b56bd6c9c /src/lib/stream/stream_cipher.h | |
parent | 8f732dccce692eaca509fc9732702df62cfa5c87 (diff) | |
parent | 04319af23bf8ed467b17f9b74c814343e051ab6b (diff) |
Merge pull request #279 from randombit/fix-static-lib-registration
Move the algorithm factory functions to T::create and move object registration to the source file for its base class. These resolve the issues which prevented successful use of a static library that was built with individual object files. Removes the restriction in configure.py which prevented building non-amalgamation static libs.
Diffstat (limited to 'src/lib/stream/stream_cipher.h')
-rw-r--r-- | src/lib/stream/stream_cipher.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/stream/stream_cipher.h b/src/lib/stream/stream_cipher.h index bfdd152a7..8c9b28147 100644 --- a/src/lib/stream/stream_cipher.h +++ b/src/lib/stream/stream_cipher.h @@ -20,6 +20,21 @@ namespace Botan { class BOTAN_DLL StreamCipher : public SymmetricAlgorithm { public: + typedef SCAN_Name Spec; + + /** + * Create an instance based on a name + * Will return a null pointer if the algo/provider combination cannot + * be found. If provider is empty then best available is chosen. + */ + static std::unique_ptr<StreamCipher> create(const std::string& algo_spec, + const std::string& provider = ""); + + /** + * Returns the list of available providers for this algorithm, empty if not available + */ + static std::vector<std::string> providers(const std::string& algo_spec); + /** * Encrypt or decrypt a message * @param in the plaintext @@ -53,11 +68,7 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm * @param iv the initialization vector * @param iv_len the length of the IV in bytes */ - virtual void set_iv(const byte[], size_t iv_len) - { - if(iv_len) - throw Invalid_IV_Length(name(), iv_len); - } + virtual void set_iv(const byte[], size_t iv_len); /** * @param iv_len the length of the IV in bytes @@ -70,7 +81,8 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm */ virtual StreamCipher* clone() const = 0; - typedef SCAN_Name Spec; + StreamCipher(); + virtual ~StreamCipher(); }; } |