Move s->s3->rrec to s->rlayer->rrec
authorMatt Caswell <matt@openssl.org>
Fri, 30 Jan 2015 23:27:17 +0000 (23:27 +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/record/rec_layer.h
ssl/s3_lib.c
ssl/ssl_lib.c
ssl/ssl_locl.h

index cd1da6182cebee60c1ec0003fe5b2def3658742e..3a04b170ee257e4f03acf74a12d3d1c3fdc17c11 100644 (file)
@@ -123,6 +123,8 @@ typedef struct record_layer_st {
     SSL3_BUFFER rbuf;
     /* write IO goes into here */
     SSL3_BUFFER wbuf;
+    /* each decoded record goes in here */
+    SSL3_RECORD rrec;
 } RECORD_LAYER;
 
 #define RECORD_LAYER_set_ssl(rl, s)             ((rl)->s = (s))
@@ -130,4 +132,4 @@ typedef struct record_layer_st {
 #define RECORD_LAYER_get_read_ahead(rl)         ((rl)->read_ahead)
 #define RECORD_LAYER_get_rbuf(rl)               (&(rl)->rbuf)
 #define RECORD_LAYER_get_wbuf(rl)               (&(rl)->wbuf)
-#define RECORD_LAYER_get_rrec(rl)               (&(rl)->s->s3->rrec)
+#define RECORD_LAYER_get_rrec(rl)               (&(rl)->rrec)
index 7023ba5d8365d951883c7cd1396332e433f9f4f5..825abedd540f3761ac1cd8fee08a4861b395acab 100644 (file)
@@ -3112,7 +3112,6 @@ int ssl3_new(SSL *s)
         goto err;
     memset(s3, 0, sizeof *s3);
     s->s3 = s3;
-    SSL3_RECORD_clear(RECORD_LAYER_get_rrec(&s->rlayer));
     memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num));
     
 #ifndef OPENSSL_NO_SRP
@@ -3131,7 +3130,6 @@ void ssl3_free(SSL *s)
         return;
 
     ssl3_cleanup_key_block(s);
-    SSL3_RECORD_release(RECORD_LAYER_get_rrec(&s->rlayer));
 #ifndef OPENSSL_NO_DH
     DH_free(s->s3->tmp.dh);
 #endif
index a038b99cd14a31bf19853c7f810ef049d052483b..0483220f288f17c42047f70b0d1fe5eea873a1f7 100644 (file)
@@ -303,6 +303,7 @@ SSL *SSL_new(SSL_CTX *ctx)
     memset(s, 0, sizeof(SSL));
 
     RECORD_LAYER_set_ssl(&s->rlayer, s);
+    SSL3_RECORD_clear(RECORD_LAYER_get_rrec(&s->rlayer));
 
 #ifndef OPENSSL_NO_KRB5
     s->kssl_ctx = kssl_ctx_new();
@@ -625,6 +626,7 @@ void SSL_free(SSL *s)
         ssl3_release_read_buffer(s);
     if (SSL3_BUFFER_is_initialised(RECORD_LAYER_get_wbuf(&s->rlayer)))
         ssl3_release_write_buffer(s);
+    SSL3_RECORD_release(RECORD_LAYER_get_rrec(&s->rlayer));
 
     if (s->ctx)
         SSL_CTX_free(s->ctx);
index 8a16204a2f32d73b807738cf4dfaa4aefce8358f..5deec91a3a5b3d5792f19bef56c186260a330a2a 100644 (file)
@@ -1241,7 +1241,6 @@ typedef struct ssl3_state_st {
     int empty_fragment_done;
     /* The value of 'extra' when the buffers were initialized */
     int init_extra;
-    SSL3_RECORD rrec;            /* each decoded record goes in here */
     SSL3_RECORD wrec;           /* goes out from here */
     /*
      * storage for Alert/Handshake protocol data received but not yet