summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_handshake.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/tls13_handshake.c')
-rw-r--r--src/lib/libssl/tls13_handshake.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index bec55d8416..92780bb2f2 100644
--- a/src/lib/libssl/tls13_handshake.c
+++ b/src/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_handshake.c,v 1.14 2019/01/20 06:40:55 tb Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.15 2019/01/21 06:58:44 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -27,17 +27,6 @@
27#define TLS13_HANDSHAKE 1 27#define TLS13_HANDSHAKE 1
28#define TLS13_APPLICATION_DATA 2 28#define TLS13_APPLICATION_DATA 2
29 29
30/* Indexing into the state machine */
31struct tls13_handshake {
32 uint8_t hs_type;
33 uint8_t message_number;
34};
35
36struct tls13_ctx {
37 uint8_t mode;
38 struct tls13_handshake handshake;
39};
40
41struct tls13_handshake_action { 30struct tls13_handshake_action {
42 uint8_t record_type; 31 uint8_t record_type;
43 uint8_t handshake_type; 32 uint8_t handshake_type;
@@ -266,7 +255,7 @@ static enum tls13_message_type handshakes[][TLS13_NUM_MESSAGE_TYPES] = {
266enum tls13_message_type 255enum tls13_message_type
267tls13_handshake_active_state(struct tls13_ctx *ctx) 256tls13_handshake_active_state(struct tls13_ctx *ctx)
268{ 257{
269 struct tls13_handshake hs = ctx->handshake; 258 struct tls13_handshake_stage hs = ctx->handshake_stage;
270 259
271 if (hs.hs_type >= NUM_HANDSHAKES) 260 if (hs.hs_type >= NUM_HANDSHAKES)
272 return INVALID; 261 return INVALID;
@@ -290,7 +279,7 @@ tls13_handshake_active_action(struct tls13_ctx *ctx)
290int 279int
291tls13_handshake_advance_state_machine(struct tls13_ctx *ctx) 280tls13_handshake_advance_state_machine(struct tls13_ctx *ctx)
292{ 281{
293 if (++ctx->handshake.message_number >= TLS13_NUM_MESSAGE_TYPES) 282 if (++ctx->handshake_stage.message_number >= TLS13_NUM_MESSAGE_TYPES)
294 return 0; 283 return 0;
295 284
296 return 1; 285 return 1;
@@ -472,7 +461,7 @@ tls13_client_key_update_recv(struct tls13_ctx *ctx)
472int 461int
473tls13_server_hello_recv(struct tls13_ctx *ctx) 462tls13_server_hello_recv(struct tls13_ctx *ctx)
474{ 463{
475 ctx->handshake.hs_type |= NEGOTIATED; 464 ctx->handshake_stage.hs_type |= NEGOTIATED;
476 465
477 return 0; 466 return 0;
478} 467}
@@ -480,7 +469,7 @@ tls13_server_hello_recv(struct tls13_ctx *ctx)
480int 469int
481tls13_server_hello_send(struct tls13_ctx *ctx) 470tls13_server_hello_send(struct tls13_ctx *ctx)
482{ 471{
483 ctx->handshake.hs_type |= NEGOTIATED; 472 ctx->handshake_stage.hs_type |= NEGOTIATED;
484 473
485 return 0; 474 return 0;
486} 475}
@@ -521,7 +510,7 @@ tls13_server_certificate_request_recv(struct tls13_ctx *ctx)
521 * switching state, to avoid advancing state. 510 * switching state, to avoid advancing state.
522 */ 511 */
523 if (msg_type == TLS13_MT_CERTIFICATE) { 512 if (msg_type == TLS13_MT_CERTIFICATE) {
524 ctx->handshake.hs_type |= WITHOUT_CR; 513 ctx->handshake_stage.hs_type |= WITHOUT_CR;
525 return tls13_server_certificate_recv(ctx); 514 return tls13_server_certificate_recv(ctx);
526 } 515 }
527 516