diff options
author | Jack Lloyd <[email protected]> | 2015-09-21 14:59:01 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-09-21 14:59:01 -0400 |
commit | 04319af23bf8ed467b17f9b74c814343e051ab6b (patch) | |
tree | 630d1a0cc931e77e7e1f07319e5cf89d00af4458 /src/tests | |
parent | 408ea0a9b8ed0f575f8ee26891473920b42ef026 (diff) |
Remove use of lookup.h in favor of new T::create API.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_block.cpp | 5 | ||||
-rw-r--r-- | src/tests/test_dlies.cpp | 9 | ||||
-rw-r--r-- | src/tests/test_hash.cpp | 5 | ||||
-rw-r--r-- | src/tests/test_kdf.cpp | 1 | ||||
-rw-r--r-- | src/tests/test_mac.cpp | 5 | ||||
-rw-r--r-- | src/tests/test_modes.cpp | 1 | ||||
-rw-r--r-- | src/tests/test_ocb.cpp | 8 | ||||
-rw-r--r-- | src/tests/test_pbkdf.cpp | 1 | ||||
-rw-r--r-- | src/tests/test_rng.cpp | 6 | ||||
-rw-r--r-- | src/tests/test_stream.cpp | 5 |
10 files changed, 20 insertions, 26 deletions
diff --git a/src/tests/test_block.cpp b/src/tests/test_block.cpp index 509cf1c0c..32e175899 100644 --- a/src/tests/test_block.cpp +++ b/src/tests/test_block.cpp @@ -7,7 +7,6 @@ #include "tests.h" #include <botan/block_cipher.h> -#include <botan/lookup.h> #include <botan/hex.h> #include <iostream> #include <fstream> @@ -25,7 +24,7 @@ size_t block_test(const std::string& algo, const secure_vector<byte> pt = hex_decode_locked(in_hex); const secure_vector<byte> ct = hex_decode_locked(out_hex); - const std::vector<std::string> providers = get_block_cipher_providers(algo); + const std::vector<std::string> providers = BlockCipher::providers(algo); size_t fails = 0; if(providers.empty()) @@ -33,7 +32,7 @@ size_t block_test(const std::string& algo, for(auto provider: providers) { - std::unique_ptr<BlockCipher> cipher(get_block_cipher(algo, provider)); + std::unique_ptr<BlockCipher> cipher(BlockCipher::create(algo, provider)); if(!cipher) { diff --git a/src/tests/test_dlies.cpp b/src/tests/test_dlies.cpp index f282a9387..bf367efb8 100644 --- a/src/tests/test_dlies.cpp +++ b/src/tests/test_dlies.cpp @@ -19,7 +19,6 @@ #include <botan/dh.h> #include <botan/hex.h> #include <botan/pubkey.h> -#include <botan/lookup.h> using namespace Botan; @@ -54,13 +53,13 @@ size_t dlies_kat(const std::string& p, const size_t mac_key_len = to_u32bit(options[2]); DLIES_Encryptor e(from, - get_kdf(options[0]), - get_mac(options[1]), + KDF::create(options[0]).release(), + MessageAuthenticationCode::create(options[1]).release(), mac_key_len); DLIES_Decryptor d(to, - get_kdf(options[0]), - get_mac(options[1]), + KDF::create(options[0]).release(), + MessageAuthenticationCode::create(options[1]).release(), mac_key_len); e.set_other_key(to.public_value()); diff --git a/src/tests/test_hash.cpp b/src/tests/test_hash.cpp index a69ba3ef3..d37a9dc14 100644 --- a/src/tests/test_hash.cpp +++ b/src/tests/test_hash.cpp @@ -6,7 +6,6 @@ #include "tests.h" -#include <botan/lookup.h> #include <botan/hash.h> #include <botan/hex.h> #include <iostream> @@ -22,7 +21,7 @@ size_t hash_test(const std::string& algo, { size_t fails = 0; - const std::vector<std::string> providers = get_hash_function_providers(algo); + const std::vector<std::string> providers = HashFunction::providers(algo); if(providers.empty()) { @@ -32,7 +31,7 @@ size_t hash_test(const std::string& algo, for(auto provider: providers) { - std::unique_ptr<HashFunction> hash(get_hash(algo, provider)); + std::unique_ptr<HashFunction> hash(HashFunction::create(algo, provider)); if(!hash) { diff --git a/src/tests/test_kdf.cpp b/src/tests/test_kdf.cpp index 65814f0d6..30541d459 100644 --- a/src/tests/test_kdf.cpp +++ b/src/tests/test_kdf.cpp @@ -9,7 +9,6 @@ #if defined(BOTAN_HAS_KDF_BASE) #include <botan/kdf.h> -#include <botan/lookup.h> #include <botan/hex.h> #include <iostream> #include <fstream> diff --git a/src/tests/test_mac.cpp b/src/tests/test_mac.cpp index 6ab87274f..4009a6c4d 100644 --- a/src/tests/test_mac.cpp +++ b/src/tests/test_mac.cpp @@ -8,7 +8,6 @@ #if defined(BOTAN_HAS_MAC) -#include <botan/lookup.h> #include <botan/mac.h> #include <botan/hex.h> #include <iostream> @@ -23,7 +22,7 @@ size_t mac_test(const std::string& algo, const std::string& in_hex, const std::string& out_hex) { - const std::vector<std::string> providers = get_mac_providers(algo); + const std::vector<std::string> providers = MessageAuthenticationCode::providers(algo); size_t fails = 0; if(providers.empty()) @@ -34,7 +33,7 @@ size_t mac_test(const std::string& algo, for(auto provider: providers) { - std::unique_ptr<MessageAuthenticationCode> mac(get_mac(algo, provider)); + std::unique_ptr<MessageAuthenticationCode> mac(MessageAuthenticationCode::create(algo, provider)); if(!mac) { diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp index bfbb46355..09e0be8ba 100644 --- a/src/tests/test_modes.cpp +++ b/src/tests/test_modes.cpp @@ -11,7 +11,6 @@ #if defined(BOTAN_HAS_FILTERS) #include <botan/hex.h> -#include <botan/lookup.h> #include <botan/cipher_mode.h> #include <botan/filters.h> #include <iostream> diff --git a/src/tests/test_ocb.cpp b/src/tests/test_ocb.cpp index 4069625b5..891ecb54d 100644 --- a/src/tests/test_ocb.cpp +++ b/src/tests/test_ocb.cpp @@ -16,7 +16,6 @@ #include <botan/sha2_32.h> #include <botan/aes.h> #include <botan/loadstor.h> -#include <botan/lookup.h> using namespace Botan; @@ -63,9 +62,12 @@ size_t test_ocb_long(size_t keylen, size_t taglen, const std::string algo = "AES-" + std::to_string(keylen); - OCB_Encryption enc(get_block_cipher(algo), taglen / 8); + std::unique_ptr<BlockCipher> aes(BlockCipher::create(algo)); + if(!aes) + throw Algorithm_Not_Found(algo); - OCB_Decryption dec(get_block_cipher(algo), taglen / 8); + OCB_Encryption enc(aes->clone(), taglen / 8); + OCB_Decryption dec(aes->clone(), taglen / 8); std::vector<byte> key(keylen/8); key[keylen/8-1] = taglen; diff --git a/src/tests/test_pbkdf.cpp b/src/tests/test_pbkdf.cpp index 8f765fa1d..1f5a0a6a1 100644 --- a/src/tests/test_pbkdf.cpp +++ b/src/tests/test_pbkdf.cpp @@ -9,7 +9,6 @@ #if defined(BOTAN_HAS_PBKDF) #include <botan/pbkdf.h> -#include <botan/lookup.h> #include <botan/hex.h> #include <iostream> #include <fstream> diff --git a/src/tests/test_rng.cpp b/src/tests/test_rng.cpp index d129ed208..7cbd50fa0 100644 --- a/src/tests/test_rng.cpp +++ b/src/tests/test_rng.cpp @@ -8,7 +8,6 @@ #include "tests.h" #include <botan/hex.h> -#include <botan/lookup.h> #include <iostream> #include <fstream> @@ -47,12 +46,13 @@ RandomNumberGenerator* get_rng(const std::string& algo_str, const std::string& i #if defined(BOTAN_HAS_HMAC_DRBG) if(rng_name == "HMAC_DRBG") - return new HMAC_DRBG(get_mac("HMAC(" + algo_name[1] + ")"), new AllOnce_RNG(ikm)); + return new HMAC_DRBG(MessageAuthenticationCode::create("HMAC(" + algo_name[1] + ")").release(), + new AllOnce_RNG(ikm)); #endif #if defined(BOTAN_HAS_X931_RNG) if(rng_name == "X9.31-RNG") - return new ANSI_X931_RNG(get_block_cipher(algo_name[1]), + return new ANSI_X931_RNG(BlockCipher::create(algo_name[1]).release(), new Fixed_Output_RNG(ikm)); #endif diff --git a/src/tests/test_stream.cpp b/src/tests/test_stream.cpp index 4828d44fd..046c199ec 100644 --- a/src/tests/test_stream.cpp +++ b/src/tests/test_stream.cpp @@ -9,7 +9,6 @@ #if defined(BOTAN_HAS_STREAM_CIPHER) #include <botan/stream_cipher.h> -#include <botan/lookup.h> #include <botan/hex.h> #include <iostream> #include <fstream> @@ -29,7 +28,7 @@ size_t stream_test(const std::string& algo, const secure_vector<byte> ct = hex_decode_locked(out_hex); const secure_vector<byte> nonce = hex_decode_locked(nonce_hex); - const std::vector<std::string> providers = get_stream_cipher_providers(algo); + const std::vector<std::string> providers = StreamCipher::providers(algo); size_t fails = 0; if(providers.empty()) @@ -40,7 +39,7 @@ size_t stream_test(const std::string& algo, for(auto provider: providers) { - std::unique_ptr<StreamCipher> cipher(get_stream_cipher(algo, provider)); + std::unique_ptr<StreamCipher> cipher(StreamCipher::create(algo, provider)); if(!cipher) { |