diff options
29 files changed, 179 insertions, 124 deletions
diff --git a/src/libs/3rdparty/botan/build/botan/build_unix.h b/src/libs/3rdparty/botan/build/botan/build_unix.h index a49de5d752..6c02f8a73e 100644 --- a/src/libs/3rdparty/botan/build/botan/build_unix.h +++ b/src/libs/3rdparty/botan/build/botan/build_unix.h @@ -36,7 +36,7 @@ #define BOTAN_USE_GCC_INLINE_ASM 0 #endif - +#define BOTAN_USE_QT_SHARED_POINTER #define BOTAN_USE_STD_TR1 /* Module definitions */ diff --git a/src/libs/3rdparty/botan/build/botan/build_windows.h b/src/libs/3rdparty/botan/build/botan/build_windows.h index 8e9bc038b4..ce024f55f9 100644 --- a/src/libs/3rdparty/botan/build/botan/build_windows.h +++ b/src/libs/3rdparty/botan/build/botan/build_windows.h @@ -44,6 +44,8 @@ #define BOTAN_TARGET_OS_IS_WINDOWS #define BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK +#define BOTAN_USE_QT_SHARED_POINTER + /* Module definitions */ #if defined(Q_CC_MINGW) # define BOTAN_USE_STD_TR1 diff --git a/src/libs/3rdparty/botan/build/botan/curve_gfp.h b/src/libs/3rdparty/botan/build/botan/curve_gfp.h index 81cf6ce516..2703605562 100644 --- a/src/libs/3rdparty/botan/build/botan/curve_gfp.h +++ b/src/libs/3rdparty/botan/build/botan/curve_gfp.h @@ -57,7 +57,7 @@ class BOTAN_DLL CurveGFp * @param mod a shared pointer to a GFpModulus object suitable for * *this. */ - void set_shrd_mod(const std::tr1::shared_ptr<GFpModulus> mod); + void set_shrd_mod(const SharedPointer<GFpModulus> mod); // getters @@ -99,14 +99,14 @@ class BOTAN_DLL CurveGFp * function. * @result the GFpElement 1, transformed to its m-residue */ - std::tr1::shared_ptr<GFpElement const> const get_mres_one() const; + SharedPointer<GFpElement const> const get_mres_one() const; /** * Get prime modulus of the field of the curve * @result prime modulus of the field of the curve */ BigInt const get_p() const; - /*inline std::tr1::shared_ptr<BigInt> const get_ptr_p() const + /*inline SharedPointer<BigInt> const get_ptr_p() const { return mp_p; }*/ @@ -119,7 +119,7 @@ class BOTAN_DLL CurveGFp * Do NOT spread pointers to a GFpModulus over different threads! * @result a shared pointer to a GFpModulus object */ - inline std::tr1::shared_ptr<GFpModulus> const get_ptr_mod() const + inline SharedPointer<GFpModulus> const get_ptr_mod() const { return mp_mod; } @@ -131,12 +131,12 @@ class BOTAN_DLL CurveGFp void swap(CurveGFp& other); private: - std::tr1::shared_ptr<GFpModulus> mp_mod; + SharedPointer<GFpModulus> mp_mod; GFpElement mA; GFpElement mB; - mutable std::tr1::shared_ptr<GFpElement> mp_mres_a; - mutable std::tr1::shared_ptr<GFpElement> mp_mres_b; - mutable std::tr1::shared_ptr<GFpElement> mp_mres_one; + mutable SharedPointer<GFpElement> mp_mres_a; + mutable SharedPointer<GFpElement> mp_mres_b; + mutable SharedPointer<GFpElement> mp_mres_one; }; // relational operators diff --git a/src/libs/3rdparty/botan/build/botan/cvc_ado.h b/src/libs/3rdparty/botan/build/botan/cvc_ado.h index 2c4f3ce700..43f0365b45 100644 --- a/src/libs/3rdparty/botan/build/botan/cvc_ado.h +++ b/src/libs/3rdparty/botan/build/botan/cvc_ado.h @@ -39,7 +39,7 @@ class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO> * Construct a CVC ADO request from a data source * @param source the data source */ - EAC1_1_ADO(std::tr1::shared_ptr<DataSource> source); + EAC1_1_ADO(SharedPointer<DataSource> source); /** * Create a signed CVC ADO request from to be signed (TBS) data diff --git a/src/libs/3rdparty/botan/build/botan/cvc_cert.h b/src/libs/3rdparty/botan/build/botan/cvc_cert.h index 17671d3327..cff35c6640 100644 --- a/src/libs/3rdparty/botan/build/botan/cvc_cert.h +++ b/src/libs/3rdparty/botan/build/botan/cvc_cert.h @@ -59,7 +59,7 @@ class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object * Construct a CVC from a data source * @param source the data source */ - EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& source); + EAC1_1_CVC(SharedPointer<DataSource>& source); /** * Construct a CVC from a file diff --git a/src/libs/3rdparty/botan/build/botan/cvc_req.h b/src/libs/3rdparty/botan/build/botan/cvc_req.h index 8599f539d3..8ee1c38c8c 100644 --- a/src/libs/3rdparty/botan/build/botan/cvc_req.h +++ b/src/libs/3rdparty/botan/build/botan/cvc_req.h @@ -12,7 +12,6 @@ #include <botan/x509_key.h> #include <botan/pubkey_enums.h> #include <botan/cvc_gen_cert.h> -#include <botan/cvc_req.h> namespace Botan { @@ -36,7 +35,7 @@ class BOTAN_DLL EAC1_1_Req : public EAC1_1_gen_CVC<EAC1_1_Req> * Construct a CVC request from a data source. * @param source the data source */ - EAC1_1_Req(std::tr1::shared_ptr<DataSource> source); + EAC1_1_Req(SharedPointer<DataSource> source); /** * Construct a CVC request from a DER encoded CVC reqeust file. diff --git a/src/libs/3rdparty/botan/build/botan/ecc_key.h b/src/libs/3rdparty/botan/build/botan/ecc_key.h index 0ca9a0e755..61a2e0ed8b 100644 --- a/src/libs/3rdparty/botan/build/botan/ecc_key.h +++ b/src/libs/3rdparty/botan/build/botan/ecc_key.h @@ -17,6 +17,8 @@ #include <botan/x509_key.h> #include <botan/pkcs8.h> +#include <memory> + namespace Botan { /** diff --git a/src/libs/3rdparty/botan/build/botan/freestore.h b/src/libs/3rdparty/botan/build/botan/freestore.h index f95afa8021..c30892fbef 100644 --- a/src/libs/3rdparty/botan/build/botan/freestore.h +++ b/src/libs/3rdparty/botan/build/botan/freestore.h @@ -7,14 +7,7 @@ #define BOTAN_FREESTORE_H__ #include <botan/build.h> - -#if defined(BOTAN_USE_STD_TR1) - #include <tr1/memory> -#elif defined(BOTAN_USE_BOOST_TR1) - #include <boost/tr1/memory.hpp> -#else - #error "Please choose a TR1 implementation in build.h" -#endif +#include <utils/sharedpointer.h> namespace Botan { @@ -30,7 +23,7 @@ template<typename T> class BOTAN_DLL SharedPtrConverter { public: - typedef std::tr1::shared_ptr<T> SharedPtr; + typedef SharedPointer<T> SharedPtr; /** * Construct a null pointer equivalent object. diff --git a/src/libs/3rdparty/botan/build/botan/gfp_element.h b/src/libs/3rdparty/botan/build/botan/gfp_element.h index 4e0ee985b2..0acabd64cd 100644 --- a/src/libs/3rdparty/botan/build/botan/gfp_element.h +++ b/src/libs/3rdparty/botan/build/botan/gfp_element.h @@ -14,16 +14,9 @@ #include <botan/bigint.h> #include <botan/gfp_modulus.h> +#include <utils/sharedpointer.h> #include <iosfwd> -#if defined(BOTAN_USE_STD_TR1) - #include <tr1/memory> -#elif defined(BOTAN_USE_BOOST_TR1) - #include <boost/tr1/memory.hpp> -#else - #error "Please choose a TR1 implementation in build.h" -#endif - namespace Botan { struct Illegal_Transformation : public Exception @@ -40,7 +33,7 @@ struct Illegal_Transformation : public Exception class BOTAN_DLL GFpElement { private: - std::tr1::shared_ptr<GFpModulus> mp_mod; + SharedPointer<GFpModulus> mp_mod; mutable BigInt m_value; // ordinary residue or m-residue respectively mutable BigInt workspace; @@ -79,7 +72,7 @@ class BOTAN_DLL GFpElement * @param value the element value * @param use_montgm whether this object will use Montgomery multiplication */ - explicit GFpElement(std::tr1::shared_ptr<GFpModulus> const mod, + explicit GFpElement(SharedPointer<GFpModulus> const mod, const BigInt& value, bool use_mongm = false); /** @@ -190,7 +183,7 @@ class BOTAN_DLL GFpElement * the shared GFpModulus objects! * @result the shared pointer to the GFpModulus of *this */ - inline std::tr1::shared_ptr<GFpModulus> const get_ptr_mod() const + inline SharedPointer<GFpModulus> const get_ptr_mod() const { return mp_mod; } @@ -203,7 +196,7 @@ class BOTAN_DLL GFpElement * the shared GFpModulus objects! * @param mod a shared pointer to a GFpModulus that will be held in *this */ - void set_shrd_mod(std::tr1::shared_ptr<GFpModulus> const mod); + void set_shrd_mod(SharedPointer<GFpModulus> const mod); /** * Tells whether this GFpElement is currently transformed to it´ m-residue, diff --git a/src/libs/3rdparty/botan/build/botan/point_gfp.h b/src/libs/3rdparty/botan/build/botan/point_gfp.h index 771605efc4..c0ccd16e84 100644 --- a/src/libs/3rdparty/botan/build/botan/point_gfp.h +++ b/src/libs/3rdparty/botan/build/botan/point_gfp.h @@ -234,7 +234,7 @@ class BOTAN_DLL PointGFp * @param mod a shared pointer to a GFpModulus that will * be held in the members *this */ - void set_shrd_mod(std::tr1::shared_ptr<GFpModulus> p_mod); + void set_shrd_mod(SharedPointer<GFpModulus> p_mod); static GFpElement decompress(bool yMod2, GFpElement const& x, const CurveGFp& curve); @@ -242,9 +242,9 @@ class BOTAN_DLL PointGFp static const u32bit GFPEL_WKSP_SIZE = 9; void ensure_worksp() const; - inline std::tr1::shared_ptr<PointGFp> mult_loop(int l, const BigInt& m, - std::tr1::shared_ptr<PointGFp> H, - std::tr1::shared_ptr<PointGFp> tmp, + inline SharedPointer<PointGFp> mult_loop(int l, const BigInt& m, + SharedPointer<PointGFp> H, + SharedPointer<PointGFp> tmp, const PointGFp& P); CurveGFp mC; @@ -257,7 +257,7 @@ class BOTAN_DLL PointGFp mutable bool mZpow2_set; mutable bool mZpow3_set; mutable bool mAZpow4_set; - mutable std::tr1::shared_ptr<std::vector<GFpElement> > mp_worksp_gfp_el; + mutable SharedPointer<std::vector<GFpElement> > mp_worksp_gfp_el; }; diff --git a/src/libs/3rdparty/botan/checks/ec_tests.cpp b/src/libs/3rdparty/botan/checks/ec_tests.cpp index 2d25e2153b..b88ebe3473 100644 --- a/src/libs/3rdparty/botan/checks/ec_tests.cpp +++ b/src/libs/3rdparty/botan/checks/ec_tests.cpp @@ -80,8 +80,8 @@ void test_point_turn_on_sp_red_mul() CHECK_MESSAGE(r1 == r2, "error with point mul after extra turn on sp red mul"); CHECK(r1.get_affine_x().get_value() != BigInt("0")); - std::tr1::shared_ptr<PointGFp> p_r1(new PointGFp(r1)); - std::tr1::shared_ptr<PointGFp> p_r2(new PointGFp(r2)); + SharedPointer<PointGFp> p_r1(new PointGFp(r1)); + SharedPointer<PointGFp> p_r2(new PointGFp(r2)); p_r1->mult2_in_place(); // wird für Fehler nicht gebraucht p_r2->turn_on_sp_red_mul(); // 1. t_o() macht nur p_r2 kaputt @@ -981,7 +981,7 @@ void test_point_worksp() { EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); - std::tr1::shared_ptr<std::vector<GFpElement> > worksp1; + SharedPointer<std::vector<GFpElement> > worksp1; assert(worksp1.get() == 0); { PointGFp p = dom_pars.get_base_point(); diff --git a/src/libs/3rdparty/botan/checks/gfpmath.cpp b/src/libs/3rdparty/botan/checks/gfpmath.cpp index 2352bba7e8..21f06712dc 100644 --- a/src/libs/3rdparty/botan/checks/gfpmath.cpp +++ b/src/libs/3rdparty/botan/checks/gfpmath.cpp @@ -484,13 +484,13 @@ bool test_gfp_shared_vals() GFpElement a(p, BigInt("234090")); GFpElement shcpy_a(1,0); shcpy_a.share_assign(a); - std::tr1::shared_ptr<GFpModulus> ptr1 = a.get_ptr_mod(); - std::tr1::shared_ptr<GFpModulus> ptr2 = shcpy_a.get_ptr_mod(); + SharedPointer<GFpModulus> ptr1 = a.get_ptr_mod(); + SharedPointer<GFpModulus> ptr2 = shcpy_a.get_ptr_mod(); CHECK_MESSAGE(ptr1.get() == ptr2.get(), "shared pointers for moduli aren´t equal"); GFpElement b(1,0); b = a; // create a non shared copy - std::tr1::shared_ptr<GFpModulus> ptr_b_p = b.get_ptr_mod(); + SharedPointer<GFpModulus> ptr_b_p = b.get_ptr_mod(); CHECK_MESSAGE(ptr1.get() != ptr_b_p.get(), "non shared pointers for moduli are equal"); a.turn_on_sp_red_mul(); @@ -513,15 +513,15 @@ bool test_gfp_shared_vals() } swap(a,shcpy_a); - std::tr1::shared_ptr<GFpModulus> ptr3 = a.get_ptr_mod(); - std::tr1::shared_ptr<GFpModulus> ptr4 = shcpy_a.get_ptr_mod(); + SharedPointer<GFpModulus> ptr3 = a.get_ptr_mod(); + SharedPointer<GFpModulus> ptr4 = shcpy_a.get_ptr_mod(); CHECK_MESSAGE(ptr3.get() == ptr4.get(), "shared pointers for moduli aren´t equal after swap"); CHECK(ptr1.get() == ptr4.get()); CHECK(ptr2.get() == ptr3.get()); swap(a,b); - std::tr1::shared_ptr<GFpModulus> ptr_a = a.get_ptr_mod(); - std::tr1::shared_ptr<GFpModulus> ptr_b = shcpy_a.get_ptr_mod(); + SharedPointer<GFpModulus> ptr_a = a.get_ptr_mod(); + SharedPointer<GFpModulus> ptr_b = shcpy_a.get_ptr_mod(); CHECK(ptr_a.get() == ptr_b_p.get()); CHECK(ptr_b.get() == ptr3.get()); return pass; diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.cpp b/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.cpp index 6e1484e90b..097132f150 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.cpp +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.cpp @@ -12,7 +12,7 @@ namespace Botan { -EAC1_1_ADO::EAC1_1_ADO(std::tr1::shared_ptr<DataSource> in) +EAC1_1_ADO::EAC1_1_ADO(SharedPointer<DataSource> in) { init(in); do_decode(); @@ -20,7 +20,7 @@ EAC1_1_ADO::EAC1_1_ADO(std::tr1::shared_ptr<DataSource> in) EAC1_1_ADO::EAC1_1_ADO(const std::string& in) { - std::tr1::shared_ptr<DataSource> stream(new DataSource_Stream(in, true)); + SharedPointer<DataSource> stream(new DataSource_Stream(in, true)); init(stream); do_decode(); } @@ -41,7 +41,7 @@ void EAC1_1_ADO::force_decode() .end_cons() .get_contents(); - std::tr1::shared_ptr<DataSource> req_source(new DataSource_Memory(req_bits)); + SharedPointer<DataSource> req_source(new DataSource_Memory(req_bits)); m_req = EAC1_1_Req(req_source); sig_algo = m_req.sig_algo; } diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.h b/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.h index 2c4f3ce700..43f0365b45 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.h +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_ado.h @@ -39,7 +39,7 @@ class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO> * Construct a CVC ADO request from a data source * @param source the data source */ - EAC1_1_ADO(std::tr1::shared_ptr<DataSource> source); + EAC1_1_ADO(SharedPointer<DataSource> source); /** * Create a signed CVC ADO request from to be signed (TBS) data diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_ca.cpp b/src/libs/3rdparty/botan/src/cert/cvc/cvc_ca.cpp index 638d3f984c..097bcfb58a 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_ca.cpp +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_ca.cpp @@ -38,7 +38,7 @@ EAC1_1_CVC EAC1_1_CVC_CA::make_cert(std::auto_ptr<PK_Signer> signer, EAC1_1_CVC::build_cert_body(tbs), rng); - std::tr1::shared_ptr<DataSource> source(new DataSource_Memory(signed_cert)); + SharedPointer<DataSource> source(new DataSource_Memory(signed_cert)); return EAC1_1_CVC(source); } diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.cpp b/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.cpp index d2be12df8e..fb17e72467 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.cpp +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.cpp @@ -78,7 +78,7 @@ void EAC1_1_CVC::force_decode() /* * CVC Certificate Constructor */ -EAC1_1_CVC::EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& in) +EAC1_1_CVC::EAC1_1_CVC(SharedPointer<DataSource>& in) { init(in); self_signed = false; @@ -87,7 +87,7 @@ EAC1_1_CVC::EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& in) EAC1_1_CVC::EAC1_1_CVC(const std::string& in) { - std::tr1::shared_ptr<DataSource> stream(new DataSource_Stream(in, true)); + SharedPointer<DataSource> stream(new DataSource_Stream(in, true)); init(stream); self_signed = false; do_decode(); diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.h b/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.h index 17671d3327..cff35c6640 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.h +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_cert.h @@ -59,7 +59,7 @@ class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object * Construct a CVC from a data source * @param source the data source */ - EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& source); + EAC1_1_CVC(SharedPointer<DataSource>& source); /** * Construct a CVC from a file diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.cpp b/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.cpp index 70a44bacd7..248eb2258e 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.cpp +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.cpp @@ -50,7 +50,7 @@ void EAC1_1_Req::force_decode() #endif } -EAC1_1_Req::EAC1_1_Req(std::tr1::shared_ptr<DataSource> in) +EAC1_1_Req::EAC1_1_Req(SharedPointer<DataSource> in) { init(in); self_signed = true; @@ -59,7 +59,7 @@ EAC1_1_Req::EAC1_1_Req(std::tr1::shared_ptr<DataSource> in) EAC1_1_Req::EAC1_1_Req(const std::string& in) { - std::tr1::shared_ptr<DataSource> stream(new DataSource_Stream(in, true)); + SharedPointer<DataSource> stream(new DataSource_Stream(in, true)); init(stream); self_signed = true; do_decode(); diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.h b/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.h index 96b6a44f9f..8ee1c38c8c 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.h +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_req.h @@ -35,7 +35,7 @@ class BOTAN_DLL EAC1_1_Req : public EAC1_1_gen_CVC<EAC1_1_Req> * Construct a CVC request from a data source. * @param source the data source */ - EAC1_1_Req(std::tr1::shared_ptr<DataSource> source); + EAC1_1_Req(SharedPointer<DataSource> source); /** * Construct a CVC request from a DER encoded CVC reqeust file. diff --git a/src/libs/3rdparty/botan/src/cert/cvc/cvc_self.cpp b/src/libs/3rdparty/botan/src/cert/cvc/cvc_self.cpp index 91ea387246..cc1c3fff4c 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/cvc_self.cpp +++ b/src/libs/3rdparty/botan/src/cert/cvc/cvc_self.cpp @@ -131,7 +131,7 @@ EAC1_1_Req create_cvc_req(Private_Key const& key, .get_contents(); MemoryVector<byte> signed_cert = EAC1_1_gen_CVC<EAC1_1_Req>::make_signed(signer, EAC1_1_gen_CVC<EAC1_1_Req>::build_cert_body(tbs), rng); - std::tr1::shared_ptr<DataSource> source(new DataSource_Memory(signed_cert)); + SharedPointer<DataSource> source(new DataSource_Memory(signed_cert)); return EAC1_1_Req(source); } @@ -151,7 +151,7 @@ EAC1_1_ADO create_ado_req(Private_Key const& key, SecureVector<byte> tbs_bits = req.BER_encode(); tbs_bits.append(DER_Encoder().encode(car).get_contents()); MemoryVector<byte> signed_cert = EAC1_1_ADO::make_signed(signer, tbs_bits, rng); - std::tr1::shared_ptr<DataSource> source(new DataSource_Memory(signed_cert)); + SharedPointer<DataSource> source(new DataSource_Memory(signed_cert)); return EAC1_1_ADO(source); } diff --git a/src/libs/3rdparty/botan/src/cert/cvc/freestore.h b/src/libs/3rdparty/botan/src/cert/cvc/freestore.h index f95afa8021..c30892fbef 100644 --- a/src/libs/3rdparty/botan/src/cert/cvc/freestore.h +++ b/src/libs/3rdparty/botan/src/cert/cvc/freestore.h @@ -7,14 +7,7 @@ #define BOTAN_FREESTORE_H__ #include <botan/build.h> - -#if defined(BOTAN_USE_STD_TR1) - #include <tr1/memory> -#elif defined(BOTAN_USE_BOOST_TR1) - #include <boost/tr1/memory.hpp> -#else - #error "Please choose a TR1 implementation in build.h" -#endif +#include <utils/sharedpointer.h> namespace Botan { @@ -30,7 +23,7 @@ template<typename T> class BOTAN_DLL SharedPtrConverter { public: - typedef std::tr1::shared_ptr<T> SharedPtr; + typedef SharedPointer<T> SharedPtr; /** * Construct a null pointer equivalent object. diff --git a/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.cpp b/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.cpp index e12ade0812..2ac98eaa52 100644 --- a/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.cpp +++ b/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.cpp @@ -14,7 +14,7 @@ namespace Botan { -void CurveGFp::set_shrd_mod(const std::tr1::shared_ptr<GFpModulus> mod) +void CurveGFp::set_shrd_mod(const SharedPointer<GFpModulus> mod) { mp_mod = mod; mA.turn_off_sp_red_mul();// m.m. is not needed, must be trf. back @@ -34,7 +34,7 @@ CurveGFp::CurveGFp(const GFpElement& a, const GFpElement& b, { throw Invalid_Argument("could not construct curve: moduli of arguments differ"); } - std::tr1::shared_ptr<GFpModulus> p_mod = std::tr1::shared_ptr<GFpModulus>(new GFpModulus(p)); + SharedPointer<GFpModulus> p_mod = SharedPointer<GFpModulus>(new GFpModulus(p)); // the above is the creation of the GFpModuls object which will be shared point-wide // (in the context of a point of course) set_shrd_mod(p_mod); @@ -44,21 +44,21 @@ CurveGFp::CurveGFp(const CurveGFp& other) : mA(other.get_a()), mB(other.get_b()) { - mp_mod = std::tr1::shared_ptr<GFpModulus>(new GFpModulus(*other.mp_mod)); + mp_mod = SharedPointer<GFpModulus>(new GFpModulus(*other.mp_mod)); assert(mp_mod->p_equal_to(mA.get_p())); assert(mp_mod->p_equal_to(mB.get_p())); set_shrd_mod(mp_mod); if(other.mp_mres_a.get()) { - mp_mres_a = std::tr1::shared_ptr<GFpElement>(new GFpElement(*other.mp_mres_a)); + mp_mres_a = SharedPointer<GFpElement>(new GFpElement(*other.mp_mres_a)); } if(other.mp_mres_b.get()) { - mp_mres_b = std::tr1::shared_ptr<GFpElement>(new GFpElement(*other.mp_mres_b)); + mp_mres_b = SharedPointer<GFpElement>(new GFpElement(*other.mp_mres_b)); } if(other.mp_mres_one.get()) { - mp_mres_one = std::tr1::shared_ptr<GFpElement>(new GFpElement(*other.mp_mres_one)); + mp_mres_one = SharedPointer<GFpElement>(new GFpElement(*other.mp_mres_one)); } } @@ -72,21 +72,21 @@ const CurveGFp& CurveGFp::operator=(const CurveGFp& other) mA.swap(a_tmp); mB.swap(b_tmp); - std::tr1::shared_ptr<GFpModulus> p_mod = std::tr1::shared_ptr<GFpModulus>(new GFpModulus(*other.mp_mod)); + SharedPointer<GFpModulus> p_mod = SharedPointer<GFpModulus>(new GFpModulus(*other.mp_mod)); set_shrd_mod(p_mod); // exception safety note: no problem if we have a throw from here on... if(other.mp_mres_a.get()) { - mp_mres_a = std::tr1::shared_ptr<GFpElement>(new GFpElement(*other.mp_mres_a)); + mp_mres_a = SharedPointer<GFpElement>(new GFpElement(*other.mp_mres_a)); } if(other.mp_mres_b.get()) { - mp_mres_b = std::tr1::shared_ptr<GFpElement>(new GFpElement(*other.mp_mres_b)); + mp_mres_b = SharedPointer<GFpElement>(new GFpElement(*other.mp_mres_b)); } if(other.mp_mres_one.get()) { - mp_mres_one = std::tr1::shared_ptr<GFpElement>(new GFpElement(*other.mp_mres_one)); + mp_mres_one = SharedPointer<GFpElement>(new GFpElement(*other.mp_mres_one)); } return *this; } @@ -123,7 +123,7 @@ GFpElement const CurveGFp::get_mres_a() const { if(mp_mres_a.get() == 0) { - mp_mres_a = std::tr1::shared_ptr<GFpElement>(new GFpElement(mA)); + mp_mres_a = SharedPointer<GFpElement>(new GFpElement(mA)); mp_mres_a->turn_on_sp_red_mul(); mp_mres_a->get_mres(); } @@ -134,18 +134,18 @@ GFpElement const CurveGFp::get_mres_b() const { if(mp_mres_b.get() == 0) { - mp_mres_b = std::tr1::shared_ptr<GFpElement>(new GFpElement(mB)); + mp_mres_b = SharedPointer<GFpElement>(new GFpElement(mB)); mp_mres_b->turn_on_sp_red_mul(); mp_mres_b->get_mres(); } return GFpElement(*mp_mres_b); } -std::tr1::shared_ptr<GFpElement const> const CurveGFp::get_mres_one() const +SharedPointer<GFpElement const> const CurveGFp::get_mres_one() const { if(mp_mres_one.get() == 0) { - mp_mres_one = std::tr1::shared_ptr<GFpElement>(new GFpElement(mp_mod->get_p(), 1)); + mp_mres_one = SharedPointer<GFpElement>(new GFpElement(mp_mod->get_p(), 1)); mp_mres_one->turn_on_sp_red_mul(); mp_mres_one->get_mres(); } diff --git a/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.h b/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.h index 81cf6ce516..2703605562 100644 --- a/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.h +++ b/src/libs/3rdparty/botan/src/math/gfpmath/curve_gfp.h @@ -57,7 +57,7 @@ class BOTAN_DLL CurveGFp * @param mod a shared pointer to a GFpModulus object suitable for * *this. */ - void set_shrd_mod(const std::tr1::shared_ptr<GFpModulus> mod); + void set_shrd_mod(const SharedPointer<GFpModulus> mod); // getters @@ -99,14 +99,14 @@ class BOTAN_DLL CurveGFp * function. * @result the GFpElement 1, transformed to its m-residue */ - std::tr1::shared_ptr<GFpElement const> const get_mres_one() const; + SharedPointer<GFpElement const> const get_mres_one() const; /** * Get prime modulus of the field of the curve * @result prime modulus of the field of the curve */ BigInt const get_p() const; - /*inline std::tr1::shared_ptr<BigInt> const get_ptr_p() const + /*inline SharedPointer<BigInt> const get_ptr_p() const { return mp_p; }*/ @@ -119,7 +119,7 @@ class BOTAN_DLL CurveGFp * Do NOT spread pointers to a GFpModulus over different threads! * @result a shared pointer to a GFpModulus object */ - inline std::tr1::shared_ptr<GFpModulus> const get_ptr_mod() const + inline SharedPointer<GFpModulus> const get_ptr_mod() const { return mp_mod; } @@ -131,12 +131,12 @@ class BOTAN_DLL CurveGFp void swap(CurveGFp& other); private: - std::tr1::shared_ptr<GFpModulus> mp_mod; + SharedPointer<GFpModulus> mp_mod; GFpElement mA; GFpElement mB; - mutable std::tr1::shared_ptr<GFpElement> mp_mres_a; - mutable std::tr1::shared_ptr<GFpElement> mp_mres_b; - mutable std::tr1::shared_ptr<GFpElement> mp_mres_one; + mutable SharedPointer<GFpElement> mp_mres_a; + mutable SharedPointer<GFpElement> mp_mres_b; + mutable SharedPointer<GFpElement> mp_mres_one; }; // relational operators diff --git a/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.cpp b/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.cpp index b718093019..b7960808c7 100644 --- a/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.cpp +++ b/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.cpp @@ -174,13 +174,13 @@ GFpElement::GFpElement(const BigInt& p, const BigInt& value, bool use_montgm) m_is_trf(false) { assert(mp_mod.get() == 0); - mp_mod = std::tr1::shared_ptr<GFpModulus>(new GFpModulus(p)); + mp_mod = SharedPointer<GFpModulus>(new GFpModulus(p)); assert(mp_mod->m_p_dash == 0); if(m_use_montgm) ensure_montgm_precomp(); } -GFpElement::GFpElement(std::tr1::shared_ptr<GFpModulus> const mod, const BigInt& value, bool use_montgm) +GFpElement::GFpElement(SharedPointer<GFpModulus> const mod, const BigInt& value, bool use_montgm) : mp_mod(), m_value(value % mod->m_p), m_use_montgm(use_montgm), @@ -247,7 +247,7 @@ void GFpElement::ensure_montgm_precomp() const } -void GFpElement::set_shrd_mod(std::tr1::shared_ptr<GFpModulus> const p_mod) +void GFpElement::set_shrd_mod(SharedPointer<GFpModulus> const p_mod) { mp_mod = p_mod; } diff --git a/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.h b/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.h index 4e0ee985b2..0acabd64cd 100644 --- a/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.h +++ b/src/libs/3rdparty/botan/src/math/gfpmath/gfp_element.h @@ -14,16 +14,9 @@ #include <botan/bigint.h> #include <botan/gfp_modulus.h> +#include <utils/sharedpointer.h> #include <iosfwd> -#if defined(BOTAN_USE_STD_TR1) - #include <tr1/memory> -#elif defined(BOTAN_USE_BOOST_TR1) - #include <boost/tr1/memory.hpp> -#else - #error "Please choose a TR1 implementation in build.h" -#endif - namespace Botan { struct Illegal_Transformation : public Exception @@ -40,7 +33,7 @@ struct Illegal_Transformation : public Exception class BOTAN_DLL GFpElement { private: - std::tr1::shared_ptr<GFpModulus> mp_mod; + SharedPointer<GFpModulus> mp_mod; mutable BigInt m_value; // ordinary residue or m-residue respectively mutable BigInt workspace; @@ -79,7 +72,7 @@ class BOTAN_DLL GFpElement * @param value the element value * @param use_montgm whether this object will use Montgomery multiplication */ - explicit GFpElement(std::tr1::shared_ptr<GFpModulus> const mod, + explicit GFpElement(SharedPointer<GFpModulus> const mod, const BigInt& value, bool use_mongm = false); /** @@ -190,7 +183,7 @@ class BOTAN_DLL GFpElement * the shared GFpModulus objects! * @result the shared pointer to the GFpModulus of *this */ - inline std::tr1::shared_ptr<GFpModulus> const get_ptr_mod() const + inline SharedPointer<GFpModulus> const get_ptr_mod() const { return mp_mod; } @@ -203,7 +196,7 @@ class BOTAN_DLL GFpElement * the shared GFpModulus objects! * @param mod a shared pointer to a GFpModulus that will be held in *this */ - void set_shrd_mod(std::tr1::shared_ptr<GFpModulus> const mod); + void set_shrd_mod(SharedPointer<GFpModulus> const mod); /** * Tells whether this GFpElement is currently transformed to it´ m-residue, diff --git a/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.cpp b/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.cpp index 9139c3ef93..04d63aed09 100644 --- a/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.cpp +++ b/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.cpp @@ -109,7 +109,7 @@ const PointGFp& PointGFp::assign_within_same_curve(PointGFp const& other) return *this; } -void PointGFp::set_shrd_mod(std::tr1::shared_ptr<GFpModulus> p_mod) +void PointGFp::set_shrd_mod(SharedPointer<GFpModulus> p_mod) { mX.set_shrd_mod(p_mod); mY.set_shrd_mod(p_mod); @@ -133,7 +133,7 @@ void PointGFp::ensure_worksp() const } } - mp_worksp_gfp_el = std::tr1::shared_ptr<std::vector<GFpElement> >(new std::vector<GFpElement>); + mp_worksp_gfp_el = SharedPointer<std::vector<GFpElement> >(new std::vector<GFpElement>); mp_worksp_gfp_el->reserve(9); for (u32bit i=0; i<GFPEL_WKSP_SIZE; i++) { @@ -337,8 +337,8 @@ PointGFp& PointGFp::mult_this_secure(const BigInt& scalar, // use montgomery mult. in this operation this->turn_on_sp_red_mul(); - std::tr1::shared_ptr<PointGFp> H(new PointGFp(this->mC)); - std::tr1::shared_ptr<PointGFp> tmp; // used for AADA + SharedPointer<PointGFp> H(new PointGFp(this->mC)); + SharedPointer<PointGFp> tmp; // used for AADA PointGFp P(*this); BigInt m(scalar); @@ -477,15 +477,15 @@ PointGFp& PointGFp::operator*=(const BigInt& scalar) return *this; } -inline std::tr1::shared_ptr<PointGFp> PointGFp::mult_loop(int l, - const BigInt& m, - std::tr1::shared_ptr<PointGFp> H, - std::tr1::shared_ptr<PointGFp> tmp, - const PointGFp& P) +inline SharedPointer<PointGFp> PointGFp::mult_loop(int l, + const BigInt& m, + SharedPointer<PointGFp> H, + SharedPointer<PointGFp> tmp, + const PointGFp& P) { //assert(l >= (int)m.bits()- 1); tmp = H; - std::tr1::shared_ptr<PointGFp> to_add(new PointGFp(P)); // we just need some point + SharedPointer<PointGFp> to_add(new PointGFp(P)); // we just need some point // so that we can use op= // inside the loop for (int i=l; i >=0; i--) diff --git a/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.h b/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.h index 771605efc4..c0ccd16e84 100644 --- a/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.h +++ b/src/libs/3rdparty/botan/src/math/gfpmath/point_gfp.h @@ -234,7 +234,7 @@ class BOTAN_DLL PointGFp * @param mod a shared pointer to a GFpModulus that will * be held in the members *this */ - void set_shrd_mod(std::tr1::shared_ptr<GFpModulus> p_mod); + void set_shrd_mod(SharedPointer<GFpModulus> p_mod); static GFpElement decompress(bool yMod2, GFpElement const& x, const CurveGFp& curve); @@ -242,9 +242,9 @@ class BOTAN_DLL PointGFp static const u32bit GFPEL_WKSP_SIZE = 9; void ensure_worksp() const; - inline std::tr1::shared_ptr<PointGFp> mult_loop(int l, const BigInt& m, - std::tr1::shared_ptr<PointGFp> H, - std::tr1::shared_ptr<PointGFp> tmp, + inline SharedPointer<PointGFp> mult_loop(int l, const BigInt& m, + SharedPointer<PointGFp> H, + SharedPointer<PointGFp> tmp, const PointGFp& P); CurveGFp mC; @@ -257,7 +257,7 @@ class BOTAN_DLL PointGFp mutable bool mZpow2_set; mutable bool mZpow3_set; mutable bool mAZpow4_set; - mutable std::tr1::shared_ptr<std::vector<GFpElement> > mp_worksp_gfp_el; + mutable SharedPointer<std::vector<GFpElement> > mp_worksp_gfp_el; }; diff --git a/src/libs/3rdparty/botan/src/src.pro b/src/libs/3rdparty/botan/src/src.pro index 08de10e871..4c02a4fb07 100644 --- a/src/libs/3rdparty/botan/src/src.pro +++ b/src/libs/3rdparty/botan/src/src.pro @@ -235,7 +235,8 @@ HEADERS += algo_factory/algo_cache.h \ utils/ui.h \ utils/util.h \ utils/version.h \ - utils/xor_buf.h + utils/xor_buf.h \ + utils/sharedpointer.h win32 { HEADERS += entropy/cryptoapi_rng/es_capi.h \ diff --git a/src/libs/3rdparty/botan/src/utils/sharedpointer.h b/src/libs/3rdparty/botan/src/utils/sharedpointer.h new file mode 100644 index 0000000000..b4ef9b1c7a --- /dev/null +++ b/src/libs/3rdparty/botan/src/utils/sharedpointer.h @@ -0,0 +1,79 @@ +#ifndef SHAREDPOINTER_H +#define SHAREDPOINTER_H + +#include <botan/build.h> + +#ifdef BOTAN_USE_QT_SHARED_POINTER + #include <QtCore/QSharedPointer> +#elif defined(BOTAN_USE_STD_TR1) + #include <tr1/memory> +#elif defined(BOTAN_USE_BOOST_TR1) + #include <boost/tr1/memory.hpp> +#else + #error "Please choose a TR1 implementation in build.h" +#endif + +namespace Botan { + +template <typename T> class SharedPointer +{ +public: +#ifdef BOTAN_USE_QT_SHARED_POINTER + typedef QSharedPointer<T> Ptr; +#else + typedef std::tr1::shared_ptr<T> Ptr; +#endif + + SharedPointer() {} + SharedPointer(T *rawPtr) : m_ptr(rawPtr) {} + template<typename X> SharedPointer(const SharedPointer<X> &other) + : m_ptr(other.internalPtr()) {} + template<typename X> SharedPointer<T> &operator=(const SharedPointer<X> &other) + { + m_ptr = other.internalPtr(); + return *this; + } + + const Ptr &internalPtr() const { return m_ptr; } + + T *get() const + { +#ifdef BOTAN_USE_QT_SHARED_POINTER + return m_ptr.data(); +#else + return m_ptr.get(); +#endif + } + + void reset(T *rawPtr) + { +#ifdef BOTAN_USE_QT_SHARED_POINTER + m_ptr = QSharedPointer<T>(rawPtr); +#else + m_ptr.reset(rawPtr); +#endif + } + + T &operator* () const { return *m_ptr; } + T *operator-> () const { return m_ptr.operator->(); } + void swap(SharedPointer<T> &other) { m_ptr.swap(other.m_ptr); } + +private: + Ptr m_ptr; +}; + +template <typename X, typename Y> +inline bool operator==(const SharedPointer<X> & ptr1, const SharedPointer<Y> & ptr2) +{ + return ptr1.get() == ptr2.get(); +} + +template <typename X, typename Y> +inline bool operator!=(const SharedPointer<X> & ptr1, const SharedPointer<Y> & ptr2) +{ + return !(ptr1 == ptr2); +} + +} // namespace Botan + +#endif // SHAREDPOINTER_H |