aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2020-11-08 07:22:30 -0500
committerJack Lloyd <[email protected]>2020-11-08 07:22:30 -0500
commite2d9d580a555a8beb8161f734c0d6026ac28a498 (patch)
tree4e6405f9927e947b92fa4284826e62ed7907b3ab /src/lib
parenteb5f0f69456bde196d3a9049933e0697779128c8 (diff)
Remove mul_add
Testing shows it doesn't seem to matter for performance anyway
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/math/numbertheory/numthry.cpp29
-rw-r--r--src/lib/math/numbertheory/numthry.h12
-rw-r--r--src/lib/pubkey/rsa/rsa.cpp2
3 files changed, 1 insertions, 42 deletions
diff --git a/src/lib/math/numbertheory/numthry.cpp b/src/lib/math/numbertheory/numthry.cpp
index 18e372c58..a735bd15b 100644
--- a/src/lib/math/numbertheory/numthry.cpp
+++ b/src/lib/math/numbertheory/numthry.cpp
@@ -149,35 +149,6 @@ int32_t jacobi(const BigInt& a, const BigInt& n)
}
/*
-* Multiply-Add Operation
-*/
-BigInt mul_add(const BigInt& a, const BigInt& b, const BigInt& c)
- {
- if(c.is_negative())
- throw Invalid_Argument("mul_add: Third argument must be > 0");
-
- BigInt::Sign sign = BigInt::Positive;
- if(a.sign() != b.sign())
- sign = BigInt::Negative;
-
- const size_t a_sw = a.sig_words();
- const size_t b_sw = b.sig_words();
- const size_t c_sw = c.sig_words();
-
- BigInt r(sign, std::max(a_sw + b_sw, c_sw) + 1);
- secure_vector<word> workspace(r.size());
-
- bigint_mul(r.mutable_data(), r.size(),
- a.data(), a.size(), a_sw,
- b.data(), b.size(), b_sw,
- workspace.data(), workspace.size());
-
- const size_t r_size = std::max(r.sig_words(), c_sw);
- bigint_add2(r.mutable_data(), r_size, c.data(), c_sw);
- return r;
- }
-
-/*
* Square a BigInt
*/
BigInt square(const BigInt& x)
diff --git a/src/lib/math/numbertheory/numthry.h b/src/lib/math/numbertheory/numthry.h
index 4bf572f5b..e1a16a570 100644
--- a/src/lib/math/numbertheory/numthry.h
+++ b/src/lib/math/numbertheory/numthry.h
@@ -15,18 +15,6 @@ namespace Botan {
class RandomNumberGenerator;
/**
-* Fused multiply-add
-* @param a an integer
-* @param b an integer
-* @param c an integer
-* @return (a*b)+c
-*/
-BigInt BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("Just use (a*b)+c")
- mul_add(const BigInt& a,
- const BigInt& b,
- const BigInt& c);
-
-/**
* Return the absolute value
* @param n an integer
* @return absolute value of n
diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp
index a32aa44e4..b7d05e456 100644
--- a/src/lib/pubkey/rsa/rsa.cpp
+++ b/src/lib/pubkey/rsa/rsa.cpp
@@ -453,7 +453,7 @@ class RSA_Private_Operation
*/
j1 = m_private->m_mod_p.multiply(m_private->m_mod_p.reduce((m_private->get_p() + j1) - j2), m_private->get_c());
- return mul_add(j1, m_private->get_q(), j2);
+ return j1*m_private->get_q() + j2;
}
std::shared_ptr<const RSA_Public_Data> m_public;