Skip to content

Commit

Permalink
Support pSharedData
Browse files Browse the repository at this point in the history
  • Loading branch information
qpernil committed Mar 21, 2024
1 parent ed7c968 commit 65c696b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions pkcs11/yubihsm_pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -5647,12 +5647,6 @@ CK_DEFINE_FUNCTION(CK_RV, C_DeriveKey)

CK_ECDH1_DERIVE_PARAMS *params = pMechanism->pParameter;

if (params->pSharedData != NULL || params->ulSharedDataLen != 0) {
DBG_ERR("Mechanism parameters incompatible with key derivation function");
rv = CKR_MECHANISM_PARAM_INVALID;
goto c_drv_out;
}

int seq = session->ecdh_session_keys.length + 1;
if (seq > MAX_ECDH_SESSION_KEYS) {
DBG_ERR("There are already %d ECDH keys available for this session. "
Expand Down Expand Up @@ -5689,7 +5683,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_DeriveKey)

DBG_INFO("ECDH ecdh_key.len = %zu", ecdh_key.len);

rv = ecdh_kdf(&ecdh_key, NULL, 0, params->kdf, value_len);
rv = ecdh_kdf(&ecdh_key, params->pSharedData, params->ulSharedDataLen, params->kdf, value_len);
if (rv != CKR_OK) {
DBG_ERR("Failed to derive ECDH key with KDF %lu", params->kdf);
goto c_drv_out;
Expand Down

0 comments on commit 65c696b

Please sign in to comment.