aboutsummaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-11 18:04:15 +0000
committerlloyd <[email protected]>2008-10-11 18:04:15 +0000
commitf4de00db6e85ab97e3f23878bcdc5ce69c95f004 (patch)
tree090c0de1dd8348062d8d05fd93934a598251d1d0 /src/math
parentf48380b83d115a86900ce87aae034d18d76d738e (diff)
Remove last use of freestore.h from gfpmath, move it to CVC code which still
uses it. Include tr1 header directly in gfp_element.h
Diffstat (limited to 'src/math')
-rw-r--r--src/math/gfpmath/curve_gfp.cpp8
-rw-r--r--src/math/gfpmath/curve_gfp.h2
-rw-r--r--src/math/gfpmath/freestore.h45
-rw-r--r--src/math/gfpmath/gfp_element.h9
-rw-r--r--src/math/gfpmath/info.txt1
5 files changed, 13 insertions, 52 deletions
diff --git a/src/math/gfpmath/curve_gfp.cpp b/src/math/gfpmath/curve_gfp.cpp
index 442fe070f..8b1ccbf94 100644
--- a/src/math/gfpmath/curve_gfp.cpp
+++ b/src/math/gfpmath/curve_gfp.cpp
@@ -13,15 +13,15 @@
namespace Botan {
-void CurveGFp::set_shrd_mod(SharedPtrConverter<GFpModulus> const mod)
+void CurveGFp::set_shrd_mod(const std::tr1::shared_ptr<GFpModulus> mod)
{
- mp_mod = mod.get_shared();
+ mp_mod = mod;
mA.turn_off_sp_red_mul();// m.m. is not needed, must be trf. back
mB.turn_off_sp_red_mul();// m.m. is not needed, must be trf. back
//ok, above we destroy any evantually computated montg. mult. values,
// but that won't influence performance in usual applications
- mA.set_shrd_mod(mod.get_shared());
- mB.set_shrd_mod(mod.get_shared());
+ mA.set_shrd_mod(mod);
+ mB.set_shrd_mod(mod);
}
CurveGFp::CurveGFp(const GFpElement& a, const GFpElement& b,
diff --git a/src/math/gfpmath/curve_gfp.h b/src/math/gfpmath/curve_gfp.h
index a0530aa01..b996aa3b1 100644
--- a/src/math/gfpmath/curve_gfp.h
+++ b/src/math/gfpmath/curve_gfp.h
@@ -55,7 +55,7 @@ class BOTAN_DLL CurveGFp
* @param mod a shared pointer to a GFpModulus object suitable for
* *this.
*/
- void set_shrd_mod(SharedPtrConverter<GFpModulus> const mod);
+ void set_shrd_mod(const std::tr1::shared_ptr<GFpModulus> mod);
// getters
diff --git a/src/math/gfpmath/freestore.h b/src/math/gfpmath/freestore.h
deleted file mode 100644
index f83d1e867..000000000
--- a/src/math/gfpmath/freestore.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**************************************************
-* (C) 2007 Christoph Ludwig *
-**************************************************/
-
-#ifndef BOTAN_FREESTORE_H__
-#define BOTAN_FREESTORE_H__
-
-#if defined(BOTAN_USE_TR1_SHARED_PTR)
- #include <tr1/memory>
-#elif defined(BOTAN_USE_BOOST_TR1_SHARED_PTR)
- #include <boost/tr1/memory.hpp>
-#else
- #error "Please choose a shared_ptr implementation"
-#endif
-
-namespace Botan {
-
-template<typename T>
-class BOTAN_DLL SharedPtrConverter
- {
- public:
- typedef std::tr1::shared_ptr<T> SharedPtr;
-
- SharedPtrConverter() : ptr() {};
- SharedPtrConverter(SharedPtrConverter const& other)
- : ptr(other.ptr) {};
-
- template<typename Ptr>
- SharedPtrConverter(Ptr p)
- : ptr(p) {};
-
- SharedPtr const& get_ptr() const { return this->ptr; }
- SharedPtr get_ptr() { return this->ptr; }
-
- SharedPtr const& get_shared() const { return this->ptr; }
- SharedPtr get_shared() { return this->ptr; }
-
- private:
- SharedPtr ptr;
- };
-
-}
-
-#endif
diff --git a/src/math/gfpmath/gfp_element.h b/src/math/gfpmath/gfp_element.h
index 39e728cfa..b168d424a 100644
--- a/src/math/gfpmath/gfp_element.h
+++ b/src/math/gfpmath/gfp_element.h
@@ -14,9 +14,16 @@
#include <botan/bigint.h>
#include <botan/gfp_modulus.h>
-#include <botan/freestore.h>
#include <iostream>
+#if defined(BOTAN_USE_TR1_SHARED_PTR)
+ #include <tr1/memory>
+#elif defined(BOTAN_USE_BOOST_TR1_SHARED_PTR)
+ #include <boost/tr1/memory.hpp>
+#else
+ #error "Please choose a shared_ptr implementation"
+#endif
+
namespace Botan {
struct Illegal_Transformation : public Exception
diff --git a/src/math/gfpmath/info.txt b/src/math/gfpmath/info.txt
index bae2fee60..ab4e440df 100644
--- a/src/math/gfpmath/info.txt
+++ b/src/math/gfpmath/info.txt
@@ -17,5 +17,4 @@ gfp_element.h
gfp_modulus.h
point_gfp.cpp
point_gfp.h
-freestore.h
</add>