diff options
author | lloyd <[email protected]> | 2010-02-23 19:33:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-02-23 19:33:39 +0000 |
commit | 31b12b7756094231672555604550e51eecaeb04c (patch) | |
tree | 094c5ce9358a64a6aca2b9e276a1418f9d47e43f /src/math | |
parent | 848fcbccec00ba0ce0f6bca7a4c6e3873b653362 (diff) |
in GFpElement remove some mutables and de-const membmer funcs as necessary
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/gfpmath/gfp_element.cpp | 10 | ||||
-rw-r--r-- | src/math/gfpmath/gfp_element.h | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/math/gfpmath/gfp_element.cpp b/src/math/gfpmath/gfp_element.cpp index 7e660213e..863135491 100644 --- a/src/math/gfpmath/gfp_element.cpp +++ b/src/math/gfpmath/gfp_element.cpp @@ -165,20 +165,20 @@ BigInt montg_trf_to_ordres(const BigInt& m_res, const BigInt& m, const BigInt& r } -GFpElement::GFpElement(const BigInt& p, const BigInt& value, bool use_montgm) - : modulus(p), m_value(value %p), m_use_montgm(use_montgm), m_is_trf(false) +GFpElement::GFpElement(const BigInt& p, const BigInt& value, bool use_montgomery) + : modulus(p), m_value(value %p), m_use_montgm(use_montgomery), m_is_trf(false) { if(m_use_montgm) ensure_montgm_precomp(); } -void GFpElement::turn_on_sp_red_mul() const +void GFpElement::turn_on_sp_red_mul() { ensure_montgm_precomp(); m_use_montgm = true; } -void GFpElement::turn_off_sp_red_mul() const +void GFpElement::turn_off_sp_red_mul() { if(m_is_trf) { @@ -189,7 +189,7 @@ void GFpElement::turn_off_sp_red_mul() const m_use_montgm = false; } -void GFpElement::ensure_montgm_precomp() const +void GFpElement::ensure_montgm_precomp() { if((!modulus.get_r().is_zero()) && (!modulus.get_r_inv().is_zero()) && (!modulus.get_p_dash().is_zero())) { diff --git a/src/math/gfpmath/gfp_element.h b/src/math/gfpmath/gfp_element.h index fd76516b5..9d2523591 100644 --- a/src/math/gfpmath/gfp_element.h +++ b/src/math/gfpmath/gfp_element.h @@ -38,7 +38,7 @@ class BOTAN_DLL GFpElement * @param value the element value * @param use_montgm whether this object will use Montgomery multiplication */ - GFpElement(const BigInt& p, const BigInt& value, bool use_montgm = false); + GFpElement(const BigInt& p, const BigInt& value, bool use_montgm = true); // GFpElement(const GFpElement& other) = default; @@ -47,12 +47,12 @@ class BOTAN_DLL GFpElement /** * Switch Montgomery multiplcation optimizations ON */ - void turn_on_sp_red_mul() const; + void turn_on_sp_red_mul(); /** * Switch Montgomery multiplcation optimizations OFF */ - void turn_off_sp_red_mul() const; + void turn_off_sp_red_mul(); /** * += Operator @@ -164,15 +164,15 @@ class BOTAN_DLL GFpElement */ void swap(GFpElement& other); private: - void ensure_montgm_precomp() const; + void ensure_montgm_precomp(); void trf_to_mres() const; void trf_to_ordres() const; - mutable GFpModulus modulus; + GFpModulus modulus; mutable BigInt m_value; // ordinary residue or m-residue respectively // data members for montgomery multiplication - mutable bool m_use_montgm; + bool m_use_montgm; mutable bool m_is_trf; // if m_value is montgomery }; |