SSLEngine: correct return of ClosingConnection() to SSL_SUCCESS when ZERO_RETURN is received

pull/193/head
Chris Conlon 2024-05-15 15:19:52 -06:00
parent 00a9bb467b
commit c8db5aa5f3
2 changed files with 6 additions and 2 deletions

View File

@ -345,6 +345,7 @@ public class WolfSSLEngine extends SSLEngine {
/**
* Handles logic during shutdown
*
* @return WolfSSL.SSL_SUCCESS on success, zero or negative on error
* @throws SocketException if ssl.shutdownSSL() encounters a socket error
*/
private synchronized int ClosingConnection() throws SocketException {
@ -374,11 +375,11 @@ public class WolfSSLEngine extends SSLEngine {
synchronized (ioLock) {
ret = ssl.shutdownSSL();
if (ssl.getError(ret) == WolfSSL.SSL_ERROR_ZERO_RETURN) {
/* got close_notify alert, reset ret to 0 to continue
/* got close_notify alert, reset ret to SSL_SUCCESS to continue
* and let corresponding close_notify to be sent */
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
"ClosingConnection(), ssl.getError() is ZERO_RETURN");
ret = 0;
ret = WolfSSL.SSL_SUCCESS;
}
}
UpdateCloseNotifyStatus();

View File

@ -316,6 +316,9 @@ public class WolfSSLImplementSSLSession extends ExtendedSSLSession
* Invalidate this session
*/
public synchronized void invalidate() {
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
"SSLSession.invalidate() called, invalidating session");
this.valid = false;
}