Merge pull request #2663 from embhorn/zd5050

Clarify wolfSSL_shutdown error on subsequent calls
This commit is contained in:
toddouska 2019-12-17 14:59:35 -08:00 committed by GitHub
commit 06e5e81b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -17303,6 +17303,9 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
case CLIENT_CERT_CB_ERROR:
return "Error importing client cert or key from callback";
case SSL_SHUTDOWN_ALREADY_DONE_E:
return "Shutdown has already occurred";
default :
return "unknown error number";
}

View File

@ -2884,6 +2884,14 @@ int wolfSSL_shutdown(WOLFSSL* ssl)
}
}
#ifdef WOLFSSL_SHUTDOWNONCE
if (ssl->options.isClosed || ssl->options.connReset) {
/* Shutdown has already occurred.
* Caller is free to ignore this error. */
return SSL_SHUTDOWN_ALREADY_DONE_E;
}
#endif
/* call wolfSSL_shutdown again for bidirectional shutdown */
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
ret = wolfSSL_read(ssl, &tmp, 0);

View File

@ -165,6 +165,8 @@ enum wolfSSL_ErrorCodes {
TCA_ABSENT_ERROR = -434, /* TLSX TCA ID no response */
TSIP_MAC_DIGSZ_E = -435, /* Invalid MAC size for TSIP */
CLIENT_CERT_CB_ERROR = -436, /* Client cert callback error */
SSL_SHUTDOWN_ALREADY_DONE_E = -437, /* Shutdown called redundantly */
/* add strings to wolfSSL_ERR_reason_error_string in internal.c !!!!! */
/* begin negotiation parameter errors */