Hi,

Since ChangeCipherSpec is not of handshake message type, the handshake
message sequence number should not be incremented. Only the record level
sequence number shall be incremented.

Proposed patch attached modifies both the TX side and the RX side.

Thanks,
Alex

Hi,

Since ChangeCipherSpec is not of handshake message type, the handshake message sequence number should not be incremented. Only the record level sequence number shall be incremented.

Proposed patch attached modifies both the TX side and the RX side.

Thanks,
Alex

Index: ssl/d1_both.c
===================================================================
RCS file: /data1/Repository/openssl/ssl/d1_both.c,v
retrieving revision 1.4.2.4
diff -u -r1.4.2.4 d1_both.c
--- ssl/d1_both.c	30 Sep 2007 21:20:59 -0000	1.4.2.4
+++ ssl/d1_both.c	11 Oct 2007 00:13:25 -0000
@@ -532,7 +532,7 @@
 	int i,al;
 	struct hm_header_st msg_hdr;
     unsigned long overlap;
-    
+
     /* see if we have the required fragment already */
     if (dtls1_retrieve_buffered_fragment(s, &l))
     {
@@ -814,20 +814,27 @@
 		{
 		p=(unsigned char *)s->init_buf->data;
 		*p++=SSL3_MT_CCS;
-		s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;
-		s->d1->next_handshake_write_seq++;
-		s->init_num=DTLS1_CCS_HEADER_LENGTH;
-
 		if (s->client_version == DTLS1_BAD_VER)
 			{
+			s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;
+            s->d1->next_handshake_write_seq++;
+            s->init_num=DTLS1_CCS_HEADER_LENGTH;
+
 			s2n(s->d1->handshake_write_seq,p);
 			s->init_num+=2;
-			}
 
-		s->init_off=0;
+            s->init_off=0;
 
-		dtls1_set_message_header_int(s, SSL3_MT_CCS, 0, 
-			s->d1->handshake_write_seq, 0, 0);
+            dtls1_set_message_header_int(s, SSL3_MT_CCS, 0, 
+                s->d1->handshake_write_seq, 0, 0);
+			}
+        else
+            {
+            s->init_num=DTLS1_CCS_HEADER_LENGTH;
+            s->init_off=0;
+            dtls1_set_message_header_int(s, SSL3_MT_CCS, 0, 
+                0, 0, 0);
+            }
 
 		/* buffer the message to handle re-xmits */
 		dtls1_buffer_message(s, 1);
Index: ssl/d1_pkt.c
===================================================================
RCS file: /data1/Repository/openssl/ssl/d1_pkt.c,v
retrieving revision 1.4.2.9
diff -u -r1.4.2.9 d1_pkt.c
--- ssl/d1_pkt.c	3 Oct 2007 10:18:06 -0000	1.4.2.9
+++ ssl/d1_pkt.c	11 Oct 2007 00:09:39 -0000
@@ -1003,11 +1003,14 @@
 		if (!ssl3_do_change_cipher_spec(s))
 			goto err;
 
-		/* do this whenever CCS is processed */
-		dtls1_reset_seq_numbers(s, SSL3_CC_READ);
+            /* do this whenever CCS is processed */
+            dtls1_reset_seq_numbers(s, SSL3_CC_READ);
 
-		/* handshake read seq is reset upon handshake completion */
-		s->d1->handshake_read_seq++;
+		    if (s->client_version == DTLS1_BAD_VER)
+			    {
+                    /* handshake read seq is reset upon handshake completion */
+                    s->d1->handshake_read_seq++;
+                };
 
 		goto start;
 		}

Reply via email to