diff --git a/src/ssl.c b/src/ssl.c index 31219f94a..f6457c6b3 100755 --- a/src/ssl.c +++ b/src/ssl.c @@ -12182,7 +12182,13 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, } #endif - if (ssl->buffers.outputBuffer.length > 0) { + if (ssl->buffers.outputBuffer.length > 0 + #ifdef WOLFSSL_ASYNC_CRYPT + /* do not send buffered or advance state if last error was an + async pending operation */ + && ssl->error != WC_PENDING_E + #endif + ) { if ( (ssl->error = SendBuffered(ssl)) == 0) { /* fragOffset is non-zero when sending fragments. On the last * fragment, fragOffset is zero again, and the state can be @@ -12580,7 +12586,13 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, } #endif - if (ssl->buffers.outputBuffer.length > 0) { + if (ssl->buffers.outputBuffer.length > 0 + #ifdef WOLFSSL_ASYNC_CRYPT + /* do not send buffered or advance state if last error was an + async pending operation */ + && ssl->error != WC_PENDING_E + #endif + ) { if ( (ssl->error = SendBuffered(ssl)) == 0) { /* fragOffset is non-zero when sending fragments. On the last * fragment, fragOffset is zero again, and the state can be diff --git a/src/tls13.c b/src/tls13.c index ce476f9b4..9b9b1d1b9 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -7876,7 +7876,13 @@ int wolfSSL_connect_TLSv13(WOLFSSL* ssl) return WOLFSSL_FATAL_ERROR; } - if (ssl->buffers.outputBuffer.length > 0) { + if (ssl->buffers.outputBuffer.length > 0 + #ifdef WOLFSSL_ASYNC_CRYPT + /* do not send buffered or advance state if last error was an + async pending operation */ + && ssl->error != WC_PENDING_E + #endif + ) { if ((ssl->error = SendBuffered(ssl)) == 0) { /* fragOffset is non-zero when sending fragments. On the last * fragment, fragOffset is zero again, and the state can be @@ -8598,7 +8604,13 @@ int wolfSSL_accept_TLSv13(WOLFSSL* ssl) } #endif - if (ssl->buffers.outputBuffer.length > 0) { + if (ssl->buffers.outputBuffer.length > 0 + #ifdef WOLFSSL_ASYNC_CRYPT + /* do not send buffered or advance state if last error was an + async pending operation */ + && ssl->error != WC_PENDING_E + #endif + ) { if ((ssl->error = SendBuffered(ssl)) == 0) { /* fragOffset is non-zero when sending fragments. On the last * fragment, fragOffset is zero again, and the state can be