aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/sm2/sm2.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-21 11:12:32 -0500
committerJack Lloyd <[email protected]>2018-02-21 11:12:32 -0500
commit1d07f8287a452420db969cafd61bc223214cff03 (patch)
treefd78e74fd7dd766f690654fa4c8c940e02c2e2c0 /src/lib/pubkey/sm2/sm2.cpp
parent061182a46f8b9e42808d57ec7bbafc13db7cf809 (diff)
New API for blinded ECC point multiplication
No shared state
Diffstat (limited to 'src/lib/pubkey/sm2/sm2.cpp')
-rw-r--r--src/lib/pubkey/sm2/sm2.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/pubkey/sm2/sm2.cpp b/src/lib/pubkey/sm2/sm2.cpp
index 2af888bbc..9ef30d9bf 100644
--- a/src/lib/pubkey/sm2/sm2.cpp
+++ b/src/lib/pubkey/sm2/sm2.cpp
@@ -83,7 +83,6 @@ class SM2_Signature_Operation final : public PK_Ops::Signature
const std::string& ident,
const std::string& hash) :
m_group(sm2.domain()),
- m_base_point(m_group.get_base_point(), m_group.get_order()),
m_x(sm2.private_value()),
m_da_inv(sm2.get_da_inv()),
m_hash(HashFunction::create_or_throw(hash))
@@ -102,12 +101,12 @@ class SM2_Signature_Operation final : public PK_Ops::Signature
private:
const EC_Group m_group;
- Blinded_Point_Multiply m_base_point;
const BigInt& m_x;
const BigInt& m_da_inv;
std::vector<uint8_t> m_za;
std::unique_ptr<HashFunction> m_hash;
+ std::vector<BigInt> m_ws;
};
secure_vector<uint8_t>
@@ -115,7 +114,7 @@ SM2_Signature_Operation::sign(RandomNumberGenerator& rng)
{
const BigInt k = BigInt::random_integer(rng, 1, m_group.get_order());
- const PointGFp k_times_P = m_base_point.blinded_multiply(k, rng);
+ const PointGFp k_times_P = m_group.blinded_base_point_multiply(k, rng, m_ws);
const BigInt e = BigInt::decode(m_hash->final());
const BigInt r = m_group.mod_order(k_times_P.get_affine_x() + e);