aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/numbertheory/mp_numth.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/math/numbertheory/mp_numth.cpp')
-rw-r--r--src/lib/math/numbertheory/mp_numth.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/lib/math/numbertheory/mp_numth.cpp b/src/lib/math/numbertheory/mp_numth.cpp
index 5ad72cd47..eef641996 100644
--- a/src/lib/math/numbertheory/mp_numth.cpp
+++ b/src/lib/math/numbertheory/mp_numth.cpp
@@ -18,14 +18,9 @@ namespace Botan {
*/
BigInt square(const BigInt& x)
{
- const size_t x_sw = x.sig_words();
-
- BigInt z(BigInt::Positive, round_up(2*x_sw, 16));
- secure_vector<word> workspace(z.size());
-
- bigint_sqr(z.mutable_data(), z.size(),
- x.data(), x.size(), x_sw,
- workspace.data(), workspace.size());
+ BigInt z = x;
+ secure_vector<word> ws;
+ z.square(ws);
return z;
}