summaryrefslogtreecommitdiff
path: root/ssl
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-01-30 16:17:25 +0000
committerMatt Caswell <matt@openssl.org>2015-03-26 13:53:07 +0000
commitab97b2cd4301074fd88fd2f13b8c79342593dae4 (patch)
tree37569cf6c1cfdbf7d611e9c7cfd2473fad202d75 /ssl
parentdb9a32e7193ef5841e5a021061237b8b24f68126 (diff)
downloadopenssl-new-ab97b2cd4301074fd88fd2f13b8c79342593dae4.tar.gz
Move s->s3->wbuf to s->rlayer->wbuf
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r--ssl/record/rec_layer.h4
-rw-r--r--ssl/s3_lib.c8
-rw-r--r--ssl/ssl_lib.c10
-rw-r--r--ssl/ssl_locl.h1
4 files changed, 11 insertions, 12 deletions
diff --git a/ssl/record/rec_layer.h b/ssl/record/rec_layer.h
index 1284290e84..19fe04870c 100644
--- a/ssl/record/rec_layer.h
+++ b/ssl/record/rec_layer.h
@@ -121,10 +121,12 @@ typedef struct record_layer_st {
int read_ahead;
/* read IO goes into here */
SSL3_BUFFER rbuf;
+ /* write IO goes into here */
+ SSL3_BUFFER wbuf;
} RECORD_LAYER;
#define RECORD_LAYER_set_ssl(rl, s) ((rl)->s = (s))
#define RECORD_LAYER_set_read_ahead(rl, ra) ((rl)->read_ahead = (ra))
#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)->s->s3->wbuf)
+#define RECORD_LAYER_get_wbuf(rl) (&(rl)->wbuf)
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index 28eccb4ea0..948e14e5a4 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -3131,8 +3131,6 @@ void ssl3_free(SSL *s)
return;
ssl3_cleanup_key_block(s);
- if (SSL3_BUFFER_is_initialised(RECORD_LAYER_get_wbuf(&s->rlayer)))
- ssl3_release_write_buffer(s);
if (s->s3->rrec.comp != NULL)
OPENSSL_free(s->s3->rrec.comp);
#ifndef OPENSSL_NO_DH
@@ -3162,8 +3160,6 @@ void ssl3_free(SSL *s)
void ssl3_clear(SSL *s)
{
- unsigned char *wp;
- size_t wlen;
int init_extra;
ssl3_cleanup_key_block(s);
@@ -3188,8 +3184,6 @@ void ssl3_clear(SSL *s)
# endif /* !OPENSSL_NO_EC */
#endif /* !OPENSSL_NO_TLSEXT */
- wp = SSL3_BUFFER_get_buf(RECORD_LAYER_get_wbuf(&s->rlayer));
- wlen = SSL3_BUFFER_get_len(RECORD_LAYER_get_wbuf(&s->rlayer));
init_extra = s->s3->init_extra;
BIO_free(s->s3->handshake_buffer);
s->s3->handshake_buffer = NULL;
@@ -3203,8 +3197,6 @@ void ssl3_clear(SSL *s)
}
#endif
memset(s->s3, 0, sizeof *s->s3);
- SSL3_BUFFER_set_buf(RECORD_LAYER_get_wbuf(&s->rlayer), wp);
- SSL3_BUFFER_set_len(RECORD_LAYER_get_wbuf(&s->rlayer), wlen);
s->s3->init_extra = init_extra;
ssl_free_wbio_buffer(s);
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 5537f1693b..a038b99cd1 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -189,8 +189,8 @@ SSL3_ENC_METHOD ssl3_undef_enc_method = {
int SSL_clear(SSL *s)
{
- unsigned char *rp;
- size_t rlen;
+ unsigned char *rp, *wp;
+ size_t rlen, wlen;
int read_ahead;
if (s->method == NULL) {
@@ -248,9 +248,13 @@ int SSL_clear(SSL *s)
read_ahead = RECORD_LAYER_get_read_ahead(&s->rlayer);
rp = SSL3_BUFFER_get_buf(RECORD_LAYER_get_rbuf(&s->rlayer));
rlen = SSL3_BUFFER_get_len(RECORD_LAYER_get_rbuf(&s->rlayer));
+ wp = SSL3_BUFFER_get_buf(RECORD_LAYER_get_wbuf(&s->rlayer));
+ wlen = SSL3_BUFFER_get_len(RECORD_LAYER_get_wbuf(&s->rlayer));
memset(&s->rlayer, 0, sizeof s->rlayer);
SSL3_BUFFER_set_buf(RECORD_LAYER_get_rbuf(&s->rlayer), rp);
SSL3_BUFFER_set_len(RECORD_LAYER_get_rbuf(&s->rlayer), rlen);
+ SSL3_BUFFER_set_buf(RECORD_LAYER_get_wbuf(&s->rlayer), wp);
+ SSL3_BUFFER_set_len(RECORD_LAYER_get_wbuf(&s->rlayer), wlen);
/* Do I need to do this? As far as I can tell read_ahead did not
* previously get reset by SSL_clear...so I'll keep it that way..but is
@@ -619,6 +623,8 @@ void SSL_free(SSL *s)
if (SSL3_BUFFER_is_initialised(RECORD_LAYER_get_rbuf(&s->rlayer)))
ssl3_release_read_buffer(s);
+ if (SSL3_BUFFER_is_initialised(RECORD_LAYER_get_wbuf(&s->rlayer)))
+ ssl3_release_write_buffer(s);
if (s->ctx)
SSL_CTX_free(s->ctx);
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index 6925992c7b..8163b99095 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -1281,7 +1281,6 @@ typedef struct ssl3_state_st {
int empty_fragment_done;
/* The value of 'extra' when the buffers were initialized */
int init_extra;
- SSL3_BUFFER wbuf; /* write IO goes into here */
SSL3_RECORD rrec; /* each decoded record goes in here */
SSL3_RECORD wrec; /* goes out from here */
/*