Correctly update internal handshake state on beginHandshake()
Motivation: We missed to correctly update the internal handshake state on beginHandshake() if we was able to finish the handshake directly. Also we not handled the case correctly when beginHandshake() was called after the first handshake was finished, which incorrectly throw an Error. Modifications: - Correctly set internal handshake state in all cases - Correctly handle beginHandshake() once first handshake was finished. Result: Correctly handle OpenSslEngine.beginHandshake()
This commit is contained in:
parent
1485a87e25
commit
179cd9a4a1
@ -1043,8 +1043,8 @@ public final class OpenSslEngine extends SSLEngine {
|
|||||||
public synchronized void beginHandshake() throws SSLException {
|
public synchronized void beginHandshake() throws SSLException {
|
||||||
switch (handshakeState) {
|
switch (handshakeState) {
|
||||||
case NOT_STARTED:
|
case NOT_STARTED:
|
||||||
handshake();
|
|
||||||
handshakeState = HandshakeState.STARTED_EXPLICITLY;
|
handshakeState = HandshakeState.STARTED_EXPLICITLY;
|
||||||
|
handshake();
|
||||||
break;
|
break;
|
||||||
case STARTED_IMPLICITLY:
|
case STARTED_IMPLICITLY:
|
||||||
checkEngineClosed();
|
checkEngineClosed();
|
||||||
@ -1058,6 +1058,7 @@ public final class OpenSslEngine extends SSLEngine {
|
|||||||
handshakeState = HandshakeState.STARTED_EXPLICITLY; // Next time this method is invoked by the user,
|
handshakeState = HandshakeState.STARTED_EXPLICITLY; // Next time this method is invoked by the user,
|
||||||
// we should raise an exception.
|
// we should raise an exception.
|
||||||
break;
|
break;
|
||||||
|
case FINISHED:
|
||||||
case STARTED_EXPLICITLY:
|
case STARTED_EXPLICITLY:
|
||||||
throw RENEGOTIATION_UNSUPPORTED;
|
throw RENEGOTIATION_UNSUPPORTED;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user