diff options
Diffstat (limited to 'src/lib/pubkey/sm2')
-rw-r--r-- | src/lib/pubkey/sm2/sm2.cpp | 2 | ||||
-rw-r--r-- | src/lib/pubkey/sm2/sm2_enc.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/pubkey/sm2/sm2.cpp b/src/lib/pubkey/sm2/sm2.cpp index cec9eaa38..4b5610c85 100644 --- a/src/lib/pubkey/sm2/sm2.cpp +++ b/src/lib/pubkey/sm2/sm2.cpp @@ -114,7 +114,7 @@ SM2_Signature_Operation::sign(RandomNumberGenerator& rng) { const BigInt e = BigInt::decode(m_hash->final()); - const BigInt k = BigInt::random_integer(rng, 1, m_group.get_order()); + const BigInt k = m_group.random_scalar(rng); const BigInt r = m_group.mod_order( m_group.blinded_base_point_multiply_x(k, rng, m_ws) + e); diff --git a/src/lib/pubkey/sm2/sm2_enc.cpp b/src/lib/pubkey/sm2/sm2_enc.cpp index 4a6aa2b6e..e3553d5b3 100644 --- a/src/lib/pubkey/sm2/sm2_enc.cpp +++ b/src/lib/pubkey/sm2/sm2_enc.cpp @@ -67,7 +67,7 @@ class SM2_Encryption_Operation final : public PK_Ops::Encryption const size_t p_bytes = m_group.get_p_bytes(); - const BigInt k = BigInt::random_integer(rng, 1, m_group.get_order()); + const BigInt k = m_group.random_scalar(rng); const PointGFp C1 = m_group.blinded_base_point_multiply(k, rng, m_ws); const BigInt x1 = C1.get_affine_x(); |