Skip to content

Commit e8c4fec

Browse files
committed
Fix finding 354
1 parent bad0c3f commit e8c4fec

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/tpm2_wrap.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,10 +1614,14 @@ int wolfTPM2_EncryptSecret(WOLFTPM2_DEV* dev, const WOLFTPM2_KEY* tpmKey,
16141614
int rc = NOT_COMPILED_IN;
16151615

16161616
/* if a tpmKey is not present then we are using an unsalted session */
1617-
if (dev == NULL || tpmKey == NULL || data == NULL || secret == NULL) {
1617+
if (tpmKey == NULL) {
16181618
return TPM_RC_SUCCESS;
16191619
}
16201620

1621+
if (dev == NULL || data == NULL || secret == NULL) {
1622+
return BAD_FUNC_ARG;
1623+
}
1624+
16211625
#ifdef DEBUG_WOLFTPM
16221626
printf("Encrypt secret: Alg %s, Label %s\n",
16231627
TPM2_GetAlgName(tpmKey->pub.publicArea.type), label);

0 commit comments

Comments
 (0)