diff --git a/src/internal.c b/src/internal.c index 4c8a6c2f8..10e53e039 100644 --- a/src/internal.c +++ b/src/internal.c @@ -19124,6 +19124,16 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr) return ssl->error; } + /* If checking alert on error (allowSocketErr == 1) do not try and + * process alerts for async or ocsp non blocking */ +#if defined(WOLFSSL_CHECK_ALERT_ON_ERR) && \ + (defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_NONBLOCK_OCSP)) + if (allowSocketErr == 1 && \ + (ssl->error == WC_PENDING_E || ssl->error == OCSP_WANT_READ)) { + return ssl->error; + } +#endif + #if defined(WOLFSSL_DTLS) && defined(WOLFSSL_ASYNC_CRYPT) /* process any pending DTLS messages - this flow can happen with async */ if (ssl->dtls_rx_msg_list != NULL) { diff --git a/tests/api.c b/tests/api.c index edf3ef01c..8a67c22a5 100644 --- a/tests/api.c +++ b/tests/api.c @@ -5290,10 +5290,10 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args) } #endif #if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EITHER_SIDE) - if (sharedCtx && wolfSSL_use_certificate_file(ssl, svrCertFile, + if (sharedCtx && wolfSSL_use_certificate_file(ssl, certFile, WOLFSSL_FILETYPE_PEM) != WOLFSSL_SUCCESS) { #else - if (wolfSSL_use_certificate_file(ssl, svrCertFile, + if (wolfSSL_use_certificate_file(ssl, certFile, WOLFSSL_FILETYPE_PEM) != WOLFSSL_SUCCESS) { #endif /*err_sys("can't load server cert chain file, " @@ -5301,10 +5301,10 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args) goto done; } #if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EITHER_SIDE) - if (sharedCtx && wolfSSL_use_PrivateKey_file(ssl, svrKeyFile, + if (sharedCtx && wolfSSL_use_PrivateKey_file(ssl, keyFile, WOLFSSL_FILETYPE_PEM) != WOLFSSL_SUCCESS) { #else - if (wolfSSL_use_PrivateKey_file(ssl, svrKeyFile, + if (wolfSSL_use_PrivateKey_file(ssl, keyFile, WOLFSSL_FILETYPE_PEM) != WOLFSSL_SUCCESS) { #endif /*err_sys("can't load server key file, " @@ -62942,6 +62942,15 @@ void ApiTest(void) printf(" Begin API Tests\n"); fflush(stdout); + /* we must perform init and cleanup if not all tests are running */ + if (!testAll) { + #ifdef WOLFCRYPT_ONLY + wolfCrypt_Init(); + #else + wolfSSL_Init(); + #endif + } + for (i = 0; i < TEST_CASE_CNT; ++i) { /* When not testing all cases then skip if not marked for running. */ if (!testAll && !testCases[i].run) { @@ -62983,7 +62992,13 @@ void ApiTest(void) wc_ecc_fp_free(); /* free per thread cache */ #endif - wolfSSL_Cleanup(); + if (!testAll) { + #ifdef WOLFCRYPT_ONLY + wolfCrypt_Cleanup(); + #else + wolfSSL_Cleanup(); + #endif + } (void)testDevId;