SSL3_BUFFER *wb;
SSL_SESSION *sess;
+ wb = RECORD_LAYER_get_wbuf(&s->rlayer);
+
/*
* first check if there is a SSL3_BUFFER still being written out. This
* will happen with non blocking IO
*/
- if (s->s3->wbuf.left != 0) {
+ if (SSL3_BUFFER_get_left(wb) != 0) {
OPENSSL_assert(0); /* XDTLS: want to see if we ever get here */
return (ssl3_write_pending(s, type, buf, len));
}
return 0;
wr = &(s->s3->wrec);
- wb = &(s->s3->wbuf);
sess = s->session;
if ((sess == NULL) ||
#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)
{
unsigned char *p;
size_t len, align = 0, headerlen;
+ SSL3_BUFFER *wb;
+
+ wb = RECORD_LAYER_get_wbuf(&s->rlayer);
if (SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER)
headerlen = DTLS1_RT_HEADER_LENGTH + 1;
align = (-SSL3_RT_HEADER_LENGTH) & (SSL3_ALIGN_PAYLOAD - 1);
#endif
- if (s->s3->wbuf.buf == NULL) {
+ if (wb->buf == NULL) {
len = s->max_send_fragment
+ SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD + headerlen + align;
#ifndef OPENSSL_NO_COMP
if ((p = OPENSSL_malloc(len)) == NULL)
goto err;
- s->s3->wbuf.buf = p;
- s->s3->wbuf.len = len;
+ wb->buf = p;
+ wb->len = len;
}
return 1;
int ssl3_release_write_buffer(SSL *s)
{
- if (s->s3->wbuf.buf != NULL) {
- OPENSSL_free(s->s3->wbuf.buf);
- s->s3->wbuf.buf = NULL;
+ SSL3_BUFFER *wb;
+
+ wb = RECORD_LAYER_get_wbuf(&s->rlayer);
+
+ if (wb->buf != NULL) {
+ OPENSSL_free(wb->buf);
+ wb->buf = NULL;
}
return 1;
}
return;
ssl3_cleanup_key_block(s);
- if (s->s3->wbuf.buf != NULL)
+ 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);
# endif /* !OPENSSL_NO_EC */
#endif /* !OPENSSL_NO_TLSEXT */
- wp = s->s3->wbuf.buf;
- wlen = s->s3->wbuf.len;
+ 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);
- s->s3->wbuf.buf = wp;
- s->s3->wbuf.len = wlen;
+ 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 ret = 0;
if (s->s3->renegotiate) {
- if ((SSL3_BUFFER_get_left(RECORD_LAYER_get_rbuf(&s->rlayer)) == 0) &&
- (s->s3->wbuf.left == 0) && !SSL_in_init(s)) {
+ if ((SSL3_BUFFER_get_left(RECORD_LAYER_get_rbuf(&s->rlayer)) == 0)
+ && (SSL3_BUFFER_get_left(RECORD_LAYER_get_wbuf(&s->rlayer)) == 0)
+ && !SSL_in_init(s)) {
/*
* if we are the server, and we have sent a 'RENEGOTIATE'
* message, we need to go to SSL_ST_ACCEPT.
#if !defined(OPENSSL_NO_MULTIBLOCK) && EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK
unsigned int max_send_fragment;
#endif
- SSL3_BUFFER *wb = &(s->s3->wbuf);
+ SSL3_BUFFER *wb = RECORD_LAYER_get_wbuf(&s->rlayer);
int i;
unsigned int u_len = (unsigned int)len;
int eivlen;
long align = 0;
SSL3_RECORD *wr;
- SSL3_BUFFER *wb = &(s->s3->wbuf);
+ SSL3_BUFFER *wb = RECORD_LAYER_get_wbuf(&s->rlayer);
SSL_SESSION *sess;
/*
unsigned int len)
{
int i;
- SSL3_BUFFER *wb = &(s->s3->wbuf);
+ SSL3_BUFFER *wb = RECORD_LAYER_get_wbuf(&s->rlayer);
/* XXXX */
if ((s->s3->wpend_tot > (int)len)
s->s3->alert_dispatch = 1;
s->s3->send_alert[0] = level;
s->s3->send_alert[1] = desc;
- if (s->s3->wbuf.left == 0) /* data still being written out? */
+ if (SSL3_BUFFER_get_left(RECORD_LAYER_get_wbuf(&s->rlayer)) == 0) {
+ /* data still being written out? */
return s->method->ssl_dispatch_alert(s);
+ }
/*
* else data is still being written out, we will get written some time in
* the future
* that right?
*/
RECORD_LAYER_set_read_ahead(&s->rlayer, read_ahead);
+ RECORD_LAYER_set_ssl(&s->rlayer, s);
return (1);
}