Move s->s3->wbuf to s->rlayer->wbuf
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
db9a32e719
commit
ab97b2cd43
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user