diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/tls13_handshake.c | 11 | ||||
| -rw-r--r-- | src/lib/libssl/tls13_internal.h | 8 | ||||
| -rw-r--r-- | src/lib/libssl/tls13_lib.c | 16 |
3 files changed, 32 insertions, 3 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c index 80ad7c0264..b3cecc77ef 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.63 2020/06/02 13:57:09 tb Exp $ */ | 1 | /* $OpenBSD: tls13_handshake.c,v 1.64 2020/07/30 16:23:17 tb 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> |
| @@ -343,6 +343,12 @@ tls13_handshake_perform(struct tls13_ctx *ctx) | |||
| 343 | const struct tls13_handshake_action *action; | 343 | const struct tls13_handshake_action *action; |
| 344 | int ret; | 344 | int ret; |
| 345 | 345 | ||
| 346 | if (!ctx->handshake_started) { | ||
| 347 | ctx->handshake_started = 1; | ||
| 348 | if (ctx->info_cb != NULL) | ||
| 349 | ctx->info_cb(ctx, TLS13_INFO_HANDSHAKE_STARTED, 1); | ||
| 350 | } | ||
| 351 | |||
| 346 | for (;;) { | 352 | for (;;) { |
| 347 | if ((action = tls13_handshake_active_action(ctx)) == NULL) | 353 | if ((action = tls13_handshake_active_action(ctx)) == NULL) |
| 348 | return TLS13_IO_FAILURE; | 354 | return TLS13_IO_FAILURE; |
| @@ -350,6 +356,9 @@ tls13_handshake_perform(struct tls13_ctx *ctx) | |||
| 350 | if (action->handshake_complete) { | 356 | if (action->handshake_complete) { |
| 351 | ctx->handshake_completed = 1; | 357 | ctx->handshake_completed = 1; |
| 352 | tls13_record_layer_handshake_completed(ctx->rl); | 358 | tls13_record_layer_handshake_completed(ctx->rl); |
| 359 | if (ctx->info_cb != NULL) | ||
| 360 | ctx->info_cb(ctx, | ||
| 361 | TLS13_INFO_HANDSHAKE_COMPLETED, 1); | ||
| 353 | return TLS13_IO_SUCCESS; | 362 | return TLS13_IO_SUCCESS; |
| 354 | } | 363 | } |
| 355 | 364 | ||
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h index f35f09bbb1..03a1a6b4b1 100644 --- a/src/lib/libssl/tls13_internal.h +++ b/src/lib/libssl/tls13_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_internal.h,v 1.85 2020/07/03 04:12:51 tb Exp $ */ | 1 | /* $OpenBSD: tls13_internal.h,v 1.86 2020/07/30 16:23:17 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> |
| 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| @@ -79,6 +79,9 @@ __BEGIN_HIDDEN_DECLS | |||
| 79 | #define TLS13_ALERT_CERTIFICATE_REQUIRED 116 | 79 | #define TLS13_ALERT_CERTIFICATE_REQUIRED 116 |
| 80 | #define TLS13_ALERT_NO_APPLICATION_PROTOCOL 120 | 80 | #define TLS13_ALERT_NO_APPLICATION_PROTOCOL 120 |
| 81 | 81 | ||
| 82 | #define TLS13_INFO_HANDSHAKE_STARTED SSL_CB_HANDSHAKE_START | ||
| 83 | #define TLS13_INFO_HANDSHAKE_COMPLETED SSL_CB_HANDSHAKE_DONE | ||
| 84 | |||
| 82 | typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); | 85 | typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); |
| 83 | typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg, CBS *_cbs); | 86 | typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg, CBS *_cbs); |
| 84 | typedef void (*tls13_phh_sent_cb)(void *_cb_arg); | 87 | typedef void (*tls13_phh_sent_cb)(void *_cb_arg); |
| @@ -86,6 +89,7 @@ typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); | |||
| 86 | typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, | 89 | typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, |
| 87 | void *_cb_arg); | 90 | void *_cb_arg); |
| 88 | typedef void (*tls13_handshake_message_cb)(void *_cb_arg); | 91 | typedef void (*tls13_handshake_message_cb)(void *_cb_arg); |
| 92 | typedef void (*tls13_info_cb)(void *_cb_arg, int _state, int _ret); | ||
| 89 | typedef int (*tls13_ocsp_status_cb)(void *_cb_arg); | 93 | typedef int (*tls13_ocsp_status_cb)(void *_cb_arg); |
| 90 | 94 | ||
| 91 | /* | 95 | /* |
| @@ -261,6 +265,7 @@ struct tls13_ctx { | |||
| 261 | struct ssl_handshake_tls13_st *hs; | 265 | struct ssl_handshake_tls13_st *hs; |
| 262 | uint8_t mode; | 266 | uint8_t mode; |
| 263 | struct tls13_handshake_stage handshake_stage; | 267 | struct tls13_handshake_stage handshake_stage; |
| 268 | int handshake_started; | ||
| 264 | int handshake_completed; | 269 | int handshake_completed; |
| 265 | int middlebox_compat; | 270 | int middlebox_compat; |
| 266 | int send_dummy_ccs; | 271 | int send_dummy_ccs; |
| @@ -281,6 +286,7 @@ struct tls13_ctx { | |||
| 281 | 286 | ||
| 282 | tls13_handshake_message_cb handshake_message_sent_cb; | 287 | tls13_handshake_message_cb handshake_message_sent_cb; |
| 283 | tls13_handshake_message_cb handshake_message_recv_cb; | 288 | tls13_handshake_message_cb handshake_message_recv_cb; |
| 289 | tls13_info_cb info_cb; | ||
| 284 | tls13_ocsp_status_cb ocsp_status_recv_cb; | 290 | tls13_ocsp_status_cb ocsp_status_recv_cb; |
| 285 | }; | 291 | }; |
| 286 | #ifndef TLS13_PHH_LIMIT_TIME | 292 | #ifndef TLS13_PHH_LIMIT_TIME |
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c index 8fef39a12f..1f19bef997 100644 --- a/src/lib/libssl/tls13_lib.c +++ b/src/lib/libssl/tls13_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_lib.c,v 1.52 2020/07/03 04:12:51 tb Exp $ */ | 1 | /* $OpenBSD: tls13_lib.c,v 1.53 2020/07/30 16:23:17 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> |
| @@ -180,6 +180,19 @@ tls13_legacy_handshake_message_sent_cb(void *arg) | |||
| 180 | CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg); | 180 | CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | static void | ||
| 184 | tls13_legacy_info_cb(void *arg, int state, int ret) | ||
| 185 | { | ||
| 186 | struct tls13_ctx *ctx = arg; | ||
| 187 | SSL *s = ctx->ssl; | ||
| 188 | void (*cb)(const SSL *, int, int); | ||
| 189 | |||
| 190 | if ((cb = s->internal->info_callback) == NULL) | ||
| 191 | cb = s->ctx->internal->info_callback; | ||
| 192 | if (cb != NULL) | ||
| 193 | cb(s, state, ret); | ||
| 194 | } | ||
| 195 | |||
| 183 | static int | 196 | static int |
| 184 | tls13_legacy_ocsp_status_recv_cb(void *arg) | 197 | tls13_legacy_ocsp_status_recv_cb(void *arg) |
| 185 | { | 198 | { |
| @@ -388,6 +401,7 @@ tls13_ctx_new(int mode) | |||
| 388 | 401 | ||
| 389 | ctx->handshake_message_sent_cb = tls13_legacy_handshake_message_sent_cb; | 402 | ctx->handshake_message_sent_cb = tls13_legacy_handshake_message_sent_cb; |
| 390 | ctx->handshake_message_recv_cb = tls13_legacy_handshake_message_recv_cb; | 403 | ctx->handshake_message_recv_cb = tls13_legacy_handshake_message_recv_cb; |
| 404 | ctx->info_cb = tls13_legacy_info_cb; | ||
| 391 | ctx->ocsp_status_recv_cb = tls13_legacy_ocsp_status_recv_cb; | 405 | ctx->ocsp_status_recv_cb = tls13_legacy_ocsp_status_recv_cb; |
| 392 | 406 | ||
| 393 | ctx->middlebox_compat = 1; | 407 | ctx->middlebox_compat = 1; |
