]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC CHANNEL: Do not copy terminate cause as it is not modified after termination
authorHugo Landau <hlandau@openssl.org>
Tue, 18 Apr 2023 18:30:55 +0000 (19:30 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 12 May 2023 13:47:12 +0000 (14:47 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20765)

include/internal/quic_channel.h
include/internal/quic_tserver.h
ssl/quic/quic_channel.c
ssl/quic/quic_tserver.c
test/helpers/quictestlib.c

index 32e5a57fd94ab8d66a33dcb83fe42d29388d2e54..a33416fd2b43fdaefef5e763ddc8845c98b42348 100644 (file)
@@ -257,7 +257,8 @@ QUIC_STREAM *ossl_quic_channel_get_stream_by_id(QUIC_CHANNEL *ch,
 
 /* Returns 1 if channel is terminating or terminated. */
 int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch);
-QUIC_TERMINATE_CAUSE ossl_quic_channel_get_terminate_cause(const QUIC_CHANNEL *ch);
+const QUIC_TERMINATE_CAUSE *
+ossl_quic_channel_get_terminate_cause(const QUIC_CHANNEL *ch);
 int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch);
 int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch);
 int ossl_quic_channel_is_active(const QUIC_CHANNEL *ch);
index fd657049abb2576849872c4969b360e866d50f98..89879b01b7c3f1cf2deddd46934068ee8edd070d 100644 (file)
@@ -71,7 +71,8 @@ int ossl_quic_tserver_is_handshake_confirmed(const QUIC_TSERVER *srv);
 /* Returns 1 if the server is in any terminating or terminated state */
 int ossl_quic_tserver_is_term_any(const QUIC_TSERVER *srv);
 
-QUIC_TERMINATE_CAUSE ossl_quic_tserver_get_terminate_cause(const QUIC_TSERVER *srv);
+const QUIC_TERMINATE_CAUSE *
+ossl_quic_tserver_get_terminate_cause(const QUIC_TSERVER *srv);
 
 /* Returns 1 if the server is in a terminated state */
 int ossl_quic_tserver_is_terminated(const QUIC_TSERVER *srv);
index c68916680522259ff1f65dfc4de756d2280352bf..da2436b3c62285c84d9130b0fcd55cbc2bf99a1f 100644 (file)
@@ -445,9 +445,10 @@ int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch)
         || ossl_quic_channel_is_terminated(ch);
 }
 
-QUIC_TERMINATE_CAUSE ossl_quic_channel_get_terminate_cause(const QUIC_CHANNEL *ch)
+const QUIC_TERMINATE_CAUSE *
+ossl_quic_channel_get_terminate_cause(const QUIC_CHANNEL *ch)
 {
-    return ch->terminate_cause;
+    return ossl_quic_channel_is_term_any(ch) ? &ch->terminate_cause : NULL;
 }
 
 int ossl_quic_channel_is_handshake_complete(const QUIC_CHANNEL *ch)
index 12f45166082ea1f0e8054a61ce3412865e3dbed3..17b70eb3a557c55ca00920fcc29269e31eac8977 100644 (file)
@@ -169,7 +169,8 @@ int ossl_quic_tserver_is_term_any(const QUIC_TSERVER *srv)
     return ossl_quic_channel_is_term_any(srv->ch);
 }
 
-QUIC_TERMINATE_CAUSE ossl_quic_tserver_get_terminate_cause(const QUIC_TSERVER *srv)
+const QUIC_TERMINATE_CAUSE *
+ossl_quic_tserver_get_terminate_cause(const QUIC_TSERVER *srv)
 {
     return ossl_quic_channel_get_terminate_cause(srv->ch);
 }
index e60573eb6e9535dfc0376537ea6b63a67e5d92e4..c973a8cc658d1232c03147aff9672002bf4b7c08 100644 (file)
@@ -312,7 +312,7 @@ int qtest_shutdown(QUIC_TSERVER *qtserv, SSL *clientssl)
 
 int qtest_check_server_transport_err(QUIC_TSERVER *qtserv, uint64_t code)
 {
-    QUIC_TERMINATE_CAUSE cause;
+    const QUIC_TERMINATE_CAUSE *cause;
 
     ossl_quic_tserver_tick(qtserv);
 
@@ -323,8 +323,9 @@ int qtest_check_server_transport_err(QUIC_TSERVER *qtserv, uint64_t code)
         return 0;
 
     cause = ossl_quic_tserver_get_terminate_cause(qtserv);
-    if  (!TEST_true(cause.remote)
-            || !TEST_uint64_t_eq(cause.error_code, code))
+    if  (!TEST_ptr(cause)
+            || !TEST_true(cause->remote)
+            || !TEST_uint64_t_eq(cause->error_code, code))
         return 0;
 
     return 1;