diff options
author | Jack Lloyd <[email protected]> | 2018-05-02 20:02:29 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-05-02 20:02:29 -0400 |
commit | 78b061cad074337385a67f3e454ed2746570d2c7 (patch) | |
tree | 2d5ad20fd509e3b2a588ba9563a50feca6ae6441 /src/lib/math | |
parent | f97c355b8b3a64744fc03212db857415ea26f973 (diff) |
Make Montgomery_Int public, add function for addition with workspace
Diffstat (limited to 'src/lib/math')
-rw-r--r-- | src/lib/math/numbertheory/monty.cpp | 7 | ||||
-rw-r--r-- | src/lib/math/numbertheory/monty.h | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/math/numbertheory/monty.cpp b/src/lib/math/numbertheory/monty.cpp index 33d15de5b..1cdc7fa9a 100644 --- a/src/lib/math/numbertheory/monty.cpp +++ b/src/lib/math/numbertheory/monty.cpp @@ -281,8 +281,13 @@ Montgomery_Int Montgomery_Int::operator-(const Montgomery_Int& other) const Montgomery_Int& Montgomery_Int::operator+=(const Montgomery_Int& other) { - m_v += other.m_v; secure_vector<word> ws; + return this->add(other, ws); + } + +Montgomery_Int& Montgomery_Int::add(const Montgomery_Int& other, secure_vector<word>& ws) + { + m_v += other.m_v; m_v.reduce_below(m_params->p(), ws); return (*this); } diff --git a/src/lib/math/numbertheory/monty.h b/src/lib/math/numbertheory/monty.h index 2af655230..8a594325c 100644 --- a/src/lib/math/numbertheory/monty.h +++ b/src/lib/math/numbertheory/monty.h @@ -18,7 +18,7 @@ class Montgomery_Params; /** * The Montgomery representation of an integer */ -class Montgomery_Int final +class BOTAN_UNSTABLE_API Montgomery_Int final { public: /** @@ -75,6 +75,9 @@ class Montgomery_Int final Montgomery_Int& operator*=(const secure_vector<word>& other); + Montgomery_Int& add(const Montgomery_Int& other, + secure_vector<word>& ws); + Montgomery_Int mul(const Montgomery_Int& other, secure_vector<word>& ws) const; @@ -111,7 +114,7 @@ class Montgomery_Int final /** * Parameters for Montgomery Reduction */ -class Montgomery_Params final +class BOTAN_UNSTABLE_API Montgomery_Params final { public: /** |