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)
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
void ssl3_clear(SSL *s)
{
- unsigned char *wp;
- size_t wlen;
int init_extra;
ssl3_cleanup_key_block(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;
}
#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);
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) {
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
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);
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 */
/*