|
|
5820f5 |
diff -up openssl-fips-0.9.8e/ssl/ssl3.h.keying-mitm openssl-fips-0.9.8e/ssl/ssl3.h
|
|
|
5820f5 |
--- openssl-fips-0.9.8e/ssl/ssl3.h.keying-mitm 2014-06-02 15:49:35.036283939 +0200
|
|
|
5820f5 |
+++ openssl-fips-0.9.8e/ssl/ssl3.h 2014-06-02 17:00:09.808186361 +0200
|
|
|
5820f5 |
@@ -344,6 +344,7 @@ typedef struct ssl3_buffer_st
|
|
|
5820f5 |
* effected, but we can't prevent that.
|
|
|
5820f5 |
*/
|
|
|
5820f5 |
#define SSL3_FLAGS_SGC_RESTART_DONE 0x0040
|
|
|
5820f5 |
+#define SSL3_FLAGS_CCS_OK 0x0080
|
|
|
5820f5 |
|
|
|
5820f5 |
typedef struct ssl3_state_st
|
|
|
5820f5 |
{
|
|
|
5820f5 |
diff -up openssl-fips-0.9.8e/ssl/s3_clnt.c.keying-mitm openssl-fips-0.9.8e/ssl/s3_clnt.c
|
|
|
5820f5 |
--- openssl-fips-0.9.8e/ssl/s3_clnt.c.keying-mitm 2014-06-02 15:45:18.346349601 +0200
|
|
|
5820f5 |
+++ openssl-fips-0.9.8e/ssl/s3_clnt.c 2014-06-02 15:49:35.036283939 +0200
|
|
|
5820f5 |
@@ -425,6 +425,7 @@ int ssl3_connect(SSL *s)
|
|
|
5820f5 |
case SSL3_ST_CR_FINISHED_A:
|
|
|
5820f5 |
case SSL3_ST_CR_FINISHED_B:
|
|
|
5820f5 |
|
|
|
5820f5 |
+ s->s3->flags |= SSL3_FLAGS_CCS_OK;
|
|
|
5820f5 |
ret=ssl3_get_finished(s,SSL3_ST_CR_FINISHED_A,
|
|
|
5820f5 |
SSL3_ST_CR_FINISHED_B);
|
|
|
5820f5 |
if (ret <= 0) goto end;
|
|
|
5820f5 |
@@ -706,6 +707,7 @@ int ssl3_get_server_hello(SSL *s)
|
|
|
5820f5 |
SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT);
|
|
|
5820f5 |
goto f_err;
|
|
|
5820f5 |
}
|
|
|
5820f5 |
+ s->s3->flags |= SSL3_FLAGS_CCS_OK;
|
|
|
5820f5 |
s->hit=1;
|
|
|
5820f5 |
}
|
|
|
5820f5 |
else /* a miss or crap from the other end */
|
|
|
5820f5 |
diff -up openssl-fips-0.9.8e/ssl/s3_pkt.c.keying-mitm openssl-fips-0.9.8e/ssl/s3_pkt.c
|
|
|
5820f5 |
--- openssl-fips-0.9.8e/ssl/s3_pkt.c.keying-mitm 2014-06-02 15:45:18.375350271 +0200
|
|
|
5820f5 |
+++ openssl-fips-0.9.8e/ssl/s3_pkt.c 2014-06-02 15:49:35.037283962 +0200
|
|
|
5820f5 |
@@ -1133,6 +1133,15 @@ start:
|
|
|
5820f5 |
goto f_err;
|
|
|
5820f5 |
}
|
|
|
5820f5 |
|
|
|
5820f5 |
+ if (!(s->s3->flags & SSL3_FLAGS_CCS_OK))
|
|
|
5820f5 |
+ {
|
|
|
5820f5 |
+ al=SSL_AD_UNEXPECTED_MESSAGE;
|
|
|
5820f5 |
+ SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_CCS_RECEIVED_EARLY);
|
|
|
5820f5 |
+ goto f_err;
|
|
|
5820f5 |
+ }
|
|
|
5820f5 |
+
|
|
|
5820f5 |
+ s->s3->flags &= ~SSL3_FLAGS_CCS_OK;
|
|
|
5820f5 |
+
|
|
|
5820f5 |
rr->length=0;
|
|
|
5820f5 |
|
|
|
5820f5 |
if (s->msg_callback)
|
|
|
5820f5 |
@@ -1264,7 +1273,7 @@ int ssl3_do_change_cipher_spec(SSL *s)
|
|
|
5820f5 |
|
|
|
5820f5 |
if (s->s3->tmp.key_block == NULL)
|
|
|
5820f5 |
{
|
|
|
5820f5 |
- if (s->session == NULL)
|
|
|
5820f5 |
+ if (s->session == NULL || s->session->master_key_length == 0)
|
|
|
5820f5 |
{
|
|
|
5820f5 |
/* might happen if dtls1_read_bytes() calls this */
|
|
|
5820f5 |
SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC,SSL_R_CCS_RECEIVED_EARLY);
|
|
|
5820f5 |
diff -up openssl-fips-0.9.8e/ssl/s3_srvr.c.keying-mitm openssl-fips-0.9.8e/ssl/s3_srvr.c
|
|
|
5820f5 |
--- openssl-fips-0.9.8e/ssl/s3_srvr.c.keying-mitm 2014-06-02 15:45:18.362349971 +0200
|
|
|
5820f5 |
+++ openssl-fips-0.9.8e/ssl/s3_srvr.c 2014-06-02 15:49:35.037283962 +0200
|
|
|
5820f5 |
@@ -492,6 +492,7 @@ int ssl3_accept(SSL *s)
|
|
|
5820f5 |
case SSL3_ST_SR_CERT_VRFY_A:
|
|
|
5820f5 |
case SSL3_ST_SR_CERT_VRFY_B:
|
|
|
5820f5 |
|
|
|
5820f5 |
+ s->s3->flags |= SSL3_FLAGS_CCS_OK;
|
|
|
5820f5 |
/* we should decide if we expected this one */
|
|
|
5820f5 |
ret=ssl3_get_cert_verify(s);
|
|
|
5820f5 |
if (ret <= 0) goto end;
|
|
|
5820f5 |
@@ -502,6 +503,7 @@ int ssl3_accept(SSL *s)
|
|
|
5820f5 |
|
|
|
5820f5 |
case SSL3_ST_SR_FINISHED_A:
|
|
|
5820f5 |
case SSL3_ST_SR_FINISHED_B:
|
|
|
5820f5 |
+ s->s3->flags |= SSL3_FLAGS_CCS_OK;
|
|
|
5820f5 |
ret=ssl3_get_finished(s,SSL3_ST_SR_FINISHED_A,
|
|
|
5820f5 |
SSL3_ST_SR_FINISHED_B);
|
|
|
5820f5 |
if (ret <= 0) goto end;
|