Skip to content

Commit 552d448

Browse files
committed
Fix for wolfSSL PR 10604 crypto callback ALREADY_E
1 parent a925aaa commit 552d448

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/unit_tests.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4305,7 +4305,7 @@ static void test_wolfTPM2_EccSignVerifyDig(WOLFTPM2_DEV* dev,
43054305
* post-hoc skip-check can't catch it. Query capabilities up front. */
43064306
if (!test_tpm_alg_supported(hashAlg)) {
43074307
printf("Hash alg 0x%x not supported by TPM... Skipping\n", hashAlg);
4308-
return;
4308+
goto exit;
43094309
}
43104310

43114311
/* -- Use TPM key to sign and verify with wolfCrypt -- */
@@ -4325,11 +4325,11 @@ static void test_wolfTPM2_EccSignVerifyDig(WOLFTPM2_DEV* dev,
43254325
}
43264326
if ((rc & TPM_RC_HASH) == TPM_RC_HASH) {
43274327
printf("Hash type not supported... Skipping\n");
4328-
return;
4328+
goto exit;
43294329
}
43304330
if ((rc & TPM_RC_CURVE) == TPM_RC_CURVE) {
43314331
printf("Curve not supported... Skipping\n");
4332-
return;
4332+
goto exit;
43334333
}
43344334
AssertIntEQ(rc, 0);
43354335

@@ -4430,11 +4430,15 @@ static void test_wolfTPM2_EccSignVerifyDig(WOLFTPM2_DEV* dev,
44304430
printf("Test TPM Wrapper: %-40s %s\n", nameBuf,
44314431
rc == 0 ? "Passed" : "Failed");
44324432

4433+
exit:
44334434
#ifdef WOLF_CRYPTO_CB
4435+
/* Unregister on every path (incl. skips) so a leaked registration does
4436+
* not make the next SetCryptoDevCb return ALREADY_E on wolfSSL 5.9.2+. */
44344437
if (flags & FLAGS_USE_CRYPTO_CB) {
44354438
wolfTPM2_ClearCryptoDevCb(dev, tpmDevId);
44364439
}
44374440
#endif
4441+
(void)tpmDevId;
44384442
}
44394443

44404444
static void test_wolfTPM2_EccSignVerify_All(WOLFTPM2_DEV* dev,

0 commit comments

Comments
 (0)