Skip to content

Commit

Permalink
Improve the ECC key generation for signing or ephemeral derivation. R…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Nov 28, 2023
1 parent 479fd8f commit c610ada
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6819,7 +6819,13 @@ int WP11_Ec_GenerateKeyPair(WP11_Object* pub, WP11_Object* priv,
ret = wc_ecc_init_ex(&priv->data.ecKey, NULL, priv->slot->devId);
if (ret == 0) {
#ifdef WOLFPKCS11_TPM
priv->slot->tpmCtx.ecdhKey = (WOLFTPM2_KEY*)&priv->tpmKey;
CK_BBOOL isSign = CK_FALSE;
CK_ULONG len = sizeof(isSign);
ret = WP11_Object_GetAttr(priv, CKA_SIGN, &isSign, &len);
if (isSign)
priv->slot->tpmCtx.eccKey = (WOLFTPM2_KEY*)&priv->tpmKey;
else
priv->slot->tpmCtx.ecdhKey = (WOLFTPM2_KEY*)&priv->tpmKey;
#endif

/* Copy parameters from public key into private key. */
Expand Down

0 comments on commit c610ada

Please sign in to comment.