diff options
author | Jack Lloyd <[email protected]> | 2018-03-21 11:00:21 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-21 11:00:21 -0400 |
commit | 574f44727d386984cf87a1161cec135209091650 (patch) | |
tree | f8dd93f7154455e81cf16d0947cc4be8172d27c3 /src/lib/pubkey/sm2 | |
parent | b03c5da8b56606f7b4df8122d8bd7914760dba32 (diff) |
Add EC_Group::random_scalar
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(); |