diff options
author | Jack Lloyd <[email protected]> | 2018-01-31 14:03:05 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-01-31 14:03:05 -0500 |
commit | e5b9ee2345affb56307070298ded9c2d5e1914be (patch) | |
tree | 7311fb0a10a99ccaf8cb82eecdea26d9fbe3d458 /src/lib/pubkey/sm2 | |
parent | 439d2ead033142365f092c7882bad31e4257ed09 (diff) |
Use shared representation of EC_Group
Hide CurveGFp with an eye for eventual removal
Diffstat (limited to 'src/lib/pubkey/sm2')
-rw-r--r-- | src/lib/pubkey/sm2/sm2.cpp | 6 | ||||
-rw-r--r-- | src/lib/pubkey/sm2/sm2_enc.cpp | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/pubkey/sm2/sm2.cpp b/src/lib/pubkey/sm2/sm2.cpp index 28f455ba3..652985ec9 100644 --- a/src/lib/pubkey/sm2/sm2.cpp +++ b/src/lib/pubkey/sm2/sm2.cpp @@ -54,10 +54,10 @@ std::vector<uint8_t> sm2_compute_za(HashFunction& hash, hash.update(get_byte(1, uid_len)); hash.update(user_id); - const size_t p_bytes = domain.get_curve().get_p().bytes(); + const size_t p_bytes = domain.get_p_bytes(); - hash.update(BigInt::encode_1363(domain.get_curve().get_a(), p_bytes)); - hash.update(BigInt::encode_1363(domain.get_curve().get_b(), p_bytes)); + hash.update(BigInt::encode_1363(domain.get_a(), p_bytes)); + hash.update(BigInt::encode_1363(domain.get_b(), p_bytes)); hash.update(BigInt::encode_1363(domain.get_base_point().get_affine_x(), p_bytes)); hash.update(BigInt::encode_1363(domain.get_base_point().get_affine_y(), p_bytes)); hash.update(BigInt::encode_1363(pubkey.get_affine_x(), p_bytes)); diff --git a/src/lib/pubkey/sm2/sm2_enc.cpp b/src/lib/pubkey/sm2/sm2_enc.cpp index b697daf1e..9ba278060 100644 --- a/src/lib/pubkey/sm2/sm2_enc.cpp +++ b/src/lib/pubkey/sm2/sm2_enc.cpp @@ -46,7 +46,7 @@ class SM2_Encryption_Operation final : public PK_Ops::Encryption { public: SM2_Encryption_Operation(const SM2_Encryption_PublicKey& key, const std::string& kdf_hash) : - m_p_bytes(key.domain().get_curve().get_p().bytes()), + m_p_bytes(key.domain().get_p_bytes()), m_order(key.domain().get_order()), m_base_point(key.domain().get_base_point(), m_order), m_public_point(key.public_point(), m_order), @@ -135,7 +135,7 @@ class SM2_Decryption_Operation final : public PK_Ops::Decryption size_t ciphertext_len) override { const BigInt& cofactor = m_key.domain().get_cofactor(); - const size_t p_bytes = m_key.domain().get_curve().get_p().bytes(); + const size_t p_bytes = m_key.domain().get_p_bytes(); valid_mask = 0x00; @@ -160,7 +160,7 @@ class SM2_Decryption_Operation final : public PK_Ops::Decryption .end_cons() .verify_end(); - const PointGFp C1(m_key.domain().get_curve(), x1, y1); + const PointGFp C1 = m_key.domain().point(x1, y1); if(!C1.on_the_curve()) return secure_vector<uint8_t>(); |