diff options
Diffstat (limited to 'src/lib/math/bigint/big_ops2.cpp')
-rw-r--r-- | src/lib/math/bigint/big_ops2.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/math/bigint/big_ops2.cpp b/src/lib/math/bigint/big_ops2.cpp index 9277834ba..eea6a8590 100644 --- a/src/lib/math/bigint/big_ops2.cpp +++ b/src/lib/math/bigint/big_ops2.cpp @@ -177,6 +177,22 @@ BigInt& BigInt::mul(const BigInt& y, secure_vector<word>& ws) return (*this); } +BigInt& BigInt::square(secure_vector<word>& ws) + { + const size_t sw = sig_words(); + + secure_vector<word> z(2*sw); + ws.resize(z.size()); + + bigint_sqr(z.data(), z.size(), + data(), size(), sw, + ws.data(), ws.size()); + + swap_reg(z); + + return (*this); + } + BigInt& BigInt::operator*=(word y) { if(y == 0) |