summaryrefslogtreecommitdiff
path: root/lib/libssl/tls13_legacy.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2021-03-21 18:36:35 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2021-03-21 18:36:35 +0000
commit523dc6d6c25a49ca140870da4b0b67f6a5878688 (patch)
tree72aea6b0fc1668fa5e8b37d25d9f9eeafcbeef39 /lib/libssl/tls13_legacy.c
parent582ddfc3b5bb3c0f2a9d1460b89e904dbfa4fbd2 (diff)
Move the TLSv1.3 handshake struct inside the shared handshake struct.
There are currently three different handshake structs that are in use - the SSL_HANDSHAKE struct (as S3I(s)->hs), the SSL_HANDSHAKE_TLS13 struct (as S3I(s)->hs_tls13 or ctx->hs in the TLSv1.3 code) and the infamous 'tmp' embedded in SSL3_STATE_INTERNAL (as S3I(s)->tmp)). This is the first step towards cleaning up the handshake structs so that shared data is in the SSL_HANDSHAKE struct, with sub-structs for TLSv1.2 and TLSv1.3 specific information. Place SSL_HANDSHAKE_TLS13 inside SSL_HANDSHAKE and change ctx->hs to refer to the SSL_HANDSHAKE struct instead of the SSL_HANDSHAKE_TLS13 struct. This allows the TLSv1.3 code to access the shared handshake data without needing the SSL struct. ok inoguchi@ tb@
Diffstat (limited to 'lib/libssl/tls13_legacy.c')
-rw-r--r--lib/libssl/tls13_legacy.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libssl/tls13_legacy.c b/lib/libssl/tls13_legacy.c
index f611aa061d0..19271ef7874 100644
--- a/lib/libssl/tls13_legacy.c
+++ b/lib/libssl/tls13_legacy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_legacy.c,v 1.22 2021/02/25 17:06:05 jsing Exp $ */
+/* $OpenBSD: tls13_legacy.c,v 1.23 2021/03/21 18:36:34 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -361,7 +361,7 @@ tls13_use_legacy_client(struct tls13_ctx *ctx)
s->internal->handshake_func = s->method->internal->ssl_connect;
s->client_version = s->version = s->method->internal->max_tls_version;
- S3I(s)->hs.state = SSL3_ST_CR_SRVR_HELLO_A;
+ ctx->hs->state = SSL3_ST_CR_SRVR_HELLO_A;
return 1;
}
@@ -378,7 +378,7 @@ tls13_use_legacy_server(struct tls13_ctx *ctx)
s->client_version = s->version = s->method->internal->max_tls_version;
s->server = 1;
- S3I(s)->hs.state = SSL3_ST_SR_CLNT_HELLO_A;
+ ctx->hs->state = SSL3_ST_SR_CLNT_HELLO_A;
return 1;
}
@@ -396,7 +396,7 @@ tls13_legacy_accept(SSL *ssl)
}
ssl->internal->tls13 = ctx;
ctx->ssl = ssl;
- ctx->hs = &S3I(ssl)->hs_tls13;
+ ctx->hs = &S3I(ssl)->hs;
if (!tls13_server_init(ctx)) {
if (ERR_peek_error() == 0)
@@ -406,13 +406,13 @@ tls13_legacy_accept(SSL *ssl)
}
ERR_clear_error();
- S3I(ssl)->hs.state = SSL_ST_ACCEPT;
+ ctx->hs->state = SSL_ST_ACCEPT;
ret = tls13_server_accept(ctx);
if (ret == TLS13_IO_USE_LEGACY)
return ssl->method->internal->ssl_accept(ssl);
if (ret == TLS13_IO_SUCCESS)
- S3I(ssl)->hs.state = SSL_ST_OK;
+ ctx->hs->state = SSL_ST_OK;
return tls13_legacy_return_code(ssl, ret);
}
@@ -438,7 +438,7 @@ tls13_legacy_connect(SSL *ssl)
}
ssl->internal->tls13 = ctx;
ctx->ssl = ssl;
- ctx->hs = &S3I(ssl)->hs_tls13;
+ ctx->hs = &S3I(ssl)->hs;
if (!tls13_client_init(ctx)) {
if (ERR_peek_error() == 0)
@@ -448,13 +448,13 @@ tls13_legacy_connect(SSL *ssl)
}
ERR_clear_error();
- S3I(ssl)->hs.state = SSL_ST_CONNECT;
+ ctx->hs->state = SSL_ST_CONNECT;
ret = tls13_client_connect(ctx);
if (ret == TLS13_IO_USE_LEGACY)
return ssl->method->internal->ssl_connect(ssl);
if (ret == TLS13_IO_SUCCESS)
- S3I(ssl)->hs.state = SSL_ST_OK;
+ ctx->hs->state = SSL_ST_OK;
return tls13_legacy_return_code(ssl, ret);
}