Add BigNum::mod_inv.
GitOrigin-RevId: 98733421e0b8a6924724a4c13f2cd9ad937e3b0d
This commit is contained in:
parent
cdecbe9b3e
commit
7e1d116d70
@ -220,6 +220,11 @@ void BigNum::mod_mul(BigNum &r, BigNum &a, BigNum &b, const BigNum &m, BigNumCon
|
||||
LOG_IF(FATAL, result != 1);
|
||||
}
|
||||
|
||||
void BigNum::mod_inv(BigNum &r, BigNum &a, const BigNum &m, BigNumContext &context) {
|
||||
BIGNUM *result = BN_mod_inverse(r.impl_->big_num, a.impl_->big_num, m.impl_->big_num, context.impl_->big_num_context);
|
||||
LOG_IF(FATAL, result == nullptr);
|
||||
}
|
||||
|
||||
void BigNum::div(BigNum *quotient, BigNum *remainder, const BigNum ÷nd, const BigNum &divisor,
|
||||
BigNumContext &context) {
|
||||
auto q = quotient == nullptr ? nullptr : quotient->impl_->big_num;
|
||||
|
@ -87,6 +87,8 @@ class BigNum {
|
||||
|
||||
static void mod_mul(BigNum &r, BigNum &a, BigNum &b, const BigNum &m, BigNumContext &context);
|
||||
|
||||
static void mod_inv(BigNum &r, BigNum &a, const BigNum &m, BigNumContext &context);
|
||||
|
||||
static void div(BigNum *quotient, BigNum *remainder, const BigNum ÷nd, const BigNum &divisor,
|
||||
BigNumContext &context);
|
||||
|
||||
|
Reference in New Issue
Block a user