提交 89e93ab5 编写于 作者: J juh

8057555: Less cryptic cipher suite management

Reviewed-by: xuelei, igerasim, mullan, asmotrak
Contributed-by: jamil.j.nimeh@oracle.com
上级 802534e9
...@@ -345,6 +345,13 @@ final class ClientHandshaker extends Handshaker { ...@@ -345,6 +345,13 @@ final class ClientHandshaker extends Handshaker {
break; break;
case HandshakeMessage.ht_finished: case HandshakeMessage.ht_finished:
// A ChangeCipherSpec record must have been received prior to
// reception of the Finished message (RFC 5246, 7.4.9).
if (!receivedChangeCipherSpec()) {
fatalSE(Alerts.alert_handshake_failure,
"Received Finished message before ChangeCipherSpec");
}
this.serverFinished( this.serverFinished(
new Finished(protocolVersion, input, cipherSuite)); new Finished(protocolVersion, input, cipherSuite));
break; break;
......
...@@ -360,6 +360,14 @@ abstract class Handshaker { ...@@ -360,6 +360,14 @@ abstract class Handshaker {
} }
} }
final boolean receivedChangeCipherSpec() {
if (conn != null) {
return conn.receivedChangeCipherSpec();
} else {
return engine.receivedChangeCipherSpec();
}
}
String getEndpointIdentificationAlgorithmSE() { String getEndpointIdentificationAlgorithmSE() {
SSLParameters paras; SSLParameters paras;
if (conn != null) { if (conn != null) {
......
...@@ -2140,6 +2140,14 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2140,6 +2140,14 @@ final public class SSLEngineImpl extends SSLEngine {
} }
} }
/*
* Returns a boolean indicating whether the ChangeCipherSpec message
* has been received for this handshake.
*/
boolean receivedChangeCipherSpec() {
return receivedCCS;
}
/** /**
* Returns a printable representation of this end of the connection. * Returns a printable representation of this end of the connection.
*/ */
......
...@@ -2570,6 +2570,14 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2570,6 +2570,14 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
} }
} }
/*
* Returns a boolean indicating whether the ChangeCipherSpec message
* has been received for this handshake.
*/
boolean receivedChangeCipherSpec() {
return receivedCCS;
}
// //
// We allocate a separate thread to deliver handshake completion // We allocate a separate thread to deliver handshake completion
// events. This ensures that the notifications don't block the // events. This ensures that the notifications don't block the
......
...@@ -287,6 +287,13 @@ final class ServerHandshaker extends Handshaker { ...@@ -287,6 +287,13 @@ final class ServerHandshaker extends Handshaker {
break; break;
case HandshakeMessage.ht_finished: case HandshakeMessage.ht_finished:
// A ChangeCipherSpec record must have been received prior to
// reception of the Finished message (RFC 5246, 7.4.9).
if (!receivedChangeCipherSpec()) {
fatalSE(Alerts.alert_handshake_failure,
"Received Finished message before ChangeCipherSpec");
}
this.clientFinished( this.clientFinished(
new Finished(protocolVersion, input, cipherSuite)); new Finished(protocolVersion, input, cipherSuite));
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册