There are a few showstoppers. Unfortunately, I only remember one. Please fill this in.
[openssl.git] / ssl / t1_enc.c
index bfcd7d9191ffc369d9cf5cf89a1dcd5e8e4f50d7..cfcfedaa5d9675485c27ee91726c19f4b8a6d154 100644 (file)
@@ -284,7 +284,9 @@ int tls1_change_cipher_state(SSL *s, int which)
                        if (s->s3->rrec.comp == NULL)
                                goto err;
                        }
-               memset(&(s->s3->read_sequence[0]),0,8);
+               /* this is done by dtls1_reset_seq_numbers for DTLS1_VERSION */
+               if (s->version != DTLS1_VERSION)
+                       memset(&(s->s3->read_sequence[0]),0,8);
                mac_secret= &(s->s3->read_mac_secret[0]);
                }
        else
@@ -313,7 +315,9 @@ int tls1_change_cipher_state(SSL *s, int which)
                                goto err2;
                                }
                        }
-               memset(&(s->s3->write_sequence[0]),0,8);
+               /* this is done by dtls1_reset_seq_numbers for DTLS1_VERSION */
+               if (s->version != DTLS1_VERSION)
+                       memset(&(s->s3->write_sequence[0]),0,8);
                mac_secret= &(s->s3->write_mac_secret[0]);
                }
 
@@ -742,10 +746,13 @@ printf("rec=");
 {unsigned int z; for (z=0; z<rec->length; z++) printf("%02X ",buf[z]); printf("\n"); }
 #endif
 
-       for (i=7; i>=0; i--)
-               {
-               ++seq[i];
-               if (seq[i] != 0) break; 
+    if ( SSL_version(ssl) != DTLS1_VERSION)
+           {
+               for (i=7; i>=0; i--)
+                       {
+                       ++seq[i];
+                       if (seq[i] != 0) break; 
+                       }
                }
 
 #ifdef TLS_DEBUG
@@ -808,6 +815,8 @@ int tls1_alert_code(int code)
        case SSL_AD_INTERNAL_ERROR:     return(TLS1_AD_INTERNAL_ERROR);
        case SSL_AD_USER_CANCELLED:     return(TLS1_AD_USER_CANCELLED);
        case SSL_AD_NO_RENEGOTIATION:   return(TLS1_AD_NO_RENEGOTIATION);
+       case DTLS1_AD_MISSING_HANDSHAKE_MESSAGE: return 
+                                         (DTLS1_AD_MISSING_HANDSHAKE_MESSAGE);
        default:                        return(-1);
                }
        }