diff --git a/examples/wrap/wrap_test.c b/examples/wrap/wrap_test.c index 949f1da..eda0d7c 100644 --- a/examples/wrap/wrap_test.c +++ b/examples/wrap/wrap_test.c @@ -153,6 +153,7 @@ int TPM2_Wrapper_Test(void* userCtx) /* unload all transient handles */ rc = wolfTPM2_UnloadHandles_AllTransient(&dev); + if (rc != 0) goto exit; /*------------------------------------------------------------------------*/ @@ -768,7 +769,6 @@ int TPM2_Wrapper_Test(void* userCtx) } else if (rc == TPM_RC_COMMAND_CODE) { printf("Encrypt/Decrypt: Is not a supported feature due to export controls\n"); - rc = TPM_RC_SUCCESS; /* clear error code */ } else { printf("Encrypt/Decrypt (gen key) test failed, result not as expected!\n"); diff --git a/src/tpm2_wrap.c b/src/tpm2_wrap.c index d134b27..bdf6ccd 100644 --- a/src/tpm2_wrap.c +++ b/src/tpm2_wrap.c @@ -72,7 +72,6 @@ static int wolfTPM2_Init_NoDev(TPM2_CTX* ctx, TPM2HalIoCb ioCb, void* userCtx, #endif return rc; } - rc = TPM_RC_SUCCESS; #ifdef DEBUG_WOLFTPM printf("TPM2_Startup pass\n"); #endif @@ -91,7 +90,9 @@ static int wolfTPM2_Init_NoDev(TPM2_CTX* ctx, TPM2HalIoCb ioCb, void* userCtx, #ifdef DEBUG_WOLFTPM printf("TPM2_SelfTest pass\n"); #endif -#endif +#else + rc = TPM_RC_SUCCESS; +#endif /* WOLFTPM_MCHP || WOLFTPM_PERFORM_SELFTEST */ return rc; }