From c90d868a533c13501e8d6e3b71919501b9d70f9e Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 20 Apr 2018 10:30:04 -0400 Subject: Use EC_Group::inverse_mod_order where appropriate --- src/lib/pubkey/ecc_key/ecc_key.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/lib/pubkey/ecc_key') 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 { -- cgit v1.2.3