aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/ecdsa/ecdsa.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-04-17 18:06:34 -0400
committerJack Lloyd <[email protected]>2018-04-17 18:07:25 -0400
commit2cfa191a940b7b884f24d23d94227ff382c672b4 (patch)
tree1faccd9cdaa635141783b685b3d5267f5bceac0c /src/lib/pubkey/ecdsa/ecdsa.cpp
parent4ef7125afe98fafa261cec0b083b69a029aaf678 (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/ecdsa/ecdsa.cpp')
-rw-r--r--src/lib/pubkey/ecdsa/ecdsa.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/pubkey/ecdsa/ecdsa.cpp b/src/lib/pubkey/ecdsa/ecdsa.cpp
index 03f5e57ab..6e104f164 100644
--- a/src/lib/pubkey/ecdsa/ecdsa.cpp
+++ b/src/lib/pubkey/ecdsa/ecdsa.cpp
@@ -89,7 +89,7 @@ ECDSA_Signature_Operation::raw_sign(const uint8_t msg[], size_t msg_len,
const BigInt k = m_group.random_scalar(rng);
#endif
- const BigInt k_inv = inverse_mod(k, m_group.get_order());
+ const BigInt k_inv = m_group.inverse_mod_order(k);
const BigInt r = m_group.mod_order(
m_group.blinded_base_point_multiply_x(k, rng, m_ws));
@@ -142,7 +142,7 @@ bool ECDSA_Verification_Operation::verify(const uint8_t msg[], size_t msg_len,
if(r <= 0 || r >= m_group.get_order() || s <= 0 || s >= m_group.get_order())
return false;
- const BigInt w = inverse_mod(s, m_group.get_order());
+ const BigInt w = m_group.inverse_mod_order(s);
const BigInt u1 = m_group.multiply_mod_order(e, w);
const BigInt u2 = m_group.multiply_mod_order(r, w);