Call the info cb on connect/accept exit in TLSv1.3
authortb <tb@openbsd.org>
Tue, 14 Sep 2021 14:31:21 +0000 (14:31 +0000)
committertb <tb@openbsd.org>
Tue, 14 Sep 2021 14:31:21 +0000 (14:31 +0000)
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
lib/libssl/tls13_legacy.c

index 12ed733..2e78e37 100644 (file)
@@ -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 <beck@openbsd.org>
  * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -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);
index df4408d..3368600 100644 (file)
@@ -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 <jsing@openbsd.org>
  *
@@ -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