aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-01 13:48:44 +0000
committerlloyd <[email protected]>2008-10-01 13:48:44 +0000
commitc3cc27653551f2fddebcab66a0220df3d1a2ea66 (patch)
tree35ea9fbbe338146e33d5d7fa4042e3ccb91c4f37 /src
parentbaf45319439d1225c224ec9ab9492683d3722ec6 (diff)
Guard uses of ECDSA in the library with BOTAN_HAS_ECDSA macro, so it can
be disabled. Disable gfpmath by default due to TR1 dependency (this will automatically turn of ECDSA/ECKAEG, unless gfpmath is explicitly loaded with --enable-module=gfpmath).
Diffstat (limited to 'src')
-rw-r--r--src/core/libstate/eng_base.cpp2
-rw-r--r--src/core/libstate/engine.cpp2
-rw-r--r--src/core/libstate/engine.h10
-rw-r--r--src/math/gfpmath/info.txt2
-rw-r--r--src/pk/pubkey/pk_core.cpp3
-rw-r--r--src/pk/pubkey/pk_core.h11
-rw-r--r--src/pk/pubkey/pk_ops.h7
7 files changed, 30 insertions, 7 deletions
diff --git a/src/core/libstate/eng_base.cpp b/src/core/libstate/eng_base.cpp
index bd6b53447..a296a2762 100644
--- a/src/core/libstate/eng_base.cpp
+++ b/src/core/libstate/eng_base.cpp
@@ -108,6 +108,7 @@ DH_Operation* Engine::dh_op(const DL_Group&, const BigInt&) const
return 0;
}
+#if defined(BOTAN_HAS_ECDSA)
/*************************************************
* Basic No-Op Engine Implementation *
*************************************************/
@@ -127,6 +128,7 @@ ECKAEG_Operation* Engine::eckaeg_op(const EC_Domain_Params&,
{
return 0;
}
+#endif
/*************************************************
* Basic No-Op Engine Implementation *
diff --git a/src/core/libstate/engine.cpp b/src/core/libstate/engine.cpp
index 14c1c9c50..fb2477936 100644
--- a/src/core/libstate/engine.cpp
+++ b/src/core/libstate/engine.cpp
@@ -100,6 +100,7 @@ DH_Operation* dh_op(const DL_Group& group, const BigInt& x)
throw Lookup_Error("Engine_Core::dh_op: Unable to find a working engine");
}
+#if defined(BOTAN_HAS_ECDSA)
/*************************************************
* Acquire an ECDSA op *
*************************************************/
@@ -137,6 +138,7 @@ ECKAEG_Operation* eckaeg_op(const EC_Domain_Params& dom_pars,
throw Lookup_Error("Engine_Core::eckaeg_op: Unable to find a working engine");
}
+#endif
/*************************************************
* Acquire a modular exponentiator *
diff --git a/src/core/libstate/engine.h b/src/core/libstate/engine.h
index 74449c959..212d02d7a 100644
--- a/src/core/libstate/engine.h
+++ b/src/core/libstate/engine.h
@@ -8,11 +8,15 @@
#include <botan/base.h>
#include <botan/mutex.h>
-#include <botan/ec_dompar.h>
#include <botan/pk_ops.h>
#include <botan/pow_mod.h>
#include <botan/basefilt.h>
#include <botan/enums.h>
+
+#if defined(BOTAN_HAS_ECDSA)
+ #include <botan/ec_dompar.h>
+#endif
+
#include <utility>
#include <map>
@@ -44,6 +48,7 @@ class BOTAN_DLL Engine
const BigInt&) const;
virtual DH_Operation* dh_op(const DL_Group&, const BigInt&) const;
+#if defined(BOTAN_HAS_ECDSA)
virtual ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars,
const BigInt& priv_key,
const PointGFp& pub_key) const;
@@ -51,6 +56,7 @@ class BOTAN_DLL Engine
virtual ECKAEG_Operation* eckaeg_op(const EC_Domain_Params& dom_pars,
const BigInt& priv_key,
const PointGFp& pub_key) const;
+#endif
virtual Modular_Exponentiator* mod_exp(const BigInt&,
Power_Mod::Usage_Hints) const;
@@ -125,6 +131,7 @@ ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&);
DH_Operation* dh_op(const DL_Group&, const BigInt&);
+#if defined(BOTAN_HAS_ECDSA)
ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars,
const BigInt& priv_key,
const PointGFp& pub_key);
@@ -132,6 +139,7 @@ ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars,
ECKAEG_Operation* eckaeg_op(const EC_Domain_Params& dom_pars,
const BigInt& priv_key,
const PointGFp& pub_key);
+#endif
}
diff --git a/src/math/gfpmath/info.txt b/src/math/gfpmath/info.txt
index 9c62d7761..ab4e440df 100644
--- a/src/math/gfpmath/info.txt
+++ b/src/math/gfpmath/info.txt
@@ -1,6 +1,6 @@
realname "GF(p) Math"
-load_on auto
+load_on request
define BIGINT_GFP
diff --git a/src/pk/pubkey/pk_core.cpp b/src/pk/pubkey/pk_core.cpp
index 63a1141a0..ca976bbee 100644
--- a/src/pk/pubkey/pk_core.cpp
+++ b/src/pk/pubkey/pk_core.cpp
@@ -297,6 +297,8 @@ BigInt DH_Core::agree(const BigInt& i) const
return blinder.unblind(op->agree(blinder.blind(i)));
}
+#if defined(BOTAN_HAS_ECDSA)
+
/*************************************************
* ECKAEG_Core Constructor *
*************************************************/
@@ -374,5 +376,6 @@ ECDSA_Core::ECDSA_Core(EC_Domain_Params const& dom_pars, const BigInt& priv_key,
{
op = Engine_Core::ecdsa_op(dom_pars, priv_key, pub_key);
}
+#endif
}
diff --git a/src/pk/pubkey/pk_core.h b/src/pk/pubkey/pk_core.h
index 66b1d43f9..8e4b52f0e 100644
--- a/src/pk/pubkey/pk_core.h
+++ b/src/pk/pubkey/pk_core.h
@@ -7,10 +7,13 @@
#define BOTAN_PK_CORE_H__
#include <botan/bigint.h>
-#include <botan/dl_group.h>
-#include <botan/ec_dompar.h>
#include <botan/blinding.h>
#include <botan/pk_ops.h>
+#include <botan/dl_group.h>
+
+#if defined(BOTAN_HAS_ECDSA)
+ #include <botan/ec_dompar.h>
+#endif
namespace Botan {
@@ -124,6 +127,7 @@ class BOTAN_DLL DH_Core
Blinder blinder;
};
+#if defined(BOTAN_HAS_ECDSA)
/*************************************************
* ECDSA Core *
*************************************************/
@@ -173,8 +177,7 @@ class ECKAEG_Core
ECKAEG_Operation* op;
Blinder blinder;
};
-
-
+#endif
}
diff --git a/src/pk/pubkey/pk_ops.h b/src/pk/pubkey/pk_ops.h
index 13acb3fb2..5413fc7cd 100644
--- a/src/pk/pubkey/pk_ops.h
+++ b/src/pk/pubkey/pk_ops.h
@@ -8,7 +8,10 @@
#include <botan/bigint.h>
#include <botan/dl_group.h>
-#include <botan/point_gfp.h>
+
+#if defined(BOTAN_HAS_ECDSA)
+ #include <botan/point_gfp.h>
+#endif
namespace Botan {
@@ -75,6 +78,7 @@ class BOTAN_DLL DH_Operation
virtual ~DH_Operation() {}
};
+#if defined(BOTAN_HAS_ECDSA)
/*************************************************
* ECDSA Operation *
*************************************************/
@@ -102,6 +106,7 @@ class BOTAN_DLL ECKAEG_Operation
virtual ECKAEG_Operation* clone() const = 0;
virtual ~ECKAEG_Operation() {}
};
+#endif
}