Explicit IV update [from HEAD].
authorAndy Polyakov <appro@openssl.org>
Sun, 30 Sep 2007 22:03:07 +0000 (22:03 +0000)
committerAndy Polyakov <appro@openssl.org>
Sun, 30 Sep 2007 22:03:07 +0000 (22:03 +0000)
ssl/d1_pkt.c

index 333a26c0c2845f981f94888070340721bd42a14f..6a68dd110e4a09f1c902bd5de77ab9b616d96211 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/buffer.h>
 #include <openssl/pqueue.h>
+#include <openssl/rand.h>
 
 static int have_handshake_fragment(SSL *s, int type, unsigned char *buf, 
        int len, int peek);
@@ -1395,8 +1396,14 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len,
 
 
        /* ssl3_enc can only have an error on read */
-       wr->length += bs;  /* bs != 0 in case of CBC.  The enc fn provides
-                                               * the randomness */ 
+       if (bs) /* bs != 0 in case of CBC */
+               {
+               RAND_pseudo_bytes(p,bs);
+               /* master IV and last CBC residue stand for
+                * the rest of randomness */
+               wr->length += bs;
+               }
+
        s->method->ssl3_enc->enc(s,1);
 
        /* record length after mac and block padding */