From: Pauli Date: Mon, 26 Jun 2023 09:30:51 +0000 (+1000) Subject: remove duplicate defines, add comment X-Git-Tag: openssl-3.2.0-alpha1~398 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=157c40e4d0a2c901e2dc0ee29b80a079a548d008;p=thirdparty%2Fopenssl.git remove duplicate defines, add comment Reviewed-by: Tom Cosgrove Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/21441) --- diff --git a/include/internal/quic_types.h b/include/internal/quic_types.h index bc111fb8db1..bc7c51c49a5 100644 --- a/include/internal/quic_types.h +++ b/include/internal/quic_types.h @@ -18,17 +18,22 @@ # 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