diff options
author | Jack Lloyd <[email protected]> | 2016-11-12 01:53:56 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-12 01:53:56 -0500 |
commit | 9c72dabc9dc73e2603c22dfce48611b5b626238b (patch) | |
tree | bda4f84f78bfbdd28e2199ee8f9998b08cc3c634 /src/lib/prov/openssl/openssl_ec.cpp | |
parent | 618f890fd7ede74c728612ca8bc590c72ee353f1 (diff) |
Pubkey cleanups
Add Public_Key::key_length usable for policy checking (as in
TLS::Policy::check_peer_key_acceptable)
Remove Public_Key::max_input_bits because it didn't make much sense
for most algorithms actually.
Remove message_parts and message_part_size from PK_Ops
Diffstat (limited to 'src/lib/prov/openssl/openssl_ec.cpp')
-rw-r--r-- | src/lib/prov/openssl/openssl_ec.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/prov/openssl/openssl_ec.cpp b/src/lib/prov/openssl/openssl_ec.cpp index ca4352370..51d24a119 100644 --- a/src/lib/prov/openssl/openssl_ec.cpp +++ b/src/lib/prov/openssl/openssl_ec.cpp @@ -117,8 +117,6 @@ class OpenSSL_ECDSA_Verification_Operation : public PK_Ops::Verification_with_EM m_order_bits = ::EC_GROUP_get_degree(group); } - size_t message_parts() const override { return 2; } - size_t message_part_size() const override { return (m_order_bits + 7) / 8; } size_t max_input_bits() const override { return m_order_bits; } bool with_recovery() const override { return false; } @@ -126,7 +124,8 @@ class OpenSSL_ECDSA_Verification_Operation : public PK_Ops::Verification_with_EM bool verify(const byte msg[], size_t msg_len, const byte sig_bytes[], size_t sig_len) override { - if(sig_len != message_part_size() * message_parts()) + const size_t order_bytes = (m_order_bits + 7) / 8; + if(sig_len != 2 * order_bytes) return false; std::unique_ptr<ECDSA_SIG, std::function<void (ECDSA_SIG*)>> sig(nullptr, ECDSA_SIG_free); @@ -172,7 +171,7 @@ class OpenSSL_ECDSA_Signing_Operation : public PK_Ops::Signature_with_EMSA if(!sig) throw OpenSSL_Error("ECDSA_do_sign"); - const size_t order_bytes = message_part_size(); + const size_t order_bytes = (m_order_bits + 7) / 8; const size_t r_bytes = BN_num_bytes(sig->r); const size_t s_bytes = BN_num_bytes(sig->s); secure_vector<byte> sigval(2*order_bytes); @@ -181,8 +180,6 @@ class OpenSSL_ECDSA_Signing_Operation : public PK_Ops::Signature_with_EMSA return sigval; } - size_t message_parts() const override { return 2; } - size_t message_part_size() const override { return (m_order_bits + 7) / 8; } size_t max_input_bits() const override { return m_order_bits; } private: |