aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/pkcs11/p11_ecc_key.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/prov/pkcs11/p11_ecc_key.cpp')
-rw-r--r--src/lib/prov/pkcs11/p11_ecc_key.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/prov/pkcs11/p11_ecc_key.cpp b/src/lib/prov/pkcs11/p11_ecc_key.cpp
index 9366594a6..df55b9ffb 100644
--- a/src/lib/prov/pkcs11/p11_ecc_key.cpp
+++ b/src/lib/prov/pkcs11/p11_ecc_key.cpp
@@ -90,12 +90,14 @@ PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const std::vector<u
pub_key_props.set_private(false);
pub_key_props.set_token(false); // don't create a persistent public key object
- ObjectHandle pub_key_handle = 0;
- m_handle = 0;
+ ObjectHandle pub_key_handle = CK_INVALID_HANDLE;
+ ObjectHandle priv_key_handle = CK_INVALID_HANDLE;
Mechanism mechanism = { CKM_EC_KEY_PAIR_GEN, nullptr, 0 };
session.module()->C_GenerateKeyPair(session.handle(), &mechanism,
pub_key_props.data(), pub_key_props.count(), props.data(), props.count(),
- &pub_key_handle, &m_handle);
+ &pub_key_handle, &priv_key_handle);
+
+ this->reset_handle(priv_key_handle);
Object public_key(session, pub_key_handle);
m_public_key = decode_public_point(public_key.get_attribute_value(AttributeType::EcPoint), m_domain_params.get_curve());