From a83c663f99244d2b59162bf15e56410f9d2d999f Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sun, 29 Oct 2023 12:15:59 +0000 Subject: [PATCH] fix: incorrect upper bound for `s` in `sign` --- starknet-crypto/src/ecdsa.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starknet-crypto/src/ecdsa.rs b/starknet-crypto/src/ecdsa.rs index 35980601..e81e1d3e 100644 --- a/starknet-crypto/src/ecdsa.rs +++ b/starknet-crypto/src/ecdsa.rs @@ -108,7 +108,7 @@ pub fn sign( let s = mul_mod_floor(&r, private_key, &EC_ORDER); let s = add_unbounded(&s, message); let s = bigint_mul_mod_floor(s, &k_inv, &EC_ORDER); - if s == FieldElement::ZERO || s >= EC_ORDER { + if s == FieldElement::ZERO || s >= ELEMENT_UPPER_BOUND { return Err(SignError::InvalidK); }