From 2f9b47fb1997bd1ced2c8bf01d8de292387bda12 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 29 Dec 2017 14:15:55 -0800 Subject: [PATCH] Better pack structs in ssl/internal.h Change-Id: I632a5c9067860216f9252907b104ba605c33a50d Reviewed-on: https://boringssl-review.googlesource.com/24584 Reviewed-by: David Benjamin --- ssl/internal.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ssl/internal.h b/ssl/internal.h index 78d7aa63c..d59ecc472 100644 --- a/ssl/internal.h +++ b/ssl/internal.h @@ -1324,11 +1324,6 @@ struct SSL_HANDSHAKE { // |SSL_OP_NO_*| and |SSL_CTX_set_max_proto_version| APIs. uint16_t max_version = 0; - // session_id is the session ID in the ClientHello, used for the experimental - // TLS 1.3 variant. - uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH] = {0}; - uint8_t session_id_len = 0; - size_t hash_len = 0; uint8_t secret[EVP_MAX_MD_SIZE] = {0}; uint8_t early_traffic_secret[EVP_MAX_MD_SIZE] = {0}; @@ -1517,6 +1512,11 @@ struct SSL_HANDSHAKE { // early_data_written is the amount of early data that has been written by the // record layer. uint16_t early_data_written = 0; + + // session_id is the session ID in the ClientHello, used for the experimental + // TLS 1.3 variant. + uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH] = {0}; + uint8_t session_id_len = 0; }; UniquePtr ssl_handshake_new(SSL *ssl); @@ -2305,8 +2305,6 @@ struct SSL3_STATE { // fired, were it not a draft. bool draft_downgrade:1; - uint8_t send_alert[2] = {0}; - // hs_buf is the buffer of handshake data to process. UniquePtr hs_buf; @@ -2319,6 +2317,11 @@ struct SSL3_STATE { // been successfully written. uint32_t pending_flight_offset = 0; + // ticket_age_skew is the difference, in seconds, between the client-sent + // ticket age and the server-computed value in TLS 1.3 server connections + // which resumed a session. + int32_t ticket_age_skew = 0; + // aead_read_ctx is the current read cipher state. UniquePtr aead_read_ctx; @@ -2344,6 +2347,8 @@ struct SSL3_STATE { uint8_t previous_server_finished_len = 0; uint8_t previous_server_finished[12] = {0}; + uint8_t send_alert[2] = {0}; + // established_session is the session established by the connection. This // session is only filled upon the completion of the handshake and is // immutable. @@ -2373,11 +2378,6 @@ struct SSL3_STATE { // verified Channel ID from the client: a P256 point, (x,y), where // each are big-endian values. uint8_t tlsext_channel_id[64] = {0}; - - // ticket_age_skew is the difference, in seconds, between the client-sent - // ticket age and the server-computed value in TLS 1.3 server connections - // which resumed a session. - int32_t ticket_age_skew = 0; }; // lengths of messages @@ -2518,10 +2518,6 @@ struct SSLConnection { // further constrainted by |SSL_OP_NO_*|. uint16_t conf_min_version; - // tls13_variant is the variant of TLS 1.3 we are using for this - // configuration. - enum tls13_variant_t tls13_variant; - uint16_t max_send_fragment; // There are 2 BIO's even though they are normally both the same. This is so @@ -2558,6 +2554,10 @@ struct SSLConnection { // milliseconds. It's used to initialize the timer any time it's restarted. unsigned initial_timeout_duration_ms; + // tls13_variant is the variant of TLS 1.3 we are using for this + // configuration. + enum tls13_variant_t tls13_variant; + // session is the configured session to be offered by the client. This session // is immutable. SSL_SESSION *session;