DTLS message_sequence number wrong in rehandshake ServerHello
authorMichael Tuexen <tuexen@fh-muenster.de>
Tue, 13 Aug 2013 17:53:19 +0000 (18:53 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 13 Aug 2013 17:59:41 +0000 (18:59 +0100)
This fix ensures that
* A HelloRequest is retransmitted if not responded by a ClientHello
* The HelloRequest "consumes" the sequence number 0. The subsequent
ServerHello uses the sequence number 1.
* The client also expects the sequence number of the ServerHello to
be 1 if a HelloRequest was received earlier.
This patch fixes the RFC violation.
(cherry picked from commit b62f4daac00303280361924b9cc19b3e27528b15)

Conflicts:

ssl/d1_pkt.c

ssl/d1_pkt.c
ssl/d1_srvr.c

index eb68030d1430252ca5d18aa92639f0c5a2f5b559..cbefaecf8f5267188f13724e5a1a2e63f9a9e1f6 100644 (file)
@@ -984,6 +984,7 @@ start:
                        !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) &&
                        !s->s3->renegotiate)
                        {
+                       s->d1->handshake_read_seq++;
                        ssl3_renegotiate(s);
                        if (ssl3_renegotiate_check(s))
                                {
index 41fac4c688699be549c2b69ac7ed9b3aeb632d9b..0c66d707a2621b979696911c176dc0fc724e0890 100644 (file)
@@ -248,10 +248,11 @@ int dtls1_accept(SSL *s)
                case SSL3_ST_SW_HELLO_REQ_B:
 
                        s->shutdown=0;
+                       dtls1_clear_record_buffer(s);
                        dtls1_start_timer(s);
                        ret=dtls1_send_hello_request(s);
                        if (ret <= 0) goto end;
-                       s->s3->tmp.next_state=SSL3_ST_SW_HELLO_REQ_C;
+                       s->s3->tmp.next_state=SSL3_ST_SR_CLNT_HELLO_A;
                        s->state=SSL3_ST_SW_FLUSH;
                        s->init_num=0;