]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: quic: Move CRYPTO data buffer defintions to QUIC TLS module
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 27 Nov 2023 09:09:12 +0000 (10:09 +0100)
committerFrédéric Lécaille <flecaille@haproxy.com>
Tue, 28 Nov 2023 14:37:22 +0000 (15:37 +0100)
Move quic_crypto_buf struct definition from quic_conn-t.h to quic_tls-t.h.
Also move its pool definition/declaration to quic_tls-t.h/quic_tls.c.

include/haproxy/quic_conn-t.h
include/haproxy/quic_tls-t.h
src/quic_conn.c
src/quic_tls.c

index fb129f8b2ba10439c08da1bdc4d257e8769c54b0..b7eb7d44c80eaa91d295cb760e73b4fc4d011932 100644 (file)
@@ -195,8 +195,6 @@ enum quic_pkt_type {
 /* Size of the QUIC RX buffer for the connections */
 #define QUIC_CONN_RX_BUFSZ (1UL << 16)
 
-extern struct pool_head *pool_head_quic_crypto_buf;
-
 struct quic_version {
        uint32_t num;
        const unsigned char *initial_salt;
@@ -234,23 +232,9 @@ extern const struct quic_version *preferred_version;
 /* The QUIC packet numbers are 62-bits integers */
 #define QUIC_MAX_PACKET_NUM      ((1ULL << 62) - 1)
 
-#define QUIC_CRYPTO_BUF_SHIFT  10
-#define QUIC_CRYPTO_BUF_MASK   ((1UL << QUIC_CRYPTO_BUF_SHIFT) - 1)
-/* The maximum allowed size of CRYPTO data buffer provided by the TLS stack. */
-#define QUIC_CRYPTO_BUF_SZ    (1UL << QUIC_CRYPTO_BUF_SHIFT) /* 1 KB */
-
 /* The maximum number of bytes of CRYPTO data in flight during handshakes. */
 #define QUIC_CRYPTO_IN_FLIGHT_MAX 4096
 
-/*
- * CRYPTO buffer struct.
- * Such buffers are used to send CRYPTO data.
- */
-struct quic_crypto_buf {
-       unsigned char data[QUIC_CRYPTO_BUF_SZ];
-       size_t sz;
-};
-
 /* Crypto data stream (one by encryption level) */
 struct quic_cstream {
        struct {
index a83efe2799d9c8e57cbf9df2cdcac390a120d026..edbbeeff5b1b8f5a37e0e79c368c2f575e4aa766 100644 (file)
@@ -203,6 +203,22 @@ struct quic_tls_ctx {
        unsigned char flags;
 };
 
+#define QUIC_CRYPTO_BUF_SHIFT  10
+#define QUIC_CRYPTO_BUF_MASK   ((1UL << QUIC_CRYPTO_BUF_SHIFT) - 1)
+/* The maximum allowed size of CRYPTO data buffer provided by the TLS stack. */
+#define QUIC_CRYPTO_BUF_SZ    (1UL << QUIC_CRYPTO_BUF_SHIFT) /* 1 KB */
+
+extern struct pool_head *pool_head_quic_crypto_buf;
+
+/*
+ * CRYPTO buffer struct.
+ * Such buffers are used to send CRYPTO data.
+ */
+struct quic_crypto_buf {
+       unsigned char data[QUIC_CRYPTO_BUF_SZ];
+       size_t sz;
+};
+
 struct quic_enc_level {
        struct list list;
        /* Attach point to enqueue this encryption level during retransmissions */
index 2b175d83d56e852dea54be47a2427280566ec4bc..334f7dccaec1f69d078415bf9b5056876b4ecdec 100644 (file)
@@ -137,7 +137,6 @@ DECLARE_STATIC_POOL(pool_head_quic_cc_conn, "quic_cc_conn", sizeof(struct quic_c
 DECLARE_STATIC_POOL(pool_head_quic_cids, "quic_cids", sizeof(struct eb_root));
 DECLARE_POOL(pool_head_quic_connection_id,
              "quic_connection_id", sizeof(struct quic_connection_id));
-DECLARE_POOL(pool_head_quic_crypto_buf, "quic_crypto_buf", sizeof(struct quic_crypto_buf));
 DECLARE_STATIC_POOL(pool_head_quic_cstream, "quic_cstream", sizeof(struct quic_cstream));
 
 struct task *quic_conn_app_io_cb(struct task *t, void *context, unsigned int state);
index da25632e626050531a7215138e829947112f0cd6..a75f012153ba8b642d3c5be71d4b2948e2ad84fc 100644 (file)
@@ -20,6 +20,8 @@ DECLARE_POOL(pool_head_quic_tls_secret, "quic_tls_secret", QUIC_TLS_SECRET_LEN);
 DECLARE_POOL(pool_head_quic_tls_iv,     "quic_tls_iv",     QUIC_TLS_IV_LEN);
 DECLARE_POOL(pool_head_quic_tls_key,    "quic_tls_key",    QUIC_TLS_KEY_LEN);
 
+DECLARE_POOL(pool_head_quic_crypto_buf, "quic_crypto_buf", sizeof(struct quic_crypto_buf));
+
 /* Initial salt depending on QUIC version to derive client/server initial secrets.
  * This one is for draft-29 QUIC version.
  */