aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/math/numbertheory/monty.cpp7
-rw-r--r--src/lib/math/numbertheory/monty.h7
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:
/**