Skip to content

Commit fa786be

Browse files
committed
Fix issue with CopyObject on TPM
1 parent 815123c commit fa786be

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/internal.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,12 +2246,6 @@ int WP11_Object_Copy(WP11_Object *src, WP11_Object *dest)
22462246
OBJ_COPY_DATA(src, dest, keyData);
22472247
XMEMCPY(dest->iv, src->iv, sizeof(dest->iv));
22482248
dest->encoded = src->encoded;
2249-
#endif
2250-
#ifdef WOLFPKCS11_TPM
2251-
/* For TPM keys, copy keyData */
2252-
if (src->opFlag & WP11_FLAG_TPM) {
2253-
OBJ_COPY_DATA(src, dest, keyData);
2254-
}
22552249
#endif
22562250
dest->objClass = src->objClass;
22572251
dest->keyGenMech = src->keyGenMech;
@@ -2279,7 +2273,7 @@ int WP11_Object_Copy(WP11_Object *src, WP11_Object *dest)
22792273
/* Handle TPM keys - copy tpmKey structure directly */
22802274
if (src->opFlag & WP11_FLAG_TPM) {
22812275
/* Copy the TPM key blob structure directly */
2282-
XMEMCPY(&dest->tpmKey, &src->tpmKey, sizeof(WOLFTPM2_KEYBLOB));
2276+
XMEMCPY(dest->tpmKey, src->tpmKey, sizeof(WOLFTPM2_KEYBLOB));
22832277

22842278
/* Initialize TPM handle to NULL for the destination */
22852279
dest->tpmKey->handle.hndl = TPM_RH_NULL;
@@ -2309,14 +2303,14 @@ int WP11_Object_Copy(WP11_Object *src, WP11_Object *dest)
23092303
case CKK_RSA:
23102304
/* Load public portion into wolf RsaKey structure */
23112305
ret = wolfTPM2_RsaKey_TpmToWolf(&dest->slot->tpmDev,
2312-
(WOLFTPM2_KEY*)&dest->tpmKey, dest->data.rsaKey);
2306+
(WOLFTPM2_KEY*)dest->tpmKey, dest->data.rsaKey);
23132307
break;
23142308
#endif
23152309
#ifdef HAVE_ECC
23162310
case CKK_EC:
23172311
/* Load public portion into wolf EccKey structure */
23182312
ret = wolfTPM2_EccKey_TpmToWolf(&dest->slot->tpmDev,
2319-
(WOLFTPM2_KEY*)&dest->tpmKey, dest->data.ecKey);
2313+
(WOLFTPM2_KEY*)dest->tpmKey, dest->data.ecKey);
23202314
break;
23212315
#endif
23222316
default:

0 commit comments

Comments
 (0)