MINOR: quic: Make QUIC-TLS support at least two initial salts
These salts are used to derive initial secrets to decrypt the first Initial packet.
We support draft-29 and v1 QUIC version initial salts.
Add parameters to our QUIC-TLS API functions used to derive these secret for
these salts.
Make our xprt_quic use the correct initial salt upon QUIC version field found in
the first paquet. Useful to support connections with curl which use draft-29
QUIC version.
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index 7654940..ee7004b 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -3371,6 +3371,8 @@
int ipv4;
struct quic_cid *odcid;
struct ebmb_node *n = NULL;
+ const unsigned char *salt = initial_salt_v1;
+ size_t salt_len = sizeof initial_salt_v1;
if (pkt->type != QUIC_PACKET_TYPE_INITIAL) {
TRACE_PROTO("Non Initiial packet", QUIC_EV_CONN_LPKT);
@@ -3406,7 +3408,12 @@
/* NOTE: the socket address has been concatenated to the destination ID
* chosen by the client for Initial packets.
*/
- if (!qc_new_isecs(qc, pkt->dcid.data, pkt->odcid_len, 1)) {
+ if (pkt->version == QUIC_PROTOCOL_VERSION_DRAFT_29) {
+ salt = initial_salt_draft_29;
+ salt_len = sizeof initial_salt_draft_29;
+ }
+ if (!qc_new_isecs(qc, salt, salt_len,
+ pkt->dcid.data, pkt->odcid_len, 1)) {
TRACE_PROTO("Packet dropped", QUIC_EV_CONN_LPKT, qc->conn);
goto err;
}
@@ -4360,7 +4367,8 @@
conn->qc = qc;
qc->conn = conn;
- if (!qc_new_isecs(qc, dcid, sizeof dcid, 0))
+ if (!qc_new_isecs(qc, initial_salt_v1, sizeof initial_salt_v1,
+ dcid, sizeof dcid, 0))
goto err;
if (ssl_bio_and_sess_init(conn, srv->ssl_ctx.ctx,