summaryrefslogtreecommitdiffstats
path: root/ssl/s3_msg.c
diff options
context:
space:
mode:
authorTodd Short <tshort@akamai.com>2018-12-12 13:09:50 -0500
committerMatt Caswell <matt@openssl.org>2019-04-29 17:26:09 +0100
commit555cbb328ee2eaa9356cd23e2194c1600653c500 (patch)
tree347c1fcdde0e9a736eb6c8590d95318b4c1940f6 /ssl/s3_msg.c
parentd7fcf1feac3b3b1bf1a162f632b1e7db4f075aed (diff)
Collapse ssl3_state_st (s3) into ssl_st
With the removal of SSLv2, the s3 structure is always allocated, so there is little point in having it be an allocated pointer. Collapse the ssl3_state_st structure into ssl_st and fixup any references. This should be faster than going through an indirection and due to fewer allocations, but I'm not seeing any significant performance improvement; it seems to be within the margin of error in timing. Reviewed-by: Paul Yang <yang.yang@baishancloud.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7888)
Diffstat (limited to 'ssl/s3_msg.c')
-rw-r--r--ssl/s3_msg.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ssl/s3_msg.c b/ssl/s3_msg.c
index fd75677dc0..83778d3a14 100644
--- a/ssl/s3_msg.c
+++ b/ssl/s3_msg.c
@@ -18,14 +18,14 @@ int ssl3_do_change_cipher_spec(SSL *s)
else
i = SSL3_CHANGE_CIPHER_CLIENT_READ;
- if (s->s3->tmp.key_block == NULL) {
+ if (s->s3.tmp.key_block == NULL) {
if (s->session == NULL || s->session->master_key_length == 0) {
/* might happen if dtls1_read_bytes() calls this */
SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC, SSL_R_CCS_RECEIVED_EARLY);
return 0;
}
- s->session->cipher = s->s3->tmp.new_cipher;
+ s->session->cipher = s->s3.tmp.new_cipher;
if (!s->method->ssl3_enc->setup_key_block(s)) {
/* SSLfatal() already called */
return 0;
@@ -56,9 +56,9 @@ int ssl3_send_alert(SSL *s, int level, int desc)
if ((level == SSL3_AL_FATAL) && (s->session != NULL))
SSL_CTX_remove_session(s->session_ctx, s->session);
- s->s3->alert_dispatch = 1;
- s->s3->send_alert[0] = level;
- s->s3->send_alert[1] = desc;
+ s->s3.alert_dispatch = 1;
+ s->s3.send_alert[0] = level;
+ s->s3.send_alert[1] = desc;
if (!RECORD_LAYER_write_pending(&s->rlayer)) {
/* data still being written out? */
return s->method->ssl_dispatch_alert(s);
@@ -77,12 +77,12 @@ int ssl3_dispatch_alert(SSL *s)
void (*cb) (const SSL *ssl, int type, int val) = NULL;
size_t written;
- s->s3->alert_dispatch = 0;
+ s->s3.alert_dispatch = 0;
alertlen = 2;
- i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3->send_alert[0], &alertlen, 1, 0,
+ i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3.send_alert[0], &alertlen, 1, 0,
&written);
if (i <= 0) {
- s->s3->alert_dispatch = 1;
+ s->s3.alert_dispatch = 1;
} else {
/*
* Alert sent to BIO - now flush. If the message does not get sent due
@@ -91,7 +91,7 @@ int ssl3_dispatch_alert(SSL *s)
(void)BIO_flush(s->wbio);
if (s->msg_callback)
- s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3->send_alert,
+ s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3.send_alert,
2, s, s->msg_callback_arg);
if (s->info_callback != NULL)
@@ -100,7 +100,7 @@ int ssl3_dispatch_alert(SSL *s)
cb = s->ctx->info_callback;
if (cb != NULL) {
- j = (s->s3->send_alert[0] << 8) | s->s3->send_alert[1];
+ j = (s->s3.send_alert[0] << 8) | s->s3.send_alert[1];
cb(s, SSL_CB_WRITE_ALERT, j);
}
}