diff options
author | Matt Caswell <matt@openssl.org> | 2022-11-02 16:19:51 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2022-11-14 08:51:25 +0100 |
commit | e9189cc4af045523f91b2d9265add1ab1326fcdf (patch) | |
tree | 7f53f419d75f19db074609bebca490d1959ef232 /ssl/record | |
parent | Move declarations out of record.h and record_local.h (diff) | |
download | openssl-e9189cc4af045523f91b2d9265add1ab1326fcdf.tar.xz openssl-e9189cc4af045523f91b2d9265add1ab1326fcdf.zip |
Rename SSL3_BUFFER to TLS_BUFFER
The SSL3 prefix no longer seems appropriate.
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19586)
Diffstat (limited to 'ssl/record')
-rw-r--r-- | ssl/record/methods/dtls_meth.c | 12 | ||||
-rw-r--r-- | ssl/record/methods/ktls_meth.c | 10 | ||||
-rw-r--r-- | ssl/record/methods/recmethod_local.h | 46 | ||||
-rw-r--r-- | ssl/record/methods/tls1_meth.c | 12 | ||||
-rw-r--r-- | ssl/record/methods/tls_common.c | 90 | ||||
-rw-r--r-- | ssl/record/methods/tls_multib.c | 2 |
6 files changed, 86 insertions, 86 deletions
diff --git a/ssl/record/methods/dtls_meth.c b/ssl/record/methods/dtls_meth.c index b16c400dea..1bd0540d83 100644 --- a/ssl/record/methods/dtls_meth.c +++ b/ssl/record/methods/dtls_meth.c @@ -303,14 +303,14 @@ static int dtls_rlayer_buffer_record(OSSL_RECORD_LAYER *rl, record_pqueue *queue rdata->packet = rl->packet; rdata->packet_length = rl->packet_length; - memcpy(&(rdata->rbuf), &rl->rbuf, sizeof(SSL3_BUFFER)); + memcpy(&(rdata->rbuf), &rl->rbuf, sizeof(TLS_BUFFER)); memcpy(&(rdata->rrec), &rl->rrec[0], sizeof(SSL3_RECORD)); item->data = rdata; rl->packet = NULL; rl->packet_length = 0; - memset(&rl->rbuf, 0, sizeof(SSL3_BUFFER)); + memset(&rl->rbuf, 0, sizeof(TLS_BUFFER)); memset(&rl->rrec[0], 0, sizeof(rl->rrec[0])); if (!tls_setup_read_buffer(rl)) { @@ -338,11 +338,11 @@ static int dtls_copy_rlayer_record(OSSL_RECORD_LAYER *rl, pitem *item) rdata = (DTLS_RLAYER_RECORD_DATA *)item->data; - SSL3_BUFFER_release(&rl->rbuf); + ossl_tls_buffer_release(&rl->rbuf); rl->packet = rdata->packet; rl->packet_length = rdata->packet_length; - memcpy(&rl->rbuf, &(rdata->rbuf), sizeof(SSL3_BUFFER)); + memcpy(&rl->rbuf, &(rdata->rbuf), sizeof(TLS_BUFFER)); memcpy(&rl->rrec[0], &(rdata->rrec), sizeof(SSL3_RECORD)); /* Set proper sequence number for mac calculation */ @@ -415,7 +415,7 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl) if ((rl->rstate != SSL_ST_READ_BODY) || (rl->packet_length < DTLS1_RT_HEADER_LENGTH)) { rret = rl->funcs->read_n(rl, DTLS1_RT_HEADER_LENGTH, - SSL3_BUFFER_get_len(&rl->rbuf), 0, 1, &n); + TLS_BUFFER_get_len(&rl->rbuf), 0, 1, &n); /* read timeout is handled by dtls1_read_bytes */ if (rret < OSSL_RECORD_RETURN_SUCCESS) { /* RLAYERfatal() already called if appropriate */ @@ -577,7 +577,7 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl) static int dtls_free(OSSL_RECORD_LAYER *rl) { - SSL3_BUFFER *rbuf; + TLS_BUFFER *rbuf; size_t left, written; pitem *item; DTLS_RLAYER_RECORD_DATA *rdata; diff --git a/ssl/record/methods/ktls_meth.c b/ssl/record/methods/ktls_meth.c index 2d14cfe317..ca1788b551 100644 --- a/ssl/record/methods/ktls_meth.c +++ b/ssl/record/methods/ktls_meth.c @@ -455,10 +455,10 @@ static int ktls_initialise_write_packets(OSSL_RECORD_LAYER *rl, size_t numtempl, OSSL_RECORD_TEMPLATE *prefixtempl, WPACKET *pkt, - SSL3_BUFFER *bufs, + TLS_BUFFER *bufs, size_t *wpinited) { - SSL3_BUFFER *wb; + TLS_BUFFER *wb; /* * We just use the application buffer directly and don't use any WPACKET @@ -473,9 +473,9 @@ static int ktls_initialise_write_packets(OSSL_RECORD_LAYER *rl, * This doesn't leak memory because the buffers have never been allocated * with KTLS */ - SSL3_BUFFER_set_buf(wb, (unsigned char *)templates[0].buf); - SSL3_BUFFER_set_offset(wb, 0); - SSL3_BUFFER_set_app_buffer(wb, 1); + TLS_BUFFER_set_buf(wb, (unsigned char *)templates[0].buf); + TLS_BUFFER_set_offset(wb, 0); + TLS_BUFFER_set_app_buffer(wb, 1); return 1; } diff --git a/ssl/record/methods/recmethod_local.h b/ssl/record/methods/recmethod_local.h index 32950769fc..3180b28827 100644 --- a/ssl/record/methods/recmethod_local.h +++ b/ssl/record/methods/recmethod_local.h @@ -25,7 +25,7 @@ typedef struct ssl_mac_buf_st { int alloced; } SSL_MAC_BUF; -typedef struct ssl3_buffer_st { +typedef struct tls_buffer_st { /* at least SSL3_RT_MAX_PACKET_SIZE bytes */ unsigned char *buf; /* default buffer size (or 0 if no default set) */ @@ -40,7 +40,7 @@ typedef struct ssl3_buffer_st { int app_buffer; /* The type of data stored in this buffer. Only used for writing */ int type; -} SSL3_BUFFER; +} TLS_BUFFER; typedef struct ssl3_record_st { /* Record layer version */ @@ -163,7 +163,7 @@ struct record_functions_st size_t numtempl, OSSL_RECORD_TEMPLATE *prefixtempl, WPACKET *pkt, - SSL3_BUFFER *bufs, + TLS_BUFFER *bufs, size_t *wpinited); /* Get the actual record type to be used for a given template */ @@ -242,7 +242,7 @@ struct ossl_record_layer_st uint32_t mode; /* write IO goes into here */ - SSL3_BUFFER wbuf[SSL_MAX_PIPELINES + 1]; + TLS_BUFFER wbuf[SSL_MAX_PIPELINES + 1]; /* Next wbuf with pending data still to write */ size_t nextwbuf; @@ -251,7 +251,7 @@ struct ossl_record_layer_st size_t numwpipes; /* read IO goes into here */ - SSL3_BUFFER rbuf; + TLS_BUFFER rbuf; /* each decoded record goes in here */ SSL3_RECORD rrec[SSL_MAX_PIPELINES]; @@ -375,7 +375,7 @@ struct ossl_record_layer_st typedef struct dtls_rlayer_record_data_st { unsigned char *packet; size_t packet_length; - SSL3_BUFFER rbuf; + TLS_BUFFER rbuf; SSL3_RECORD rrec; } DTLS_RLAYER_RECORD_DATA; @@ -523,7 +523,7 @@ int tls_initialise_write_packets_default(OSSL_RECORD_LAYER *rl, size_t numtempl, OSSL_RECORD_TEMPLATE *prefixtempl, WPACKET *pkt, - SSL3_BUFFER *bufs, + TLS_BUFFER *bufs, size_t *wpinited); int tls1_allocate_write_buffers(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates, @@ -533,7 +533,7 @@ int tls1_initialise_write_packets(OSSL_RECORD_LAYER *rl, size_t numtempl, OSSL_RECORD_TEMPLATE *prefixtempl, WPACKET *pkt, - SSL3_BUFFER *bufs, + TLS_BUFFER *bufs, size_t *wpinited); int tls_prepare_record_header_default(OSSL_RECORD_LAYER *rl, WPACKET *thispkt, @@ -553,18 +553,18 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates, size_t numtempl); -/* Macros/functions provided by the SSL3_BUFFER component */ - -#define SSL3_BUFFER_get_buf(b) ((b)->buf) -#define SSL3_BUFFER_set_buf(b, n) ((b)->buf = (n)) -#define SSL3_BUFFER_get_len(b) ((b)->len) -#define SSL3_BUFFER_get_left(b) ((b)->left) -#define SSL3_BUFFER_set_left(b, l) ((b)->left = (l)) -#define SSL3_BUFFER_sub_left(b, l) ((b)->left -= (l)) -#define SSL3_BUFFER_get_offset(b) ((b)->offset) -#define SSL3_BUFFER_set_offset(b, o) ((b)->offset = (o)) -#define SSL3_BUFFER_add_offset(b, o) ((b)->offset += (o)) -#define SSL3_BUFFER_set_app_buffer(b, l) ((b)->app_buffer = (l)) -#define SSL3_BUFFER_is_app_buffer(b) ((b)->app_buffer) - -void SSL3_BUFFER_release(SSL3_BUFFER *b); +/* Macros/functions provided by the TLS_BUFFER component */ + +#define TLS_BUFFER_get_buf(b) ((b)->buf) +#define TLS_BUFFER_set_buf(b, n) ((b)->buf = (n)) +#define TLS_BUFFER_get_len(b) ((b)->len) +#define TLS_BUFFER_get_left(b) ((b)->left) +#define TLS_BUFFER_set_left(b, l) ((b)->left = (l)) +#define TLS_BUFFER_sub_left(b, l) ((b)->left -= (l)) +#define TLS_BUFFER_get_offset(b) ((b)->offset) +#define TLS_BUFFER_set_offset(b, o) ((b)->offset = (o)) +#define TLS_BUFFER_add_offset(b, o) ((b)->offset += (o)) +#define TLS_BUFFER_set_app_buffer(b, l) ((b)->app_buffer = (l)) +#define TLS_BUFFER_is_app_buffer(b) ((b)->app_buffer) + +void ossl_tls_buffer_release(TLS_BUFFER *b); diff --git a/ssl/record/methods/tls1_meth.c b/ssl/record/methods/tls1_meth.c index 54ed02fbc0..3ed377ba8a 100644 --- a/ssl/record/methods/tls1_meth.c +++ b/ssl/record/methods/tls1_meth.c @@ -588,11 +588,11 @@ int tls1_initialise_write_packets(OSSL_RECORD_LAYER *rl, size_t numtempl, OSSL_RECORD_TEMPLATE *prefixtempl, WPACKET *pkt, - SSL3_BUFFER *bufs, + TLS_BUFFER *bufs, size_t *wpinited) { size_t align = 0; - SSL3_BUFFER *wb; + TLS_BUFFER *wb; size_t prefix; /* Do we need to add an empty record prefix? */ @@ -612,14 +612,14 @@ int tls1_initialise_write_packets(OSSL_RECORD_LAYER *rl, wb = &bufs[0]; #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD != 0 - align = (size_t)SSL3_BUFFER_get_buf(wb) + SSL3_RT_HEADER_LENGTH; + align = (size_t)TLS_BUFFER_get_buf(wb) + SSL3_RT_HEADER_LENGTH; align = SSL3_ALIGN_PAYLOAD - 1 - ((align - 1) % SSL3_ALIGN_PAYLOAD); #endif - SSL3_BUFFER_set_offset(wb, align); + TLS_BUFFER_set_offset(wb, align); - if (!WPACKET_init_static_len(&pkt[0], SSL3_BUFFER_get_buf(wb), - SSL3_BUFFER_get_len(wb), 0)) { + if (!WPACKET_init_static_len(&pkt[0], TLS_BUFFER_get_buf(wb), + TLS_BUFFER_get_len(wb), 0)) { RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR); return 0; } diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c index 0b3635d2bd..fc18d33be5 100644 --- a/ssl/record/methods/tls_common.c +++ b/ssl/record/methods/tls_common.c @@ -22,7 +22,7 @@ static void tls_int_free(OSSL_RECORD_LAYER *rl); -void SSL3_BUFFER_release(SSL3_BUFFER *b) +void ossl_tls_buffer_release(TLS_BUFFER *b) { OPENSSL_free(b->buf); b->buf = NULL; @@ -120,7 +120,7 @@ static int tls_allow_compression(OSSL_RECORD_LAYER *rl) static void tls_release_write_buffer_int(OSSL_RECORD_LAYER *rl, size_t start) { - SSL3_BUFFER *wb; + TLS_BUFFER *wb; size_t pipes; pipes = rl->numwpipes; @@ -128,8 +128,8 @@ static void tls_release_write_buffer_int(OSSL_RECORD_LAYER *rl, size_t start) while (pipes > start) { wb = &rl->wbuf[pipes - 1]; - if (SSL3_BUFFER_is_app_buffer(wb)) - SSL3_BUFFER_set_app_buffer(wb, 0); + if (TLS_BUFFER_is_app_buffer(wb)) + TLS_BUFFER_set_app_buffer(wb, 0); else OPENSSL_free(wb->buf); wb->buf = NULL; @@ -142,7 +142,7 @@ int tls_setup_write_buffer(OSSL_RECORD_LAYER *rl, size_t numwpipes, { unsigned char *p; size_t align = 0, headerlen; - SSL3_BUFFER *wb; + TLS_BUFFER *wb; size_t currpipe; size_t defltlen = 0; @@ -168,7 +168,7 @@ int tls_setup_write_buffer(OSSL_RECORD_LAYER *rl, size_t numwpipes, wb = rl->wbuf; for (currpipe = 0; currpipe < numwpipes; currpipe++) { - SSL3_BUFFER *thiswb = &wb[currpipe]; + TLS_BUFFER *thiswb = &wb[currpipe]; size_t len = (currpipe == 0) ? firstlen : nextlen; if (len == 0) @@ -194,7 +194,7 @@ int tls_setup_write_buffer(OSSL_RECORD_LAYER *rl, size_t numwpipes, return 0; } } - memset(thiswb, 0, sizeof(SSL3_BUFFER)); + memset(thiswb, 0, sizeof(TLS_BUFFER)); thiswb->buf = p; thiswb->len = len; } @@ -218,7 +218,7 @@ int tls_setup_read_buffer(OSSL_RECORD_LAYER *rl) { unsigned char *p; size_t len, align = 0, headerlen; - SSL3_BUFFER *b; + TLS_BUFFER *b; b = &rl->rbuf; @@ -264,7 +264,7 @@ int tls_setup_read_buffer(OSSL_RECORD_LAYER *rl) static int tls_release_read_buffer(OSSL_RECORD_LAYER *rl) { - SSL3_BUFFER *b; + TLS_BUFFER *b; b = &rl->rbuf; if ((rl->options & SSL_OP_CLEANSE_PLAINTEXT) != 0) @@ -291,7 +291,7 @@ int tls_default_read_n(OSSL_RECORD_LAYER *rl, size_t n, size_t max, int extend, */ size_t len, left, align = 0; unsigned char *pkt; - SSL3_BUFFER *rb; + TLS_BUFFER *rb; if (n == 0) return OSSL_RECORD_RETURN_NON_FATAL_ERR; @@ -441,22 +441,22 @@ int tls_default_read_n(OSSL_RECORD_LAYER *rl, size_t n, size_t max, int extend, */ static int tls_record_app_data_waiting(OSSL_RECORD_LAYER *rl) { - SSL3_BUFFER *rbuf; + TLS_BUFFER *rbuf; size_t left, len; unsigned char *p; rbuf = &rl->rbuf; - p = SSL3_BUFFER_get_buf(rbuf); + p = TLS_BUFFER_get_buf(rbuf); if (p == NULL) return 0; - left = SSL3_BUFFER_get_left(rbuf); + left = TLS_BUFFER_get_left(rbuf); if (left < SSL3_RT_HEADER_LENGTH) return 0; - p += SSL3_BUFFER_get_offset(rbuf); + p += TLS_BUFFER_get_offset(rbuf); /* * We only check the type and record length, we will sanity check version @@ -526,7 +526,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl) int i; size_t more, n; SSL3_RECORD *rr, *thisrr; - SSL3_BUFFER *rbuf; + TLS_BUFFER *rbuf; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; unsigned int version; @@ -561,7 +561,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl) unsigned int type; rret = rl->funcs->read_n(rl, SSL3_RT_HEADER_LENGTH, - SSL3_BUFFER_get_len(rbuf), 0, + TLS_BUFFER_get_len(rbuf), 0, num_recs == 0 ? 1 : 0, &n); if (rret < OSSL_RECORD_RETURN_SUCCESS) @@ -601,7 +601,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl) thisrr->length = sslv2len & 0x7fff; - if (thisrr->length > SSL3_BUFFER_get_len(rbuf) + if (thisrr->length > TLS_BUFFER_get_len(rbuf) - SSL2_RT_HEADER_LENGTH) { RLAYERfatal(rl, SSL_AD_RECORD_OVERFLOW, SSL_R_PACKET_LENGTH_TOO_LONG); @@ -638,7 +638,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl) rl->msg_callback(0, version, SSL3_RT_HEADER, p, 5, rl->cbarg); if (thisrr->length > - SSL3_BUFFER_get_len(rbuf) - SSL3_RT_HEADER_LENGTH) { + TLS_BUFFER_get_len(rbuf) - SSL3_RT_HEADER_LENGTH) { RLAYERfatal(rl, SSL_AD_RECORD_OVERFLOW, SSL_R_PACKET_LENGTH_TOO_LONG); return OSSL_RECORD_RETURN_FATAL; @@ -1122,7 +1122,7 @@ int tls_release_record(OSSL_RECORD_LAYER *rl, void *rechandle) if (rl->curr_rec == rl->num_released && (rl->mode & SSL_MODE_RELEASE_BUFFERS) != 0 - && SSL3_BUFFER_get_left(&rl->rbuf) == 0) + && TLS_BUFFER_get_left(&rl->rbuf) == 0) tls_release_read_buffer(rl); return OSSL_RECORD_RETURN_SUCCESS; @@ -1379,7 +1379,7 @@ static void tls_int_free(OSSL_RECORD_LAYER *rl) BIO_free(rl->prev); BIO_free(rl->bio); BIO_free(rl->next); - SSL3_BUFFER_release(&rl->rbuf); + ossl_tls_buffer_release(&rl->rbuf); tls_release_write_buffer(rl); @@ -1399,7 +1399,7 @@ static void tls_int_free(OSSL_RECORD_LAYER *rl) int tls_free(OSSL_RECORD_LAYER *rl) { - SSL3_BUFFER *rbuf; + TLS_BUFFER *rbuf; size_t left, written; int ret = 1; @@ -1408,7 +1408,7 @@ int tls_free(OSSL_RECORD_LAYER *rl) rbuf = &rl->rbuf; - left = SSL3_BUFFER_get_left(rbuf); + left = TLS_BUFFER_get_left(rbuf); if (left > 0) { /* * This record layer is closing but we still have data left in our @@ -1429,7 +1429,7 @@ int tls_reset(OSSL_RECORD_LAYER *rl) int tls_unprocessed_read_pending(OSSL_RECORD_LAYER *rl) { - return SSL3_BUFFER_get_left(&rl->rbuf) != 0; + return TLS_BUFFER_get_left(&rl->rbuf) != 0; } int tls_processed_read_pending(OSSL_RECORD_LAYER *rl) @@ -1498,12 +1498,12 @@ int tls_initialise_write_packets_default(OSSL_RECORD_LAYER *rl, size_t numtempl, OSSL_RECORD_TEMPLATE *prefixtempl, WPACKET *pkt, - SSL3_BUFFER *bufs, + TLS_BUFFER *bufs, size_t *wpinited) { WPACKET *thispkt; size_t j, align; - SSL3_BUFFER *wb; + TLS_BUFFER *wb; for (j = 0; j < numtempl; j++) { thispkt = &pkt[j]; @@ -1512,15 +1512,15 @@ int tls_initialise_write_packets_default(OSSL_RECORD_LAYER *rl, wb->type = templates[j].type; #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD != 0 - align = (size_t)SSL3_BUFFER_get_buf(wb); + align = (size_t)TLS_BUFFER_get_buf(wb); align += rl->isdtls ? DTLS1_RT_HEADER_LENGTH : SSL3_RT_HEADER_LENGTH; align = SSL3_ALIGN_PAYLOAD - 1 - ((align - 1) % SSL3_ALIGN_PAYLOAD); #endif - SSL3_BUFFER_set_offset(wb, align); + TLS_BUFFER_set_offset(wb, align); - if (!WPACKET_init_static_len(thispkt, SSL3_BUFFER_get_buf(wb), - SSL3_BUFFER_get_len(wb), 0)) { + if (!WPACKET_init_static_len(thispkt, TLS_BUFFER_get_buf(wb), + TLS_BUFFER_get_len(wb), 0)) { RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR); return 0; } @@ -1809,7 +1809,7 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl, } /* now let's set up wb */ - SSL3_BUFFER_set_left(&rl->wbuf[j], SSL3_RECORD_get_length(thiswr)); + TLS_BUFFER_set_left(&rl->wbuf[j], SSL3_RECORD_get_length(thiswr)); } ret = 1; @@ -1824,7 +1824,7 @@ int tls_write_records(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates, { /* Check we don't have pending data waiting to write */ if (!ossl_assert(rl->nextwbuf >= rl->numwpipes - || SSL3_BUFFER_get_left(&rl->wbuf[rl->nextwbuf]) == 0)) { + || TLS_BUFFER_get_left(&rl->wbuf[rl->nextwbuf]) == 0)) { RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return OSSL_RECORD_RETURN_FATAL; } @@ -1842,7 +1842,7 @@ int tls_write_records(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates, int tls_retry_write_records(OSSL_RECORD_LAYER *rl) { int i, ret; - SSL3_BUFFER *thiswb; + TLS_BUFFER *thiswb; size_t tmpwrit = 0; if (rl->nextwbuf >= rl->numwpipes) @@ -1859,9 +1859,9 @@ int tls_retry_write_records(OSSL_RECORD_LAYER *rl) return ret; } i = BIO_write(rl->bio, (char *) - &(SSL3_BUFFER_get_buf(thiswb) - [SSL3_BUFFER_get_offset(thiswb)]), - (unsigned int)SSL3_BUFFER_get_left(thiswb)); + &(TLS_BUFFER_get_buf(thiswb) + [TLS_BUFFER_get_offset(thiswb)]), + (unsigned int)TLS_BUFFER_get_left(thiswb)); if (i >= 0) { tmpwrit = i; if (i == 0 && BIO_should_retry(rl->bio)) @@ -1887,9 +1887,9 @@ int tls_retry_write_records(OSSL_RECORD_LAYER *rl) * Treat i == 0 as success rather than an error for zero byte * writes to permit this case. */ - if (i >= 0 && tmpwrit == SSL3_BUFFER_get_left(thiswb)) { - SSL3_BUFFER_set_left(thiswb, 0); - SSL3_BUFFER_add_offset(thiswb, tmpwrit); + if (i >= 0 && tmpwrit == TLS_BUFFER_get_left(thiswb)) { + TLS_BUFFER_set_left(thiswb, 0); + TLS_BUFFER_add_offset(thiswb, tmpwrit); if (++(rl->nextwbuf) < rl->numwpipes) continue; @@ -1903,7 +1903,7 @@ int tls_retry_write_records(OSSL_RECORD_LAYER *rl) * For DTLS, just drop it. That's kind of the whole point in * using a datagram service */ - SSL3_BUFFER_set_left(thiswb, 0); + TLS_BUFFER_set_left(thiswb, 0); if (++(rl->nextwbuf) == rl->numwpipes && (rl->mode & SSL_MODE_RELEASE_BUFFERS) != 0) tls_release_write_buffer(rl); @@ -1911,8 +1911,8 @@ int tls_retry_write_records(OSSL_RECORD_LAYER *rl) } return ret; } - SSL3_BUFFER_add_offset(thiswb, tmpwrit); - SSL3_BUFFER_sub_left(thiswb, tmpwrit); + TLS_BUFFER_add_offset(thiswb, tmpwrit); + TLS_BUFFER_sub_left(thiswb, tmpwrit); } } @@ -2045,14 +2045,14 @@ int tls_alloc_buffers(OSSL_RECORD_LAYER *rl) * something into it. In this case we're not doing that so mark the * buffer as empty. */ - SSL3_BUFFER_set_left(&rl->wbuf[0], 0); + TLS_BUFFER_set_left(&rl->wbuf[0], 0); return 1; } /* Read direction */ /* If we have pending data to be read then buffers are already allocated */ - if (rl->curr_rec < rl->num_recs || SSL3_BUFFER_get_left(&rl->rbuf) != 0) + if (rl->curr_rec < rl->num_recs || TLS_BUFFER_get_left(&rl->rbuf) != 0) return 1; return tls_setup_read_buffer(rl); } @@ -2069,7 +2069,7 @@ int tls_free_buffers(OSSL_RECORD_LAYER *rl) */ if (rl->nextwbuf != 0 || rl->numwpipes != 1 - || SSL3_BUFFER_get_left(&rl->wbuf[0]) != 0) + || TLS_BUFFER_get_left(&rl->wbuf[0]) != 0) return 0; } tls_release_write_buffer(rl); @@ -2079,7 +2079,7 @@ int tls_free_buffers(OSSL_RECORD_LAYER *rl) /* Read direction */ /* If we have pending data to be read then fail */ - if (rl->curr_rec < rl->num_recs || SSL3_BUFFER_get_left(&rl->rbuf) != 0) + if (rl->curr_rec < rl->num_recs || TLS_BUFFER_get_left(&rl->rbuf) != 0) return 0; return tls_release_read_buffer(rl); diff --git a/ssl/record/methods/tls_multib.c b/ssl/record/methods/tls_multib.c index cf18ddfa20..fb5a2b3e0e 100644 --- a/ssl/record/methods/tls_multib.c +++ b/ssl/record/methods/tls_multib.c @@ -69,7 +69,7 @@ static int tls_write_records_multiblock_int(OSSL_RECORD_LAYER *rl, #if !defined(OPENSSL_NO_MULTIBLOCK) && EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK size_t i; size_t totlen; - SSL3_BUFFER *wb; + TLS_BUFFER *wb; unsigned char aad[13]; EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM mb_param; size_t packlen; |