diff options
author | lloyd <[email protected]> | 2008-10-01 15:37:15 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-01 15:37:15 +0000 |
commit | 0d8e86081eb51c698df28b362453b2ef5654fc7b (patch) | |
tree | 0a99edff848d1f8284bbdb07ceb6b3991ff1eedb /src | |
parent | 9b8d9c877ffdf544e180112bfb7dede6da5aa5c6 (diff) |
Handle building Botan with almost all public key code disabled (though only
with the aid of macro hackery, at the moment).
Change DH feature macro to BOTAN_HAS_DIFFIE_HELLMAN
Change NR feature macro to BOTAN_HAS_NYBERG_RUEPPEL
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/cc/gcc | 4 | ||||
-rw-r--r-- | src/core/libstate/eng_def.h | 13 | ||||
-rw-r--r-- | src/core/libstate/engine.cpp | 10 | ||||
-rw-r--r-- | src/core/libstate/engine.h | 26 | ||||
-rw-r--r-- | src/pubkey/dh/info.txt | 4 | ||||
-rw-r--r-- | src/pubkey/nr/info.txt | 2 | ||||
-rw-r--r-- | src/pubkey/pubkey/pk_algs.cpp | 12 |
7 files changed, 53 insertions, 18 deletions
diff --git a/src/build-data/cc/gcc b/src/build-data/cc/gcc index 4194892a7..bb0849c51 100644 --- a/src/build-data/cc/gcc +++ b/src/build-data/cc/gcc @@ -9,8 +9,8 @@ add_lib_dir_option "-L" add_lib_option "-l" lang_flags "-D_REENTRANT -ansi -Wno-long-long" -warning_flags "-W -Wall" -#warning_flags "-Werror -Wextra -Wall -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations" +#warning_flags "-W -Wall" +warning_flags "-Werror -Wextra -Wall -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations" lib_opt_flags "-O2 -finline-functions" check_opt_flags "-O2" diff --git a/src/core/libstate/eng_def.h b/src/core/libstate/eng_def.h index 7d7ecce58..66cb774d2 100644 --- a/src/core/libstate/eng_def.h +++ b/src/core/libstate/eng_def.h @@ -16,16 +16,27 @@ namespace Botan { class BOTAN_DLL Default_Engine : public Engine { public: +#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&) const; +#endif + +#if defined(BOTAN_HAS_DSA) DSA_Operation* dsa_op(const DL_Group&, const BigInt&, const BigInt&) const; +#endif + +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&) const; +#endif + +#if defined(BOTAN_HAS_ELGAMAL) ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&) const; +#endif -#if defined(BOTAN_HAS_DH) +#if defined(BOTAN_HAS_DIFFIE_HELLMAN) DH_Operation* dh_op(const DL_Group&, const BigInt&) const; #endif diff --git a/src/core/libstate/engine.cpp b/src/core/libstate/engine.cpp index 13ab63193..4f58fb040 100644 --- a/src/core/libstate/engine.cpp +++ b/src/core/libstate/engine.cpp @@ -13,6 +13,7 @@ namespace Botan { namespace Engine_Core { +#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) /************************************************* * Acquire an IF op * *************************************************/ @@ -31,7 +32,9 @@ IF_Operation* if_op(const BigInt& e, const BigInt& n, const BigInt& d, throw Lookup_Error("Engine_Core::if_op: Unable to find a working engine"); } +#endif +#if defined(BOTAN_HAS_DSA) /************************************************* * Acquire a DSA op * *************************************************/ @@ -48,7 +51,9 @@ DSA_Operation* dsa_op(const DL_Group& group, const BigInt& y, const BigInt& x) throw Lookup_Error("Engine_Core::dsa_op: Unable to find a working engine"); } +#endif +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) /************************************************* * Acquire a NR op * *************************************************/ @@ -65,7 +70,9 @@ NR_Operation* nr_op(const DL_Group& group, const BigInt& y, const BigInt& x) throw Lookup_Error("Engine_Core::nr_op: Unable to find a working engine"); } +#endif +#if defined(BOTAN_HAS_ELGAMAL) /************************************************* * Acquire an ElGamal op * *************************************************/ @@ -82,8 +89,9 @@ ELG_Operation* elg_op(const DL_Group& group, const BigInt& y, const BigInt& x) throw Lookup_Error("Engine_Core::elg_op: Unable to find a working engine"); } +#endif -#if defined(BOTAN_HAS_DH) +#if defined(BOTAN_HAS_DIFFIE_HELLMAN) /************************************************* * Acquire a DH op * *************************************************/ diff --git a/src/core/libstate/engine.h b/src/core/libstate/engine.h index 72f5b28ca..bf33fa24d 100644 --- a/src/core/libstate/engine.h +++ b/src/core/libstate/engine.h @@ -20,11 +20,11 @@ #include <botan/dsa_op.h> #endif -#if defined(BOTAN_HAS_DH) +#if defined(BOTAN_HAS_DIFFIE_HELLMAN) #include <botan/dh_op.h> #endif -#if defined(BOTAN_HAS_NR) +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) #include <botan/nr_op.h> #endif @@ -32,7 +32,6 @@ #include <botan/elg_op.h> #endif - #if defined(BOTAN_HAS_ECDSA) #include <botan/ecc_op.h> #endif @@ -57,24 +56,32 @@ class BOTAN_DLL Engine virtual ~Algorithm_Cache() {} }; +#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) virtual IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&) const { return 0; } +#endif +#if defined(BOTAN_HAS_DSA) virtual DSA_Operation* dsa_op(const DL_Group&, const BigInt&, const BigInt&) const { return 0; } +#endif +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) virtual NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&) const { return 0; } +#endif +#if defined(BOTAN_HAS_ELGAMAL) virtual ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&) const { return 0; } +#endif -#if defined(BOTAN_HAS_DH) +#if defined(BOTAN_HAS_DIFFIE_HELLMAN) virtual DH_Operation* dh_op(const DL_Group&, const BigInt&) const { return 0; } #endif @@ -154,16 +161,25 @@ namespace Engine_Core { *************************************************/ Modular_Exponentiator* mod_exp(const BigInt&, Power_Mod::Usage_Hints); +#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&); +#endif +#if defined(BOTAN_HAS_DSA) DSA_Operation* dsa_op(const DL_Group&, const BigInt&, const BigInt&); +#endif + +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&); +#endif +#if defined(BOTAN_HAS_ELGAMAL) ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&); +#endif -#if defined(BOTAN_HAS_DH) +#if defined(BOTAN_HAS_DIFFIE_HELLMAN) DH_Operation* dh_op(const DL_Group&, const BigInt&); #endif diff --git a/src/pubkey/dh/info.txt b/src/pubkey/dh/info.txt index a54188c57..7c38b027e 100644 --- a/src/pubkey/dh/info.txt +++ b/src/pubkey/dh/info.txt @@ -1,6 +1,6 @@ -realname "DH" +realname "Diffie-Hellman Key Agreement" -define DH +define DIFFIE_HELLMAN load_on auto diff --git a/src/pubkey/nr/info.txt b/src/pubkey/nr/info.txt index b574af0e7..6434d4385 100644 --- a/src/pubkey/nr/info.txt +++ b/src/pubkey/nr/info.txt @@ -1,6 +1,6 @@ realname "Nyberg-Rueppel" -define NR +define NYBERG_RUEPPEL load_on auto diff --git a/src/pubkey/pubkey/pk_algs.cpp b/src/pubkey/pubkey/pk_algs.cpp index 3c1b81ba9..c1fc569a0 100644 --- a/src/pubkey/pubkey/pk_algs.cpp +++ b/src/pubkey/pubkey/pk_algs.cpp @@ -13,7 +13,7 @@ #include <botan/dsa.h> #endif -#ifdef BOTAN_HAS_DH +#ifdef BOTAN_HAS_DIFFIE_HELLMAN #include <botan/dh.h> #endif @@ -21,7 +21,7 @@ #include <botan/ec.h> #endif -#ifdef BOTAN_HAS_NR +#ifdef BOTAN_HAS_NYBERG_RUEPPEL #include <botan/nr.h> #endif @@ -48,11 +48,11 @@ Public_Key* get_public_key(const std::string& alg_name) if(alg_name == "DSA") return new DSA_PublicKey; #endif -#if defined(BOTAN_HAS_DH) +#if defined(BOTAN_HAS_DIFFIE_HELLMAN) if(alg_name == "DH") return new DH_PublicKey; #endif -#if defined(BOTAN_HAS_NR) +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) if(alg_name == "NR") return new NR_PublicKey; #endif @@ -84,11 +84,11 @@ Private_Key* get_private_key(const std::string& alg_name) if(alg_name == "DSA") return new DSA_PrivateKey; #endif -#if defined(BOTAN_HAS_DH) +#if defined(BOTAN_HAS_DIFFIE_HELLMAN) if(alg_name == "DH") return new DH_PrivateKey; #endif -#if defined(BOTAN_HAS_NR) +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) if(alg_name == "NR") return new NR_PrivateKey; #endif |