diff options
author | lloyd <[email protected]> | 2007-09-13 13:39:27 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-09-13 13:39:27 +0000 |
commit | 1ea96f920373b411ae08c9c9141845f2e4a96efc (patch) | |
tree | a1fd55b564a0750146167b062def381c9ffcd2e9 | |
parent | bcd6d592c3a9a16e3d5fa6a9a0d027cd738d253a (diff) |
Remove the BOTAN_NO_ macros
-rw-r--r-- | checks/pk.cpp | 45 | ||||
-rw-r--r-- | checks/pk_bench.cpp | 33 |
2 files changed, 9 insertions, 69 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp index b8bf0fc51..bb0a27f2a 100644 --- a/checks/pk.cpp +++ b/checks/pk.cpp @@ -11,21 +11,10 @@ #include <botan/dsa.h> #include <botan/dh.h> -#if !defined(BOTAN_NO_NR) - #include <botan/nr.h> -#endif - -#if !defined(BOTAN_NO_RW) - #include <botan/rw.h> -#endif - -#if !defined(BOTAN_NO_ELG) - #include <botan/elgamal.h> -#endif - -#if !defined(BOTAN_NO_DLIES) - #include <botan/dlies.h> -#endif +#include <botan/nr.h> +#include <botan/rw.h> +#include <botan/elgamal.h> +#include <botan/dlies.h> #include <botan/filters.h> #include <botan/look_pk.h> @@ -380,9 +369,6 @@ u32bit validate_rsa_enc(const std::string& algo, u32bit validate_elg_enc(const std::string& algo, const std::vector<std::string>& str) { -#if defined(BOTAN_NO_ELG) - return 0; -#else if(str.size() != 6 && str.size() != 7) throw Exception("Invalid input from pk_valid.dat"); @@ -405,7 +391,6 @@ u32bit validate_elg_enc(const std::string& algo, decode_hex(str[4]), failure); return (failure ? 1 : 0); -#endif } u32bit validate_rsa_sig(const std::string& algo, @@ -483,9 +468,6 @@ u32bit validate_rsa_ver_x509(const std::string& algo, u32bit validate_rw_ver(const std::string& algo, const std::vector<std::string>& str) { -#if defined(BOTAN_NO_RW) - return 0; -#else if(str.size() != 5) throw Exception("Invalid input from pk_valid.dat"); @@ -503,15 +485,11 @@ u32bit validate_rw_ver(const std::string& algo, delete v; return (passed ? 0 : 1); -#endif } u32bit validate_rw_sig(const std::string& algo, const std::vector<std::string>& str) { -#if defined(BOTAN_NO_RW) - return 0; -#else if(str.size() != 6) throw Exception("Invalid input from pk_valid.dat"); @@ -527,7 +505,6 @@ u32bit validate_rw_sig(const std::string& algo, bool failure = false; validate_signature(v, s, algo, str[3], str[4], str[5], failure); return (failure ? 1 : 0); -#endif } u32bit validate_dsa_sig(const std::string& algo, @@ -594,9 +571,6 @@ u32bit validate_dsa_ver(const std::string& algo, u32bit validate_nr_sig(const std::string& algo, const std::vector<std::string>& str) { -#if defined(BOTAN_NO_NR) - return 0; -#else if(str.size() != 8) throw Exception("Invalid input from pk_valid.dat"); @@ -612,7 +586,6 @@ u32bit validate_nr_sig(const std::string& algo, bool failure = false; validate_signature(v, s, algo, str[5], str[6], str[7], failure); return (failure ? 1 : 0); -#endif } u32bit validate_dh(const std::string& algo, @@ -643,9 +616,6 @@ u32bit validate_dh(const std::string& algo, u32bit validate_dlies(const std::string& algo, const std::vector<std::string>& str) { -#if defined(BOTAN_NO_DLIES) - return 0; -#else if(str.size() != 6) throw Exception("Invalid input from pk_valid.dat"); @@ -673,7 +643,6 @@ u32bit validate_dlies(const std::string& algo, bool failure = false; validate_encryption(e, d, algo, str[4], empty, str[5], failure); return (failure ? 1 : 0); -#endif } void do_pk_keygen_tests() @@ -710,9 +679,7 @@ void do_pk_keygen_tests() } IF_SIG_KEY(RSA_PrivateKey, 512); -#if !defined(BOTAN_NO_RW) IF_SIG_KEY(RW_PrivateKey, 512); -#endif DL_SIG_KEY(DSA_PrivateKey, "dsa/jce/512"); DL_SIG_KEY(DSA_PrivateKey, "dsa/jce/768"); @@ -722,17 +689,13 @@ void do_pk_keygen_tests() DL_KEY(DH_PrivateKey, "modp/ietf/2048"); DL_KEY(DH_PrivateKey, "dsa/jce/1024"); -#if !defined(BOTAN_NO_NR) DL_SIG_KEY(NR_PrivateKey, "dsa/jce/512"); DL_SIG_KEY(NR_PrivateKey, "dsa/jce/768"); DL_SIG_KEY(NR_PrivateKey, "dsa/jce/1024"); -#endif -#if !defined(BOTAN_NO_ELG) DL_ENC_KEY(ElGamal_PrivateKey, "modp/ietf/768"); DL_ENC_KEY(ElGamal_PrivateKey, "modp/ietf/1024"); DL_ENC_KEY(ElGamal_PrivateKey, "dsa/jce/1024"); -#endif std::cout << std::endl; } diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp index 47f858373..f3b4ad04e 100644 --- a/checks/pk_bench.cpp +++ b/checks/pk_bench.cpp @@ -1,22 +1,14 @@ #include <botan/dsa.h> #include <botan/rsa.h> #include <botan/dh.h> +#include <botan/nr.h> +#include <botan/rw.h> +#include <botan/elgamal.h> + #include <botan/pkcs8.h> #include <botan/look_pk.h> #include <botan/rng.h> -#if !defined(BOTAN_NO_NR) - #include <botan/nr.h> -#endif - -#if !defined(BOTAN_NO_RW) - #include <botan/rw.h> -#endif - -#if !defined(BOTAN_NO_ELG) - #include <botan/elgamal.h> -#endif - using namespace Botan; #include "common.h" @@ -30,9 +22,7 @@ using namespace Botan; #define PRINT_MS_PER_OP 0 /* If 0, print ops / second */ RSA_PrivateKey* load_rsa_key(const std::string&); -#if !defined(BOTAN_NO_RW) RW_PrivateKey load_rw_key(const std::string&); -#endif static BigInt to_bigint(const std::string& h) { @@ -73,7 +63,6 @@ void bench_dh(DH_PrivateKey& key, const std::string keybits, "DH-" + keybits, seconds, html); } -#if !defined(BOTAN_NO_RW) void bench_rw(RW_PrivateKey& key, const std::string keybits, double seconds, bool html) { @@ -83,9 +72,7 @@ void bench_rw(RW_PrivateKey& key, const std::string keybits, bench_sig(get_pk_signer(key, "EMSA2(SHA-1)"), "RW-" + keybits, seconds, html); } -#endif -#if !defined(BOTAN_NO_NR) void bench_nr(NR_PrivateKey& key, const std::string keybits, double seconds, bool html) { @@ -95,9 +82,7 @@ void bench_nr(NR_PrivateKey& key, const std::string keybits, bench_sig(get_pk_signer(key, "EMSA1(SHA-1)"), "NR-" + keybits, seconds, html); } -#endif -#if !defined(BOTAN_NO_ELG) void bench_elg(ElGamal_PrivateKey& key, const std::string keybits, double seconds, bool html) { @@ -107,7 +92,6 @@ void bench_elg(ElGamal_PrivateKey& key, const std::string keybits, get_pk_decryptor(key, "Raw"), "ELG-" + keybits, seconds, html); } -#endif void bench_pk(const std::string& algo, bool html, double seconds) { @@ -186,7 +170,7 @@ void bench_pk(const std::string& algo, bool html, double seconds) DO_DH("4096", "modp/ietf/4096"); #undef DO_DH } -#if !defined(BOTAN_NO_ELG) + if(algo == "All" || algo == "ELG" || algo == "ElGamal") { #define DO_ELG(NUM_STR, GROUP) \ @@ -202,9 +186,7 @@ void bench_pk(const std::string& algo, bool html, double seconds) DO_ELG("4096", "modp/ietf/4096"); #undef DO_ELG } -#endif -#if !defined(BOTAN_NO_NR) if(algo == "All" || algo == "NR") { #define DO_NR(NUM_STR, GROUP) \ @@ -218,9 +200,7 @@ void bench_pk(const std::string& algo, bool html, double seconds) DO_NR("1024", "dsa/jce/1024"); #undef DO_NR } -#endif -#if !defined(BOTAN_NO_RW) if(algo == "All" || algo == "RW") { #define DO_RW(NUM_STR, FILENAME) \ @@ -233,7 +213,6 @@ void bench_pk(const std::string& algo, bool html, double seconds) DO_RW("1024", "checks/keys/rw1024.key") #undef DO_RW } -#endif } catch(Botan::Exception& e) { @@ -461,7 +440,6 @@ RSA_PrivateKey* load_rsa_key(const std::string& file) return rsakey; } -#if !defined(BOTAN_NO_RW) RW_PrivateKey load_rw_key(const std::string& file) { std::ifstream keyfile(file.c_str()); @@ -478,4 +456,3 @@ RW_PrivateKey load_rw_key(const std::string& file) return key; } -#endif |