diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2019-01-21 06:58:45 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2019-01-21 06:58:45 +0000 |
commit | 8f2d3bf5c4d987a03b0bf14bbcbc59c1fc8d8b2a (patch) | |
tree | 460247c41a0187411eb0aeb24efa8f9630a4a1e8 /lib/libssl/tls13_handshake.c | |
parent | a126d956664cd34dde4c8f198042627363a9696d (diff) |
Move struct tls13_ctx into a header since other things need access to it.
While here, rename struct handshake to struct handshake_stage to avoid
potential ambiguity/conflict with the handshake data struct. Also add
forward and back pointers between SSL and struct tls13_ctx.
ok tb@
Diffstat (limited to 'lib/libssl/tls13_handshake.c')
-rw-r--r-- | lib/libssl/tls13_handshake.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/libssl/tls13_handshake.c b/lib/libssl/tls13_handshake.c index bec55d84164..92780bb2f20 100644 --- a/lib/libssl/tls13_handshake.c +++ b/lib/libssl/tls13_handshake.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_handshake.c,v 1.14 2019/01/20 06:40:55 tb Exp $ */ +/* $OpenBSD: tls13_handshake.c,v 1.15 2019/01/21 06:58:44 jsing Exp $ */ /* * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> @@ -27,17 +27,6 @@ #define TLS13_HANDSHAKE 1 #define TLS13_APPLICATION_DATA 2 -/* Indexing into the state machine */ -struct tls13_handshake { - uint8_t hs_type; - uint8_t message_number; -}; - -struct tls13_ctx { - uint8_t mode; - struct tls13_handshake handshake; -}; - struct tls13_handshake_action { uint8_t record_type; uint8_t handshake_type; @@ -266,7 +255,7 @@ static enum tls13_message_type handshakes[][TLS13_NUM_MESSAGE_TYPES] = { enum tls13_message_type tls13_handshake_active_state(struct tls13_ctx *ctx) { - struct tls13_handshake hs = ctx->handshake; + struct tls13_handshake_stage hs = ctx->handshake_stage; if (hs.hs_type >= NUM_HANDSHAKES) return INVALID; @@ -290,7 +279,7 @@ tls13_handshake_active_action(struct tls13_ctx *ctx) int tls13_handshake_advance_state_machine(struct tls13_ctx *ctx) { - if (++ctx->handshake.message_number >= TLS13_NUM_MESSAGE_TYPES) + if (++ctx->handshake_stage.message_number >= TLS13_NUM_MESSAGE_TYPES) return 0; return 1; @@ -472,7 +461,7 @@ tls13_client_key_update_recv(struct tls13_ctx *ctx) int tls13_server_hello_recv(struct tls13_ctx *ctx) { - ctx->handshake.hs_type |= NEGOTIATED; + ctx->handshake_stage.hs_type |= NEGOTIATED; return 0; } @@ -480,7 +469,7 @@ tls13_server_hello_recv(struct tls13_ctx *ctx) int tls13_server_hello_send(struct tls13_ctx *ctx) { - ctx->handshake.hs_type |= NEGOTIATED; + ctx->handshake_stage.hs_type |= NEGOTIATED; return 0; } @@ -521,7 +510,7 @@ tls13_server_certificate_request_recv(struct tls13_ctx *ctx) * switching state, to avoid advancing state. */ if (msg_type == TLS13_MT_CERTIFICATE) { - ctx->handshake.hs_type |= WITHOUT_CR; + ctx->handshake_stage.hs_type |= WITHOUT_CR; return tls13_server_certificate_recv(ctx); } |