forked from wolfSSL/wolfssl
Updates from review
This commit is contained in:
@ -762,8 +762,14 @@ static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
|
|||||||
printf("%s\n", tmpBuf);
|
printf("%s\n", tmpBuf);
|
||||||
|
|
||||||
ret = wolfSSL_shutdown(ssl);
|
ret = wolfSSL_shutdown(ssl);
|
||||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE)
|
while (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||||
wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
if (tcp_select(wolfSSL_get_fd(ssl), DEFAULT_TIMEOUT_SEC) ==
|
||||||
|
TEST_RECV_READY) {
|
||||||
|
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||||
|
if (ret == WOLFSSL_SUCCESS)
|
||||||
|
printf("Bidirectional shutdown complete\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -3046,9 +3052,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
|||||||
if (dtlsUDP == 0) { /* don't send alert after "break" command */
|
if (dtlsUDP == 0) { /* don't send alert after "break" command */
|
||||||
ret = wolfSSL_shutdown(ssl);
|
ret = wolfSSL_shutdown(ssl);
|
||||||
while (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
while (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||||
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
if (tcp_select(sockfd, DEFAULT_TIMEOUT_SEC) == TEST_RECV_READY) {
|
||||||
if (ret == WOLFSSL_SUCCESS)
|
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||||
printf("Bidirectional shutdown complete\n");
|
if (ret == WOLFSSL_SUCCESS)
|
||||||
|
printf("Bidirectional shutdown complete\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY)
|
#if defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY)
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
static int devId = INVALID_DEVID;
|
static int devId = INVALID_DEVID;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_TIMEOUT_SEC 2
|
||||||
|
|
||||||
/* Note on using port 0: if the server uses port 0 to bind an ephemeral port
|
/* Note on using port 0: if the server uses port 0 to bind an ephemeral port
|
||||||
* number and is using the ready file for scripted testing, the code in
|
* number and is using the ready file for scripted testing, the code in
|
||||||
* test.h will write the actual port number into the ready file for use
|
* test.h will write the actual port number into the ready file for use
|
||||||
@ -2378,7 +2380,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
|||||||
|
|
||||||
if (dtlsUDP == 0) {
|
if (dtlsUDP == 0) {
|
||||||
ret = SSL_shutdown(ssl);
|
ret = SSL_shutdown(ssl);
|
||||||
while (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||||
ret = SSL_shutdown(ssl); /* bidirectional shutdown */
|
ret = SSL_shutdown(ssl); /* bidirectional shutdown */
|
||||||
if (ret == WOLFSSL_SUCCESS)
|
if (ret == WOLFSSL_SUCCESS)
|
||||||
printf("Bidirectional shutdown complete\n");
|
printf("Bidirectional shutdown complete\n");
|
||||||
|
17
src/ssl.c
17
src/ssl.c
@ -2908,7 +2908,6 @@ WOLFSSL_ABI
|
|||||||
int wolfSSL_shutdown(WOLFSSL* ssl)
|
int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||||
{
|
{
|
||||||
int ret = WOLFSSL_FATAL_ERROR;
|
int ret = WOLFSSL_FATAL_ERROR;
|
||||||
byte tmp;
|
|
||||||
WOLFSSL_ENTER("SSL_shutdown()");
|
WOLFSSL_ENTER("SSL_shutdown()");
|
||||||
|
|
||||||
if (ssl == NULL)
|
if (ssl == NULL)
|
||||||
@ -2947,16 +2946,16 @@ int wolfSSL_shutdown(WOLFSSL* ssl)
|
|||||||
|
|
||||||
/* call wolfSSL_shutdown again for bidirectional shutdown */
|
/* call wolfSSL_shutdown again for bidirectional shutdown */
|
||||||
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
|
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
|
||||||
ret = wolfSSL_read(ssl, &tmp, 1);
|
ret = ProcessReply(ssl);
|
||||||
if (ret < 0) {
|
if (ret == ZERO_RETURN) {
|
||||||
|
/* simulate OpenSSL behavior */
|
||||||
|
ssl->error = WOLFSSL_ERROR_SYSCALL;
|
||||||
|
ret = WOLFSSL_SUCCESS;
|
||||||
|
} else if (ssl->error == WOLFSSL_ERROR_NONE) {
|
||||||
|
ret = WOLFSSL_SHUTDOWN_NOT_DONE;
|
||||||
|
} else {
|
||||||
WOLFSSL_ERROR(ssl->error);
|
WOLFSSL_ERROR(ssl->error);
|
||||||
ret = WOLFSSL_FATAL_ERROR;
|
ret = WOLFSSL_FATAL_ERROR;
|
||||||
} else if (ssl->options.closeNotify) {
|
|
||||||
ssl->error = WOLFSSL_ERROR_SYSCALL; /* simulate OpenSSL behavior */
|
|
||||||
ret = WOLFSSL_SUCCESS;
|
|
||||||
} else if ((ssl->error == WOLFSSL_ERROR_NONE) &&
|
|
||||||
(ret > 0)) {
|
|
||||||
ret = WOLFSSL_SHUTDOWN_NOT_DONE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user