Add and use tls13_record_layer_alert_sent()
authortb <tb@openbsd.org>
Mon, 9 Sep 2024 03:32:29 +0000 (03:32 +0000)
committertb <tb@openbsd.org>
Mon, 9 Sep 2024 03:32:29 +0000 (03:32 +0000)
This is a small refactoring that wraps a direct call to the record layer's
alert_sent() callback into a handler for upcoming reuse in the QUIC code.

No functional change.

ok jsing

lib/libssl/tls13_internal.h
lib/libssl/tls13_record_layer.c

index 75d31fb..0819e93 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_internal.h,v 1.103 2024/01/27 14:31:01 jsing Exp $ */
+/* $OpenBSD: tls13_internal.h,v 1.104 2024/09/09 03:32:29 tb Exp $ */
 /*
  * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
  * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -210,6 +210,8 @@ void tls13_record_layer_set_hash(struct tls13_record_layer *rl,
 void tls13_record_layer_set_legacy_version(struct tls13_record_layer *rl,
     uint16_t version);
 void tls13_record_layer_set_retry_after_phh(struct tls13_record_layer *rl, int retry);
+void tls13_record_layer_alert_sent(struct tls13_record_layer *rl,
+    uint8_t alert_level, uint8_t alert_desc);
 void tls13_record_layer_handshake_completed(struct tls13_record_layer *rl);
 int tls13_record_layer_set_read_traffic_key(struct tls13_record_layer *rl,
     struct tls13_secret *read_key, enum ssl_encryption_level_t read_level);
index 5432744..f5604ad 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_record_layer.c,v 1.73 2024/01/27 14:23:51 jsing Exp $ */
+/* $OpenBSD: tls13_record_layer.c,v 1.74 2024/09/09 03:32:29 tb Exp $ */
 /*
  * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
  *
@@ -332,6 +332,13 @@ tls13_record_layer_process_alert(struct tls13_record_layer *rl)
        return ret;
 }
 
+void
+tls13_record_layer_alert_sent(struct tls13_record_layer *rl,
+    uint8_t alert_level, uint8_t alert_desc)
+{
+       rl->cb.alert_sent(alert_level, alert_desc, rl->cb_arg);
+}
+
 static ssize_t
 tls13_record_layer_send_alert(struct tls13_record_layer *rl)
 {
@@ -361,7 +368,7 @@ tls13_record_layer_send_alert(struct tls13_record_layer *rl)
                ret = TLS13_IO_ALERT;
        }
 
-       rl->cb.alert_sent(rl->alert_level, rl->alert_desc, rl->cb_arg);
+       tls13_record_layer_alert_sent(rl, rl->alert_level, rl->alert_desc);
 
        return ret;
 }