Stop using the word 'buffer' everywhere.

buffer buffer buffer buffer buffer. At some point, words lose their meaning if
they're used too many times. Notably, the DTLS code can't decide whether a
"buffered message" is an incoming message to be reassembled or an outgoing
message to be (re)transmitted.

Change-Id: Ibdde5c00abb062c603d21be97aff49e1c422c755
Reviewed-on: https://boringssl-review.googlesource.com/8500
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2016-06-23 17:49:12 -04:00 committed by Adam Langley
parent 7583643569
commit aad50db45d
4 changed files with 12 additions and 12 deletions

View File

@ -420,9 +420,9 @@ void dtls_clear_outgoing_messages(SSL *ssl) {
ssl->d1->outgoing_messages_len = 0;
}
/* dtls1_buffer_change_cipher_spec adds a ChangeCipherSpec to the current
/* dtls1_add_change_cipher_spec adds a ChangeCipherSpec to the current
* handshake flight. */
static int dtls1_buffer_change_cipher_spec(SSL *ssl) {
static int dtls1_add_change_cipher_spec(SSL *ssl) {
if (ssl->d1->outgoing_messages_len >= SSL_MAX_HANDSHAKE_FLIGHT) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
return 0;
@ -439,7 +439,7 @@ static int dtls1_buffer_change_cipher_spec(SSL *ssl) {
return 1;
}
static int dtls1_buffer_message(SSL *ssl, uint8_t *data, size_t len) {
static int dtls1_add_message(SSL *ssl, uint8_t *data, size_t len) {
if (ssl->d1->outgoing_messages_len >= SSL_MAX_HANDSHAKE_FLIGHT) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
OPENSSL_free(data);
@ -490,7 +490,7 @@ int dtls1_finish_message(SSL *ssl, CBB *cbb) {
ssl->d1->handshake_write_seq++;
ssl->init_off = 0;
return dtls1_buffer_message(ssl, msg, len);
return dtls1_add_message(ssl, msg, len);
}
int dtls1_write_message(SSL *ssl) {
@ -521,11 +521,11 @@ static int dtls1_is_next_message_complete(SSL *ssl) {
return frag != NULL && frag->reassembly == NULL;
}
/* dtls1_get_buffered_message returns the buffered message corresponding to
/* dtls1_get_incoming_message returns the incoming message corresponding to
* |msg_hdr|. If none exists, it creates a new one and inserts it in the
* queue. Otherwise, it checks |msg_hdr| is consistent with the existing one. It
* returns NULL on failure. The caller does not take ownership of the result. */
static hm_fragment *dtls1_get_buffered_message(
static hm_fragment *dtls1_get_incoming_message(
SSL *ssl, const struct hm_header_st *msg_hdr) {
if (msg_hdr->seq < ssl->d1->handshake_read_seq ||
msg_hdr->seq - ssl->d1->handshake_read_seq >= SSL_MAX_HANDSHAKE_FLIGHT) {
@ -624,7 +624,7 @@ start:
continue;
}
hm_fragment *frag = dtls1_get_buffered_message(ssl, &msg_hdr);
hm_fragment *frag = dtls1_get_incoming_message(ssl, &msg_hdr);
if (frag == NULL) {
return -1;
}
@ -772,7 +772,7 @@ static int dtls1_retransmit_message(SSL *ssl,
return ret;
}
int dtls1_retransmit_buffered_messages(SSL *ssl) {
int dtls1_retransmit_outgoing_messages(SSL *ssl) {
/* Ensure we are packing handshake messages. */
const int was_buffered = ssl_is_wbio_buffered(ssl);
assert(was_buffered == SSL_in_init(ssl));
@ -804,7 +804,7 @@ err:
int dtls1_send_change_cipher_spec(SSL *ssl, int a, int b) {
if (ssl->state == a) {
dtls1_buffer_change_cipher_spec(ssl);
dtls1_add_change_cipher_spec(ssl);
ssl->state = b;
}

View File

@ -270,7 +270,7 @@ int DTLSv1_handle_timeout(SSL *ssl) {
}
dtls1_start_timer(ssl);
return dtls1_retransmit_buffered_messages(ssl);
return dtls1_retransmit_outgoing_messages(ssl);
}
static void get_current_time(const SSL *ssl, struct timeval *out_clock) {

View File

@ -232,7 +232,7 @@ again:
return -1;
}
dtls1_retransmit_buffered_messages(ssl);
dtls1_retransmit_outgoing_messages(ssl);
}
rr->length = 0;

View File

@ -1058,7 +1058,7 @@ int dtls1_write_record(SSL *ssl, int type, const uint8_t *buf, size_t len,
int dtls1_send_change_cipher_spec(SSL *ssl, int a, int b);
int dtls1_send_finished(SSL *ssl, int a, int b, const char *sender, int slen);
int dtls1_retransmit_buffered_messages(SSL *ssl);
int dtls1_retransmit_outgoing_messages(SSL *ssl);
void dtls1_clear_record_buffer(SSL *ssl);
int dtls1_parse_fragment(CBS *cbs, struct hm_header_st *out_hdr,
CBS *out_body);