The message header for fake SSL 3.0/TLS 1.0 client hellos created from
[openssl.git] / ssl / s23_srvr.c
index e0abbaf834a1988ae86184db31c4a9075652d341..563531f1201864800a0a36c20d61a142e897e572 100644 (file)
@@ -202,7 +202,7 @@ int ssl23_get_client_hello(SSL *s)
                             *  9/10  client_version  /
                             */
        char *buf= &(buf_space[0]);
-       unsigned char *p,*d,*dd;
+       unsigned char *p,*d,*d_len,*dd;
        unsigned int i;
        unsigned int csl,sil,cl;
        int n=0,j;
@@ -365,6 +365,13 @@ int ssl23_get_client_hello(SSL *s)
                        goto err;
                        }
 
+               /* record header: msg_type ... */
+               *(d++) = SSL3_MT_CLIENT_HELLO;
+               /* ... and length (actual value will be written later) */
+               d_len = d;
+               d += 3;
+
+               /* client_version */
                *(d++) = SSL3_VERSION_MAJOR; /* == v[0] */
                *(d++) = v[1];
 
@@ -396,6 +403,7 @@ int ssl23_get_client_hello(SSL *s)
                *(d++)=0;
                
                i=(d-(unsigned char *)s->init_buf->data);
+               l2n3((long)i, d_len);
 
                /* get the data reused from the init_buf */
                s->s3->tmp.reuse_message=1;