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>
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index d6f4e7b..690a29f 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -420,9 +420,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
}
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c
index e0853cf..a38d3bb 100644
--- a/ssl/d1_lib.c
+++ b/ssl/d1_lib.c
@@ -270,7 +270,7 @@
}
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) {
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index 824a00c..2376e96 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -232,7 +232,7 @@
return -1;
}
- dtls1_retransmit_buffered_messages(ssl);
+ dtls1_retransmit_outgoing_messages(ssl);
}
rr->length = 0;
diff --git a/ssl/internal.h b/ssl/internal.h
index 710fdd3..4ecf6e0 100644
--- a/ssl/internal.h
+++ b/ssl/internal.h
@@ -1058,7 +1058,7 @@
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);