]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Rename list macros
authorNeil Horman <nhorman@openssl.org>
Mon, 23 Sep 2024 16:11:01 +0000 (12:11 -0400)
committerTomas Mraz <tomas@openssl.org>
Thu, 26 Sep 2024 08:02:30 +0000 (10:02 +0200)
The quic implementation defined a set of LIST_* macros for list
manipulation, which conflicts with the generally support BSD api found
in the queue.h system header.  While this isn't normally a problem, A
report arrived indicating that MacOSX appears to implicitly include
queue.h from another system header which causes definition conflicts.

As the openssl macros are internal only, it seems the most sensible
thing to do is place them in a well known namespace for our library to
avoid the conflict, so add an OSSL_ prefix to all our macros

Fixes #25516

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/25519)

include/internal/list.h
ssl/quic/quic_engine.c
ssl/quic/quic_port.c
ssl/quic/quic_rcidm.c

index 902047641f7bb381ba8406db6c54c2c2a4b78ca6..a40f7fe6c24924f788917f30b0ce6ffa46e5eb9c 100644 (file)
 #  define OSSL_LIST_DBG(x) x;
 # endif
 
-# define LIST_FOREACH_FROM(p, name, init)                                   \
+# define OSSL_LIST_FOREACH_FROM(p, name, init)                              \
     for ((p) = (init);                                                      \
          (p) != NULL;                                                       \
          (p) = ossl_list_##name##_next(p))
-# define LIST_FOREACH(p, name, l)                                           \
-    LIST_FOREACH_FROM(p, name, ossl_list_##name##_head(l))
+# define OSSL_LIST_FOREACH(p, name, l)                                      \
+    OSSL_LIST_FOREACH_FROM(p, name, ossl_list_##name##_head(l))
 
-# define LIST_FOREACH_REV_FROM(p, name, init)                               \
+# define OSSL_LIST_FOREACH_REV_FROM(p, name, init)                          \
     for ((p) = (init);                                                      \
          (p) != NULL;                                                       \
          (p) = ossl_list_##name##_prev(p))
-# define LIST_FOREACH_REV(p, name, l)                                       \
-    LIST_FOREACH_FROM(p, name, ossl_list_##name##_tail(l))
+# define OSSL_LIST_FOREACH_REV(p, name, l)                                  \
+    OSSL_LIST_FOREACH_FROM(p, name, ossl_list_##name##_tail(l))
 
-# define LIST_FOREACH_DELSAFE_FROM(p, pn, name, init)                       \
+# define OSSL_LIST_FOREACH_DELSAFE_FROM(p, pn, name, init)                  \
     for ((p) = (init);                                                      \
          (p) != NULL && (((pn) = ossl_list_##name##_next(p)), 1);           \
          (p) = (pn))
-#define LIST_FOREACH_DELSAFE(p, pn, name, l)                                \
-    LIST_FOREACH_DELSAFE_FROM(p, pn, name, ossl_list_##name##_head(l))
+#define OSSL_LIST_FOREACH_DELSAFE(p, pn, name, l)                           \
+    OSSL_LIST_FOREACH_DELSAFE_FROM(p, pn, name, ossl_list_##name##_head(l))
 
-# define LIST_FOREACH_REV_DELSAFE_FROM(p, pn, name, init)                   \
+# define OSSL_LIST_FOREACH_REV_DELSAFE_FROM(p, pn, name, init)              \
     for ((p) = (init);                                                      \
          (p) != NULL && (((pn) = ossl_list_##name##_prev(p)), 1);           \
          (p) = (pn))
-# define LIST_FOREACH_REV_DELSAFE(p, pn, name, l)                           \
-    LIST_FOREACH_REV_DELSAFE_FROM(p, pn, name, ossl_list_##name##_tail(l))
+# define OSSL_LIST_FOREACH_REV_DELSAFE(p, pn, name, l)                      \
+    OSSL_LIST_FOREACH_REV_DELSAFE_FROM(p, pn, name, ossl_list_##name##_tail(l))
 
 /* Define a list structure */
 # define OSSL_LIST(name) OSSL_LIST_ ## name
index 3bcb5d6810d34eb41f5d781714e414f9ed5fed9a..f0724f240e3311d792597c5420b31437f179264d 100644 (file)
@@ -131,7 +131,7 @@ static void qeng_tick(QUIC_TICK_RESULT *res, void *arg, uint32_t flags)
         return;
 
     /* Iterate through all ports and service them. */
-    LIST_FOREACH(port, port, &qeng->port_list) {
+    OSSL_LIST_FOREACH(port, port, &qeng->port_list) {
         QUIC_TICK_RESULT subr = {0};
 
         ossl_quic_port_subtick(port, &subr, flags);
index c8cdc668989277de263ae9a13ad1c2eb2a1401ab..87c0ac0ca6c8fc3165eb7705b13420897268bd24 100644 (file)
@@ -273,7 +273,7 @@ int ossl_quic_port_set_net_wbio(QUIC_PORT *port, BIO *net_wbio)
     if (!port_update_poll_desc(port, net_wbio, /*for_write=*/1))
         return 0;
 
-    LIST_FOREACH(ch, ch, &port->channel_list)
+    OSSL_LIST_FOREACH(ch, ch, &port->channel_list)
         ossl_qtx_set_bio(ch->qtx, net_wbio);
 
     port->net_wbio = net_wbio;
@@ -373,7 +373,7 @@ void ossl_quic_port_subtick(QUIC_PORT *port, QUIC_TICK_RESULT *res,
             port_rx_pre(port);
 
         /* Iterate through all channels and service them. */
-        LIST_FOREACH(ch, ch, &port->channel_list) {
+        OSSL_LIST_FOREACH(ch, ch, &port->channel_list) {
             QUIC_TICK_RESULT subr = {0};
 
             ossl_quic_channel_subtick(ch, &subr, flags);
@@ -603,7 +603,7 @@ void ossl_quic_port_raise_net_error(QUIC_PORT *port,
     if (triggering_ch != NULL)
         ossl_quic_channel_raise_net_error(triggering_ch);
 
-    LIST_FOREACH(ch, ch, &port->channel_list)
+    OSSL_LIST_FOREACH(ch, ch, &port->channel_list)
         if (ch != triggering_ch)
             ossl_quic_channel_raise_net_error(ch);
 }
index 77d8cbfcc0d02834e697c72bbc79be8bdeaaa184..18f7e8096b2024ebfb9db0ea16f3efb91b107d2e 100644 (file)
@@ -310,7 +310,7 @@ void ossl_quic_rcidm_free(QUIC_RCIDM *rcidm)
     while ((rcid = ossl_pqueue_RCID_pop(rcidm->rcids)) != NULL)
         OPENSSL_free(rcid);
 
-    LIST_FOREACH_DELSAFE(rcid, rnext, retiring, &rcidm->retiring_list)
+    OSSL_LIST_FOREACH_DELSAFE(rcid, rnext, retiring, &rcidm->retiring_list)
         OPENSSL_free(rcid);
 
     ossl_pqueue_RCID_free(rcidm->rcids);