aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-08-12 19:24:52 -0400
committerJack Lloyd <[email protected]>2018-08-12 19:24:52 -0400
commite0a43a200901e9c212573b09730c142b42c5719e (patch)
tree6a2d6d9b2a98b27c9744cab22bcaa3ea54be314a
parentc3b40191a0406b6d8f7d1480d06344067622e2c1 (diff)
Fix for OpenSSL
-rw-r--r--src/lib/prov/openssl/openssl_ec.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/prov/openssl/openssl_ec.cpp b/src/lib/prov/openssl/openssl_ec.cpp
index 5da466c0c..e8df0598c 100644
--- a/src/lib/prov/openssl/openssl_ec.cpp
+++ b/src/lib/prov/openssl/openssl_ec.cpp
@@ -305,6 +305,7 @@ class OpenSSL_ECDH_KA_Operation final : public PK_Ops::Key_Agreement_with_KDF
OpenSSL_ECDH_KA_Operation(const ECDH_PrivateKey& ecdh, const std::string& kdf) :
PK_Ops::Key_Agreement_with_KDF(kdf), m_ossl_ec(::EC_KEY_new(), ::EC_KEY_free)
{
+ m_value_size = ecdh.domain().get_p_bytes();
const secure_vector<uint8_t> der = PKCS8_for_openssl(ecdh);
const uint8_t* der_ptr = der.data();
m_ossl_ec.reset(d2i_ECPrivateKey(nullptr, &der_ptr, der.size()));
@@ -312,6 +313,8 @@ class OpenSSL_ECDH_KA_Operation final : public PK_Ops::Key_Agreement_with_KDF
throw OpenSSL_Error("d2i_ECPrivateKey");
}
+ size_t agreed_value_size() const override { return m_value_size; }
+
secure_vector<uint8_t> raw_agree(const uint8_t w[], size_t w_len) override
{
const EC_GROUP* group = ::EC_KEY_get0_group(m_ossl_ec.get());
@@ -348,6 +351,7 @@ class OpenSSL_ECDH_KA_Operation final : public PK_Ops::Key_Agreement_with_KDF
private:
std::unique_ptr<EC_KEY, std::function<void (EC_KEY*)>> m_ossl_ec;
+ size_t m_value_size;
};
}