diff options
author | Jack Lloyd <[email protected]> | 2018-04-17 18:06:34 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-04-17 18:07:25 -0400 |
commit | 2cfa191a940b7b884f24d23d94227ff382c672b4 (patch) | |
tree | 1faccd9cdaa635141783b685b3d5267f5bceac0c /src/lib/pubkey/sm2 | |
parent | 4ef7125afe98fafa261cec0b083b69a029aaf678 (diff) |
Add EC_Group::inverse_mod_order
Centralizing this logic allows curve specific implementations such
as using a precomputed ladder for exponentiating by p - 2
GH #1479
Diffstat (limited to 'src/lib/pubkey/sm2')
-rw-r--r-- | src/lib/pubkey/sm2/sm2.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/pubkey/sm2/sm2.cpp b/src/lib/pubkey/sm2/sm2.cpp index 95fe28f14..1096ea99f 100644 --- a/src/lib/pubkey/sm2/sm2.cpp +++ b/src/lib/pubkey/sm2/sm2.cpp @@ -31,7 +31,7 @@ SM2_Signature_PrivateKey::SM2_Signature_PrivateKey(const AlgorithmIdentifier& al const secure_vector<uint8_t>& key_bits) : EC_PrivateKey(alg_id, key_bits) { - m_da_inv = inverse_mod(m_private_key + 1, domain().get_order()); + m_da_inv = domain().inverse_mod_order(m_private_key + 1); } SM2_Signature_PrivateKey::SM2_Signature_PrivateKey(RandomNumberGenerator& rng, @@ -39,7 +39,7 @@ SM2_Signature_PrivateKey::SM2_Signature_PrivateKey(RandomNumberGenerator& rng, const BigInt& x) : EC_PrivateKey(rng, domain, x) { - m_da_inv = inverse_mod(m_private_key + 1, domain.get_order()); + m_da_inv = domain.inverse_mod_order(m_private_key + 1); } std::vector<uint8_t> sm2_compute_za(HashFunction& hash, |