Make alert_dispatch into a bool. Due to padding and slightly silly field ordering, I think this actually ends up a no-op memory-wise, but may amount to win with cleverer reordering or as fields change. Change-Id: I14e38d747a90112cf06c741aec148b77cc5902fb Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/36791 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/d1_pkt.cc b/ssl/d1_pkt.cc index be595b0..dfb8a67 100644 --- a/ssl/d1_pkt.cc +++ b/ssl/d1_pkt.cc
@@ -256,7 +256,7 @@ if (ret <= 0) { return ret; } - ssl->s3->alert_dispatch = 0; + ssl->s3->alert_dispatch = false; // If the alert is fatal, flush the BIO now. if (ssl->s3->send_alert[0] == SSL3_AL_FATAL) {
diff --git a/ssl/internal.h b/ssl/internal.h index 5a787b8..b355c7f 100644 --- a/ssl/internal.h +++ b/ssl/internal.h
@@ -2173,8 +2173,6 @@ // the receive half of the connection. UniquePtr<ERR_SAVE_STATE> read_error; - int alert_dispatch = 0; - int total_renegotiations = 0; // This holds a variable that indicates what we were doing when a 0 or -1 is @@ -2261,6 +2259,9 @@ // sending/echoing the post-quantum experiment signal. bool pq_experiment_signal_seen : 1; + // alert_dispatch is true there is an alert in |send_alert| to be sent. + bool alert_dispatch : 1; + // hs_buf is the buffer of handshake data to process. UniquePtr<BUF_MEM> hs_buf;
diff --git a/ssl/s3_lib.cc b/ssl/s3_lib.cc index 75e1f68..41dd588 100644 --- a/ssl/s3_lib.cc +++ b/ssl/s3_lib.cc
@@ -180,7 +180,8 @@ early_data_accepted(false), tls13_downgrade(false), token_binding_negotiated(false), - pq_experiment_signal_seen(false) {} + pq_experiment_signal_seen(false), + alert_dispatch(false) {} SSL3_STATE::~SSL3_STATE() {}
diff --git a/ssl/s3_pkt.cc b/ssl/s3_pkt.cc index 67bfd63..a54bb00 100644 --- a/ssl/s3_pkt.cc +++ b/ssl/s3_pkt.cc
@@ -414,7 +414,7 @@ ssl->s3->write_shutdown = ssl_shutdown_error; } - ssl->s3->alert_dispatch = 1; + ssl->s3->alert_dispatch = true; ssl->s3->send_alert[0] = level; ssl->s3->send_alert[1] = desc; if (ssl->s3->write_buffer.empty()) { @@ -441,7 +441,7 @@ } } - ssl->s3->alert_dispatch = 0; + ssl->s3->alert_dispatch = false; // If the alert is fatal, flush the BIO now. if (ssl->s3->send_alert[0] == SSL3_AL_FATAL) {