]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
remove duplicate defines, add comment
authorPauli <pauli@openssl.org>
Mon, 26 Jun 2023 09:30:51 +0000 (19:30 +1000)
committerPauli <pauli@openssl.org>
Wed, 19 Jul 2023 03:02:07 +0000 (13:02 +1000)
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21441)

include/internal/quic_types.h

index bc111fb8db13933a0c71f0898747d16318df44e4..bc7c51c49a5bbc95f6adbfd3437afec92173d4ea 100644 (file)
 # ifndef OPENSSL_NO_QUIC
 
 /* QUIC encryption levels. */
-#  define QUIC_ENC_LEVEL_INITIAL          0
-#  define QUIC_ENC_LEVEL_HANDSHAKE        1
-#  define QUIC_ENC_LEVEL_0RTT             2
-#  define QUIC_ENC_LEVEL_1RTT             3
-#  define QUIC_ENC_LEVEL_NUM              4
+enum {
+    QUIC_ENC_LEVEL_INITIAL = 0,
+    QUIC_ENC_LEVEL_HANDSHAKE,
+    QUIC_ENC_LEVEL_0RTT,
+    QUIC_ENC_LEVEL_1RTT,
+    QUIC_ENC_LEVEL_NUM       /* Must be the ultimate entry */
+};
 
 /* QUIC packet number spaces. */
-#  define QUIC_PN_SPACE_INITIAL           0
-#  define QUIC_PN_SPACE_HANDSHAKE         1
-#  define QUIC_PN_SPACE_APP               2
-#  define QUIC_PN_SPACE_NUM               3
+enum {
+    QUIC_PN_SPACE_INITIAL = 0,
+    QUIC_PN_SPACE_HANDSHAKE,
+    /* New entries must go here, so that QUIC_PN_SPACE_APP is the penultimate */
+    QUIC_PN_SPACE_APP,
+    QUIC_PN_SPACE_NUM       /* Must be the ultimate entry */
+};
 
 static ossl_unused ossl_inline uint32_t
 ossl_quic_enc_level_to_pn_space(uint32_t enc_level)
@@ -47,12 +52,6 @@ ossl_quic_enc_level_to_pn_space(uint32_t enc_level)
     }
 }
 
-/* QUIC packet number spaces. */
-#  define QUIC_PN_SPACE_INITIAL       0
-#  define QUIC_PN_SPACE_HANDSHAKE     1
-#  define QUIC_PN_SPACE_APP           2
-#  define QUIC_PN_SPACE_NUM           3
-
 /* QUIC packet number representation. */
 typedef uint64_t QUIC_PN;
 #  define QUIC_PN_INVALID            UINT64_MAX