From d6a7e173715e870dfb36df82655ac23f5483ab99 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 14 Sep 2021 14:31:21 +0000 Subject: [PATCH] Call the info cb on connect/accept exit in TLSv1.3 The p5-Net-SSLeay test expects the info callback to be called on connect exit. This is the behavior in the legacy stack but wasn't implemented in the TLSv1.3 stack. With this commit, p5-Net-SSLeay tests are happy again after the bump. ok bluhm inoguchi jsing --- lib/libssl/tls13_internal.h | 4 +++- lib/libssl/tls13_legacy.c | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/libssl/tls13_internal.h b/lib/libssl/tls13_internal.h index 12ed733f2b2..2e78e372264 100644 --- a/lib/libssl/tls13_internal.h +++ b/lib/libssl/tls13_internal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_internal.h,v 1.91 2021/09/04 16:26:12 jsing Exp $ */ +/* $OpenBSD: tls13_internal.h,v 1.92 2021/09/14 14:31:21 tb Exp $ */ /* * Copyright (c) 2018 Bob Beck * Copyright (c) 2018 Theo Buehler @@ -83,6 +83,8 @@ __BEGIN_HIDDEN_DECLS #define TLS13_INFO_HANDSHAKE_COMPLETED SSL_CB_HANDSHAKE_DONE #define TLS13_INFO_ACCEPT_LOOP SSL_CB_ACCEPT_LOOP #define TLS13_INFO_CONNECT_LOOP SSL_CB_CONNECT_LOOP +#define TLS13_INFO_ACCEPT_EXIT SSL_CB_ACCEPT_EXIT +#define TLS13_INFO_CONNECT_EXIT SSL_CB_CONNECT_EXIT typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg, CBS *_cbs); diff --git a/lib/libssl/tls13_legacy.c b/lib/libssl/tls13_legacy.c index df4408d9039..3368600c60f 100644 --- a/lib/libssl/tls13_legacy.c +++ b/lib/libssl/tls13_legacy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_legacy.c,v 1.29 2021/09/04 16:26:12 jsing Exp $ */ +/* $OpenBSD: tls13_legacy.c,v 1.30 2021/09/14 14:31:21 tb Exp $ */ /* * Copyright (c) 2018, 2019 Joel Sing * @@ -407,7 +407,12 @@ tls13_legacy_accept(SSL *ssl) if (ret == TLS13_IO_USE_LEGACY) return ssl->method->ssl_accept(ssl); - return tls13_legacy_return_code(ssl, ret); + ret = tls13_legacy_return_code(ssl, ret); + + if (ctx->info_cb != NULL) + ctx->info_cb(ctx, TLS13_INFO_ACCEPT_EXIT, ret); + + return ret; } int @@ -446,7 +451,12 @@ tls13_legacy_connect(SSL *ssl) if (ret == TLS13_IO_USE_LEGACY) return ssl->method->ssl_connect(ssl); - return tls13_legacy_return_code(ssl, ret); + ret = tls13_legacy_return_code(ssl, ret); + + if (ctx->info_cb != NULL) + ctx->info_cb(ctx, TLS13_INFO_CONNECT_EXIT, ret); + + return ret; } int -- 2.20.1