Encapsulate s->s3->wrec
authorMatt Caswell <matt@openssl.org>
Sun, 1 Feb 2015 15:30:37 +0000 (15:30 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 26 Mar 2015 13:53:07 +0000 (13:53 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
ssl/d1_pkt.c
ssl/record/rec_layer.h
ssl/s3_enc.c
ssl/s3_lib.c
ssl/s3_pkt.c
ssl/t1_enc.c

index 69a2467e0eb3e3da2a29599de1522c37c270d38d..fbfc7232df91685889e2cdf5a5d18e51d51f524c 100644 (file)
@@ -1468,7 +1468,7 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
     if (len == 0 && !create_empty_fragment)
         return 0;
 
-    wr = &(s->s3->wrec);
+    wr = RECORD_LAYER_get_wrec(&s->rlayer);
     sess = s->session;
 
     if ((sess == NULL) ||
index 3a04b170ee257e4f03acf74a12d3d1c3fdc17c11..786d1a162349be71a5d28ee3be3aa4f89f60b405 100644 (file)
@@ -133,3 +133,4 @@ typedef struct record_layer_st {
 #define RECORD_LAYER_get_rbuf(rl)               (&(rl)->rbuf)
 #define RECORD_LAYER_get_wbuf(rl)               (&(rl)->wbuf)
 #define RECORD_LAYER_get_rrec(rl)               (&(rl)->rrec)
+#define RECORD_LAYER_get_wrec(rl)               (&(rl)->s->s3->wrec)
index b36aca8891d1e8007c10cd90fd70dbbd595d29b8..19cd49a85e0d072095d5ea3169c8f8481b9ebedd 100644 (file)
@@ -500,7 +500,7 @@ int ssl3_enc(SSL *s, int send)
 
     if (send) {
         ds = s->enc_write_ctx;
-        rec = &(s->s3->wrec);
+        rec = RECORD_LAYER_get_wrec(&s->rlayer);
         if (s->enc_write_ctx == NULL)
             enc = NULL;
         else
@@ -725,7 +725,7 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
     int t;
 
     if (send) {
-        rec = &(ssl->s3->wrec);
+        rec = RECORD_LAYER_get_wrec(&ssl->rlayer);
         mac_sec = &(ssl->s3->write_mac_secret[0]);
         seq = &(ssl->s3->write_sequence[0]);
         hash = ssl->write_hash;
index 825abedd540f3761ac1cd8fee08a4861b395acab..eaa15ba8638d4720daca8264c72862c08911c493 100644 (file)
@@ -3112,7 +3112,7 @@ int ssl3_new(SSL *s)
         goto err;
     memset(s3, 0, sizeof *s3);
     s->s3 = s3;
-    memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num));
+    SSL3_RECORD_clear(RECORD_LAYER_get_wrec(&s->rlayer));
     
 #ifndef OPENSSL_NO_SRP
     if(!SSL_SRP_CTX_init(s))
index b86ee1e5cf1f0f99d0ad28fbf678a9f3d7aad819..1ec76664be5b58373f0b3c2f91d6fcf46964b9f1 100644 (file)
@@ -619,7 +619,7 @@ int ssl3_do_compress(SSL *ssl)
     int i;
     SSL3_RECORD *wr;
 
-    wr = &(ssl->s3->wrec);
+    wr = RECORD_LAYER_get_wrec(&ssl->rlayer);
     i = COMP_compress_block(ssl->compress, wr->data,
                             SSL3_RT_MAX_COMPRESSED_LENGTH,
                             wr->input, (int)wr->length);
@@ -900,7 +900,7 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
     if (len == 0 && !create_empty_fragment)
         return 0;
 
-    wr = &(s->s3->wrec);
+    wr = RECORD_LAYER_get_wrec(&s->rlayer);
     sess = s->session;
 
     if ((sess == NULL) ||
index 70ea6c0796e8624ac16a87cfca5ff4ac4224f1b3..9f876b4745f8ed7b2e2b619a2c6c1086477ef467 100644 (file)
@@ -749,7 +749,7 @@ int tls1_enc(SSL *s, int send)
             OPENSSL_assert(n >= 0);
         }
         ds = s->enc_write_ctx;
-        rec = &(s->s3->wrec);
+        rec = RECORD_LAYER_get_wrec(&s->rlayer);
         if (s->enc_write_ctx == NULL)
             enc = NULL;
         else {
@@ -971,7 +971,7 @@ int tls1_mac(SSL *ssl, unsigned char *md, int send)
     int t;
 
     if (send) {
-        rec = &(ssl->s3->wrec);
+        rec = RECORD_LAYER_get_wrec(&ssl->rlayer);
         seq = &(ssl->s3->write_sequence[0]);
         hash = ssl->write_hash;
     } else {