aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/ecc_key
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-04-20 10:30:04 -0400
committerJack Lloyd <[email protected]>2018-04-20 10:30:04 -0400
commitc90d868a533c13501e8d6e3b71919501b9d70f9e (patch)
treeb9a28e5edb1c172d334d79d91be2588eed1a1d59 /src/lib/pubkey/ecc_key
parent1177467fbae03f2370f7f20d692a95b484616923 (diff)
Use EC_Group::inverse_mod_order where appropriate
Diffstat (limited to 'src/lib/pubkey/ecc_key')
-rw-r--r--src/lib/pubkey/ecc_key/ecc_key.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp
index 7c46a2fa0..2c23c1b47 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.cpp
+++ b/src/lib/pubkey/ecc_key/ecc_key.cpp
@@ -118,8 +118,6 @@ EC_PrivateKey::EC_PrivateKey(RandomNumberGenerator& rng,
else
m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
- const BigInt& order = m_domain_params.get_order();
-
if(x == 0)
{
m_private_key = ec_group.random_scalar(rng);
@@ -133,7 +131,7 @@ EC_PrivateKey::EC_PrivateKey(RandomNumberGenerator& rng,
if(with_modular_inverse)
{
// ECKCDSA
- m_public_key = domain().get_base_point() * inverse_mod(m_private_key, order);
+ m_public_key = domain().get_base_point() * m_domain_params.inverse_mod_order(m_private_key);
}
else
{
@@ -183,8 +181,7 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
if(with_modular_inverse)
{
// ECKCDSA
- const BigInt& order = m_domain_params.get_order();
- m_public_key = domain().get_base_point() * inverse_mod(m_private_key, order);
+ m_public_key = domain().get_base_point() * m_domain_params.inverse_mod_order(m_private_key);
}
else
{