summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-06-06 16:25:12 +0100
committerPauli <pauli@openssl.org>2023-07-17 08:17:57 +1000
commit54bd1f24d48c668c125f59e4c63bf9af3fb2f954 (patch)
treeb9e93d661a2c359cfa561e1d765d69890569866c /include
parentf37befa0480ec5d8362a5894e610a676987215b7 (diff)
QUIC CONFORMANCE: Validate preferred_addr transport parameter
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21135)
Diffstat (limited to 'include')
-rw-r--r--include/internal/quic_types.h7
-rw-r--r--include/internal/quic_wire.h13
2 files changed, 20 insertions, 0 deletions
diff --git a/include/internal/quic_types.h b/include/internal/quic_types.h
index 6b86076ff8..cc41adc5ab 100644
--- a/include/internal/quic_types.h
+++ b/include/internal/quic_types.h
@@ -101,6 +101,13 @@ static ossl_unused ossl_inline int ossl_quic_conn_id_eq(const QUIC_CONN_ID *a,
# define QUIC_STATELESS_RESET_TOKEN_LEN 16
+/*
+ * An encoded preferred_addr transport parameter cannot be longer than this
+ * number of bytes.
+ */
+# define QUIC_MIN_ENCODED_PREFERRED_ADDR_LEN 41
+# define QUIC_MAX_ENCODED_PREFERRED_ADDR_LEN 61
+
# endif
#endif
diff --git a/include/internal/quic_wire.h b/include/internal/quic_wire.h
index 8a1ef34ead..d6423415ea 100644
--- a/include/internal/quic_wire.h
+++ b/include/internal/quic_wire.h
@@ -764,6 +764,19 @@ int ossl_quic_wire_decode_transport_param_cid(PACKET *pkt,
uint64_t *id,
QUIC_CONN_ID *cid);
+/*
+ * Decodes a QUIC transport parameter TLV containing a preferred_address.
+ */
+typedef struct quic_preferred_addr_st {
+ uint16_t ipv4_port, ipv6_port;
+ unsigned char ipv4[4], ipv6[16];
+ unsigned char stateless_reset_token[QUIC_STATELESS_RESET_TOKEN_LEN];
+ QUIC_CONN_ID cid;
+} QUIC_PREFERRED_ADDR;
+
+int ossl_quic_wire_decode_transport_param_preferred_addr(PACKET *pkt,
+ QUIC_PREFERRED_ADDR *p);
+
# endif
#endif