From cd986e55865987c95bb89bd48b0ea1b0d7422860 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 30 Jan 2015 23:27:17 +0000 Subject: [PATCH] Move s->s3->rrec to s->rlayer->rrec Reviewed-by: Richard Levitte --- ssl/record/rec_layer.h | 4 +++- ssl/s3_lib.c | 2 -- ssl/ssl_lib.c | 2 ++ ssl/ssl_locl.h | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ssl/record/rec_layer.h b/ssl/record/rec_layer.h index cd1da6182c..3a04b170ee 100644 --- a/ssl/record/rec_layer.h +++ b/ssl/record/rec_layer.h @@ -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) diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 7023ba5d83..825abedd54 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -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 diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index a038b99cd1..0483220f28 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -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); diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 8a16204a2f..5deec91a3a 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -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 -- 2.25.1