diff options
author | lloyd <[email protected]> | 2008-10-08 02:46:57 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-08 02:46:57 +0000 |
commit | ebfb6a6e9150820aa7e783f97bd5e0ac302adfbe (patch) | |
tree | cbdf8f8f7f223e59858d5024052a2fac1ea5b3dd /src | |
parent | b46e73584275ce8dcf3114d124c82e92730d0dbc (diff) |
Reformatting
Diffstat (limited to 'src')
-rw-r--r-- | src/math/gfpmath/curve_gfp.h | 6 | ||||
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.h | 4 | ||||
-rw-r--r-- | src/pubkey/ecdsa/ecdsa.h | 8 | ||||
-rw-r--r-- | src/pubkey/ecdsa/ecdsa_op.cpp | 2 | ||||
-rw-r--r-- | src/pubkey/eckaeg/eckaeg.h | 44 |
5 files changed, 34 insertions, 30 deletions
diff --git a/src/math/gfpmath/curve_gfp.h b/src/math/gfpmath/curve_gfp.h index 49688b5dc..3024c32d8 100644 --- a/src/math/gfpmath/curve_gfp.h +++ b/src/math/gfpmath/curve_gfp.h @@ -54,7 +54,7 @@ class CurveGFp * @param mod a shared pointer to a GFpModulus object suitable for * *this. */ - void set_shrd_mod(std::tr1::shared_ptr<Botan::GFpModulus> const mod); + void set_shrd_mod(std::tr1::shared_ptr<GFpModulus> const mod); // getters @@ -116,7 +116,7 @@ class CurveGFp * Do NOT spread pointers to a GFpModulus over different threads! * @result a shared pointer to a GFpModulus object */ - inline std::tr1::shared_ptr<Botan::GFpModulus> const get_ptr_mod() const + inline std::tr1::shared_ptr<GFpModulus> const get_ptr_mod() const { return mp_mod; } @@ -128,7 +128,7 @@ class CurveGFp void swap(CurveGFp& other); private: - std::tr1::shared_ptr<Botan::GFpModulus> mp_mod; + std::tr1::shared_ptr<GFpModulus> mp_mod; GFpElement mA; GFpElement mB; mutable std::tr1::shared_ptr<GFpElement> mp_mres_a; diff --git a/src/pubkey/ecc_key/ecc_key.h b/src/pubkey/ecc_key/ecc_key.h index 89fd5e7f1..d884b3d95 100644 --- a/src/pubkey/ecc_key/ecc_key.h +++ b/src/pubkey/ecc_key/ecc_key.h @@ -43,7 +43,7 @@ class EC_PublicKey : public virtual Public_Key * domain parameters of this point are not set * @result the public point of this key */ - inline Botan::PointGFp get_public_point() const + inline PointGFp get_public_point() const { if (!mp_public_point.get()) { @@ -109,7 +109,7 @@ class EC_PublicKey : public virtual Public_Key SecureVector<byte> m_enc_public_point; // stores the public point std::auto_ptr<EC_Domain_Params> mp_dom_pars; - std::auto_ptr<Botan::PointGFp> mp_public_point; + std::auto_ptr<PointGFp> mp_public_point; EC_dompar_enc m_param_enc; }; diff --git a/src/pubkey/ecdsa/ecdsa.h b/src/pubkey/ecdsa/ecdsa.h index 4b7e7b5b3..9c7492a13 100644 --- a/src/pubkey/ecdsa/ecdsa.h +++ b/src/pubkey/ecdsa/ecdsa.h @@ -59,8 +59,8 @@ class ECDSA_PublicKey : public virtual EC_PublicKey, * @param dom_par the domain parameters associated with this key * @param public_point the public point defining this key */ - ECDSA_PublicKey(EC_Domain_Params const& dom_par, Botan::PointGFp const& public_point); // sets core - + ECDSA_PublicKey(const EC_Domain_Params& dom_par, + const PointGFp& public_point); // sets core ECDSA_PublicKey const& operator= (ECDSA_PublicKey const& rhs); @@ -104,8 +104,8 @@ class ECDSA_PrivateKey : public ECDSA_PublicKey, * Default constructor. Use this one if you want to later fill this object with data * from an encoded key. */ - ECDSA_PrivateKey() - {} + ECDSA_PrivateKey() {} + /** * Generate a new private key * @param the domain parameters to used for this key diff --git a/src/pubkey/ecdsa/ecdsa_op.cpp b/src/pubkey/ecdsa/ecdsa_op.cpp index 58f00cb4b..21643bb5c 100644 --- a/src/pubkey/ecdsa/ecdsa_op.cpp +++ b/src/pubkey/ecdsa/ecdsa_op.cpp @@ -79,7 +79,7 @@ SecureVector<byte> Default_ECDSA_Op::sign(const byte message[], // where x is a random integer #ifdef CMS_RAND - BigInt x = Botan::random_integer(0, n); + BigInt x = BigInt::random_integer(0, n); BigInt s = m_priv_key + x; // obscure the secret from the beginning // all following operations thus are randomized s *= r; diff --git a/src/pubkey/eckaeg/eckaeg.h b/src/pubkey/eckaeg/eckaeg.h index 024f44eda..b7cc10df9 100644 --- a/src/pubkey/eckaeg/eckaeg.h +++ b/src/pubkey/eckaeg/eckaeg.h @@ -19,27 +19,27 @@ namespace Botan { class ECKAEG_PublicKey : public virtual EC_PublicKey { public: + /** - * Default constructor. Use this one if you want to later fill this object with data - * from an encoded key. + * Default constructor. Use this one if you want to later fill + * this object with data from an encoded key. */ - ECKAEG_PublicKey() - {}; + ECKAEG_PublicKey() {}; + /** * Construct a public key from a given public point. * @param dom_par the domain parameters associated with this key * @param public_point the public point defining this key */ - ECKAEG_PublicKey(EC_Domain_Params const& dom_par, Botan::PointGFp const& public_point); + ECKAEG_PublicKey(const EC_Domain_Params& dom_par, + const PointGFp& public_point); /** * Get this keys algorithm name. * @result this keys algorithm name */ - std::string algo_name() const - { - return "ECKAEG"; - } + std::string algo_name() const { return "ECKAEG"; } + /** * Get the maximum number of bits allowed to be fed to this key. * This is the bitlength of the order of the base point. @@ -48,24 +48,25 @@ class ECKAEG_PublicKey : public virtual EC_PublicKey */ u32bit max_input_bits() const { - if (!mp_dom_pars.get()) - { + if(!mp_dom_pars.get()) throw Invalid_State("ECKAEG_PublicKey::max_input_bits(): domain parameters not set"); - } + return mp_dom_pars->get_order().bits(); } + ECKAEG_PublicKey(ECKAEG_PublicKey const& other); ECKAEG_PublicKey const& operator= (ECKAEG_PublicKey const& rhs); - /** - * Make sure that the public point and domain parameters of this key are set. + * Make sure that the public point and domain parameters of this + * key are set. * @throw Invalid_State if either of the two data members is not set */ virtual void affirm_init() const; + protected: void X509_load_hook(); - virtual void set_all_values ( ECKAEG_PublicKey const& other ); + virtual void set_all_values(const ECKAEG_PublicKey& other); ECKAEG_Core m_eckaeg_core; }; @@ -73,27 +74,30 @@ class ECKAEG_PublicKey : public virtual EC_PublicKey /** * This class represents ECKAEG Private Keys. */ -class ECKAEG_PrivateKey : public ECKAEG_PublicKey, public EC_PrivateKey, public PK_Key_Agreement_Key +class ECKAEG_PrivateKey : public ECKAEG_PublicKey, + public EC_PrivateKey, + public PK_Key_Agreement_Key { public: + /** * Generate a new private key * @param the domain parameters to used for this key */ ECKAEG_PrivateKey(RandomNumberGenerator& rng, - EC_Domain_Params const& dom_pars) + const EC_Domain_Params& dom_pars) { mp_dom_pars = std::auto_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_pars)); generate_private_key(rng); mp_public_point->check_invariants(); m_eckaeg_core = ECKAEG_Core(*mp_dom_pars, m_private_value, *mp_public_point); } + /** * Default constructor. Use this one if you want to later fill this object with data * from an encoded key. */ - ECKAEG_PrivateKey() - {} + ECKAEG_PrivateKey() {} ECKAEG_PrivateKey(ECKAEG_PrivateKey const& other); ECKAEG_PrivateKey const& operator= (ECKAEG_PrivateKey const& rhs); @@ -114,7 +118,7 @@ class ECKAEG_PrivateKey : public ECKAEG_PublicKey, public EC_PrivateKey, public virtual void affirm_init() const; protected: - virtual void set_all_values ( ECKAEG_PrivateKey const& other ); + virtual void set_all_values(const ECKAEG_PrivateKey& other); }; } |