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 | |
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')
-rw-r--r-- | lib/libssl/ssl_locl.h | 4 | ||||
-rw-r--r-- | lib/libssl/tls13_handshake.c | 23 | ||||
-rw-r--r-- | lib/libssl/tls13_internal.h | 15 |
3 files changed, 21 insertions, 21 deletions
diff --git a/lib/libssl/ssl_locl.h b/lib/libssl/ssl_locl.h index 1653b2ab961..30c1afd22d7 100644 --- a/lib/libssl/ssl_locl.h +++ b/lib/libssl/ssl_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_locl.h,v 1.226 2019/01/18 12:09:52 beck Exp $ */ +/* $OpenBSD: ssl_locl.h,v 1.227 2019/01/21 06:58:44 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -609,6 +609,8 @@ typedef struct ssl_ctx_internal_st { } SSL_CTX_INTERNAL; typedef struct ssl_internal_st { + struct tls13_ctx *tls13; + uint16_t min_version; uint16_t max_version; 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); } diff --git a/lib/libssl/tls13_internal.h b/lib/libssl/tls13_internal.h index 6b85cfdab90..bb3ff1fe9cd 100644 --- a/lib/libssl/tls13_internal.h +++ b/lib/libssl/tls13_internal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_internal.h,v 1.10 2019/01/20 12:27:34 jsing Exp $ */ +/* $OpenBSD: tls13_internal.h,v 1.11 2019/01/21 06:58:44 jsing Exp $ */ /* * Copyright (c) 2018 Bob Beck <beck@openbsd.org> * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> @@ -95,8 +95,6 @@ int tls13_derive_handshake_secrets(struct tls13_secrets *secrets, int tls13_derive_application_secrets(struct tls13_secrets *secrets, const struct tls13_secret *context); -struct tls13_ctx; - /* * Record Layer. */ @@ -139,6 +137,17 @@ int tls13_handshake_msg_recv(struct tls13_handshake_msg *msg, int tls13_handshake_msg_send(struct tls13_handshake_msg *msg, struct tls13_record_layer *rl); +struct tls13_handshake_stage { + uint8_t hs_type; + uint8_t message_number; +}; + +struct tls13_ctx { + SSL *ssl; + uint8_t mode; + struct tls13_handshake_stage handshake_stage; +}; + /* * Message Types - RFC 8446, Section B.3. * |