summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2022-08-11 11:24:57 +0100
committerTomas Mraz <tomas@openssl.org>2022-09-02 10:03:55 +0200
commit1957148384c72ea7bc33a5c415d8f84526ed6480 (patch)
tree358496fa2a0ea26cd439b59d53af939a656a298b /test
parentec279ac21105a85d9f11eed984eb64405811425d (diff)
QUIC Record Layer (Refactor and TX Side)
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18949)
Diffstat (limited to 'test')
-rw-r--r--test/quic_record_test.c1054
1 files changed, 735 insertions, 319 deletions
diff --git a/test/quic_record_test.c b/test/quic_record_test.c
index 29c0dcf57b..436fe387ec 100644
--- a/test/quic_record_test.c
+++ b/test/quic_record_test.c
@@ -7,28 +7,24 @@
* https://www.openssl.org/source/license.html
*/
-#include "internal/quic_record.h"
+#include "internal/quic_record_rx.h"
+#include "internal/quic_record_tx.h"
#include "testutil.h"
static const QUIC_CONN_ID empty_conn_id = {0, {0}};
-struct test_case {
- const unsigned char *dgram;
- size_t dgram_len;
-};
-
-#define TEST_OP_END 0 /* end of script */
-#define TEST_OP_SET_SCID_LEN 1 /* change SCID length */
-#define TEST_OP_SET_INIT_LARGEST_PN 2 /* set initial largest PN */
-#define TEST_OP_ADD_RX_DCID 3 /* register an RX DCID */
-#define TEST_OP_INJECT 4 /* inject a datagram into demux */
-#define TEST_OP_PROVIDE_SECRET 5 /* provide RX secret */
-#define TEST_OP_PROVIDE_SECRET_INITIAL 6 /* provide RX secret for initial */
-#define TEST_OP_DISCARD_EL 7 /* discard an encryption level */
-#define TEST_OP_CHECK_PKT 8 /* read packet, compare to expected */
-#define TEST_OP_CHECK_NO_PKT 9 /* check no packet is available to read */
-
-struct test_op {
+#define RX_TEST_OP_END 0 /* end of script */
+#define RX_TEST_OP_SET_SCID_LEN 1 /* change SCID length */
+#define RX_TEST_OP_SET_INIT_LARGEST_PN 2 /* set initial largest PN */
+#define RX_TEST_OP_ADD_RX_DCID 3 /* register an RX DCID */
+#define RX_TEST_OP_INJECT 4 /* inject a datagram into demux */
+#define RX_TEST_OP_PROVIDE_SECRET 5 /* provide RX secret */
+#define RX_TEST_OP_PROVIDE_SECRET_INITIAL 6 /* provide RX secret for initial */
+#define RX_TEST_OP_DISCARD_EL 7 /* discard an encryption level */
+#define RX_TEST_OP_CHECK_PKT 8 /* read packet, compare to expected */
+#define RX_TEST_OP_CHECK_NO_PKT 9 /* check no packet is available to read */
+
+struct rx_test_op {
unsigned char op;
const unsigned char *buf;
size_t buf_len;
@@ -36,47 +32,47 @@ struct test_op {
uint32_t enc_level, suite_id;
QUIC_PN largest_pn;
const QUIC_CONN_ID *dcid;
- int (*new_qrl)(QUIC_DEMUX **demux, OSSL_QRL **qrl);
-};
-
-#define OP_END \
- { TEST_OP_END }
-#define OP_SET_SCID_LEN(scid_len) \
- { TEST_OP_SET_SCID_LEN, NULL, 0, NULL, (scid_len), 0, 0, NULL, NULL },
-#define OP_SET_INIT_LARGEST_PN(largest_pn) \
- { TEST_OP_SET_INIT_LARGEST_PN, NULL, 0, NULL, 0, 0, (largest_pn), NULL, NULL },
-#define OP_ADD_RX_DCID(dcid) \
- { TEST_OP_ADD_RX_DCID, NULL, 0, NULL, 0, 0, 0, &(dcid), NULL },
-#define OP_INJECT(dgram) \
- { TEST_OP_INJECT, (dgram), sizeof(dgram), NULL, 0, 0, 0, NULL },
-#define OP_PROVIDE_SECRET(el, suite, key) \
+ int (*new_qrx)(QUIC_DEMUX **demux, OSSL_QRX **qrx);
+};
+
+#define RX_OP_END \
+ { RX_TEST_OP_END }
+#define RX_OP_SET_SCID_LEN(scid_len) \
+ { RX_TEST_OP_SET_SCID_LEN, NULL, 0, NULL, (scid_len), 0, 0, NULL, NULL },
+#define RX_OP_SET_INIT_LARGEST_PN(largest_pn) \
+ { RX_TEST_OP_SET_INIT_LARGEST_PN, NULL, 0, NULL, 0, 0, (largest_pn), NULL, NULL },
+#define RX_OP_ADD_RX_DCID(dcid) \
+ { RX_TEST_OP_ADD_RX_DCID, NULL, 0, NULL, 0, 0, 0, &(dcid), NULL },
+#define RX_OP_INJECT(dgram) \
+ { RX_TEST_OP_INJECT, (dgram), sizeof(dgram), NULL, 0, 0, 0, NULL },
+#define RX_OP_PROVIDE_SECRET(el, suite, key) \
{ \
- TEST_OP_PROVIDE_SECRET, (key), sizeof(key), \
+ RX_TEST_OP_PROVIDE_SECRET, (key), sizeof(key), \
NULL, (el), (suite), 0, NULL, NULL \
},
-#define OP_PROVIDE_SECRET_INITIAL(dcid) \
- { TEST_OP_PROVIDE_SECRET_INITIAL, NULL, 0, NULL, 0, 0, 0, &(dcid), NULL },
-#define OP_DISCARD_EL(el) \
- { TEST_OP_DISCARD_EL, NULL, 0, NULL, (el), 0, 0, NULL, NULL },
-#define OP_CHECK_PKT(expect_hdr, expect_body) \
+#define RX_OP_PROVIDE_SECRET_INITIAL(dcid) \
+ { RX_TEST_OP_PROVIDE_SECRET_INITIAL, NULL, 0, NULL, 0, 0, 0, &(dcid), NULL },
+#define RX_OP_DISCARD_EL(el) \
+ { RX_TEST_OP_DISCARD_EL, NULL, 0, NULL, (el), 0, 0, NULL, NULL },
+#define RX_OP_CHECK_PKT(expect_hdr, expect_body) \
{ \
- TEST_OP_CHECK_PKT, (expect_body), sizeof(expect_body), \
+ RX_TEST_OP_CHECK_PKT, (expect_body), sizeof(expect_body), \
&(expect_hdr), 0, 0, 0, NULL, NULL \
},
-#define OP_CHECK_NO_PKT() \
- { TEST_OP_CHECK_NO_PKT, NULL, 0, NULL, 0, 0, 0, NULL, NULL },
+#define RX_OP_CHECK_NO_PKT() \
+ { RX_TEST_OP_CHECK_NO_PKT, NULL, 0, NULL, 0, 0, 0, NULL, NULL },
-#define OP_INJECT_N(n) \
- OP_INJECT(script_##n##_in)
-#define OP_CHECK_PKT_N(n) \
- OP_CHECK_PKT(script_##n##_expect_hdr, script_##n##_body)
+#define RX_OP_INJECT_N(n) \
+ RX_OP_INJECT(rx_script_##n##_in)
+#define RX_OP_CHECK_PKT_N(n) \
+ RX_OP_CHECK_PKT(rx_script_##n##_expect_hdr, rx_script_##n##_body)
-#define OP_INJECT_CHECK(n) \
- OP_INJECT_N(n) \
- OP_CHECK_PKT_N(n)
+#define RX_OP_INJECT_CHECK(n) \
+ RX_OP_INJECT_N(n) \
+ RX_OP_CHECK_PKT_N(n)
/* 1. RFC 9001 - A.3 Server Initial */
-static const unsigned char script_1_in[] = {
+static const unsigned char rx_script_1_in[] = {
0xcf, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0xf0, 0x67, 0xa5, 0x50, 0x2a,
0x42, 0x62, 0xb5, 0x00, 0x40, 0x75, 0xc0, 0xd9, 0x5a, 0x48, 0x2c, 0xd0,
0x99, 0x1c, 0xd2, 0x5b, 0x0a, 0xac, 0x40, 0x6a, 0x58, 0x16, 0xb6, 0x39,
@@ -91,7 +87,7 @@ static const unsigned char script_1_in[] = {
0xd0, 0x74, 0xee
};
-static const unsigned char script_1_body[] = {
+static const unsigned char rx_script_1_body[] = {
0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x40, 0x5a, 0x02, 0x00, 0x00,
0x56, 0x03, 0x03, 0xee, 0xfc, 0xe7, 0xf7, 0xb3, 0x7b, 0xa1, 0xd1, 0x63,
0x2e, 0x96, 0x67, 0x78, 0x25, 0xdd, 0xf7, 0x39, 0x88, 0xcf, 0xc7, 0x98,
@@ -103,11 +99,11 @@ static const unsigned char script_1_body[] = {
0x02, 0x03, 0x04
};
-static const QUIC_CONN_ID script_1_dcid = {
+static const QUIC_CONN_ID rx_script_1_dcid = {
8, { 0x83, 0x94, 0xc8, 0xf0, 0x3e, 0x51, 0x57, 0x08 }
};
-static const QUIC_PKT_HDR script_1_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_1_expect_hdr = {
QUIC_PKT_TYPE_INITIAL,
0, 0, 2, 0, 1, 1, { 0, {0} },
{ 8, {0xf0, 0x67, 0xa5, 0x50, 0x2a, 0x42, 0x62, 0xb5 } },
@@ -116,33 +112,33 @@ static const QUIC_PKT_HDR script_1_expect_hdr = {
99, NULL
};
-static const struct test_op script_1[] = {
- OP_SET_SCID_LEN(2)
- OP_SET_INIT_LARGEST_PN(0)
- OP_ADD_RX_DCID(empty_conn_id)
- OP_PROVIDE_SECRET_INITIAL(script_1_dcid)
- OP_INJECT_CHECK(1)
- OP_CHECK_NO_PKT()
- OP_END
+static const struct rx_test_op rx_script_1[] = {
+ RX_OP_SET_SCID_LEN(2)
+ RX_OP_SET_INIT_LARGEST_PN(0)
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_PROVIDE_SECRET_INITIAL(rx_script_1_dcid)
+ RX_OP_INJECT_CHECK(1)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_END
};
/* 2. RFC 9001 - A.5 ChaCha20-Poly1305 Short Header Packet */
-static const unsigned char script_2_in[] = {
+static const unsigned char rx_script_2_in[] = {
0x4c, 0xfe, 0x41, 0x89, 0x65, 0x5e, 0x5c, 0xd5, 0x5c, 0x41, 0xf6, 0x90,
0x80, 0x57, 0x5d, 0x79, 0x99, 0xc2, 0x5a, 0x5b, 0xfb
};
-static const unsigned char script_2_secret[] = {
+static const unsigned char rx_script_2_secret[] = {
0x9a, 0xc3, 0x12, 0xa7, 0xf8, 0x77, 0x46, 0x8e, 0xbe, 0x69, 0x42, 0x27,
0x48, 0xad, 0x00, 0xa1, 0x54, 0x43, 0xf1, 0x82, 0x03, 0xa0, 0x7d, 0x60,
0x60, 0xf6, 0x88, 0xf3, 0x0f, 0x21, 0x63, 0x2b
};
-static const unsigned char script_2_body[] = {
+static const unsigned char rx_script_2_body[] = {
0x01
};
-static const QUIC_PKT_HDR script_2_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_2_expect_hdr = {
QUIC_PKT_TYPE_1RTT,
0, 0, 3, 0, 1, 0, {0, {0}}, {0, {0}},
{0x00, 0xbf, 0xf4, 0x00},
@@ -150,18 +146,18 @@ static const QUIC_PKT_HDR script_2_expect_hdr = {
1, NULL
};
-static const struct test_op script_2[] = {
- OP_SET_INIT_LARGEST_PN(654360560)
- OP_ADD_RX_DCID(empty_conn_id)
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT, QRL_SUITE_CHACHA20POLY1305,
- script_2_secret)
- OP_INJECT_CHECK(2)
- OP_CHECK_NO_PKT()
- OP_END
+static const struct rx_test_op rx_script_2[] = {
+ RX_OP_SET_INIT_LARGEST_PN(654360560)
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT, QRL_SUITE_CHACHA20POLY1305,
+ rx_script_2_secret)
+ RX_OP_INJECT_CHECK(2)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_END
};
/* 3. Real World - Version Negotiation Response */
-static const unsigned char script_3_in[] = {
+static const unsigned char rx_script_3_in[] = {
0xc7, /* Long; Random Bits */
0x00, 0x00, 0x00, 0x00, /* Version 0 (Version Negotiation) */
0x00, /* DCID */
@@ -172,7 +168,7 @@ static const unsigned char script_3_in[] = {
0xaa, 0x9a, 0x3a, 0x9a /* Supported Version: Random (GREASE) */
};
-static const QUIC_PKT_HDR script_3_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_3_expect_hdr = {
QUIC_PKT_TYPE_VERSION_NEG,
0, /* Spin Bit */
0, /* Key Phase */
@@ -188,20 +184,20 @@ static const QUIC_PKT_HDR script_3_expect_hdr = {
8, NULL
};
-static const unsigned char script_3_body[] = {
+static const unsigned char rx_script_3_body[] = {
0x00, 0x00, 0x00, 0x01,
0xaa, 0x9a, 0x3a, 0x9a
};
-static const struct test_op script_3[] = {
- OP_ADD_RX_DCID(empty_conn_id)
- OP_INJECT_CHECK(3)
- OP_CHECK_NO_PKT()
- OP_END
+static const struct rx_test_op rx_script_3[] = {
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_INJECT_CHECK(3)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_END
};
/* 4. Real World - Retry (S2C) */
-static const unsigned char script_4_in[] = {
+static const unsigned char rx_script_4_in[] = {
0xf0, /* Long; Retry */
0x00, 0x00, 0x00, 0x01, /* Version 1 */
0x00, /* DCID */
@@ -219,7 +215,7 @@ static const unsigned char script_4_in[] = {
0x9d, 0x82, 0xb3, 0x45, 0x62, 0x4c,
};
-static const QUIC_PKT_HDR script_4_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_4_expect_hdr = {
QUIC_PKT_TYPE_RETRY,
0, /* Spin Bit */
0, /* Key Phase */
@@ -234,7 +230,7 @@ static const QUIC_PKT_HDR script_4_expect_hdr = {
114, NULL
};
-static const unsigned char script_4_body[] = {
+static const unsigned char rx_script_4_body[] = {
0xf6, 0x8b, 0x6e, 0xa3, 0xdc, 0x40, 0x38, 0xc6, 0xa5, 0x99, 0x1c, 0xa9,
0x77, 0xe6, 0x1d, 0x4f, 0x09, 0x36, 0x12, 0x26, 0x00, 0x56, 0x0b, 0x29,
0x7d, 0x5e, 0xda, 0x39, 0xc6, 0x61, 0x57, 0x69, 0x15, 0xff, 0x93, 0x39,
@@ -247,34 +243,34 @@ static const unsigned char script_4_body[] = {
0x9d, 0x82, 0xb3, 0x45, 0x62, 0x4c
};
-static const struct test_op script_4[] = {
- OP_ADD_RX_DCID(empty_conn_id)
- OP_INJECT_CHECK(4)
- OP_CHECK_NO_PKT()
- OP_END
+static const struct rx_test_op rx_script_4[] = {
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_INJECT_CHECK(4)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_END
};
/*
* 5. Real World - S2C Multiple Packets
* - Initial, Handshake, 1-RTT (AES-128-GCM/SHA256)
*/
-static const QUIC_CONN_ID script_5_c2s_init_dcid = {
+static const QUIC_CONN_ID rx_script_5_c2s_init_dcid = {
4, {0xad, 0x15, 0x3f, 0xae}
};
-static const unsigned char script_5_handshake_secret[32] = {
+static const unsigned char rx_script_5_handshake_secret[32] = {
0x5e, 0xc6, 0x4a, 0x4d, 0x0d, 0x40, 0x43, 0x3b, 0xd5, 0xbd, 0xe0, 0x19,
0x71, 0x47, 0x56, 0xf3, 0x59, 0x3a, 0xa6, 0xc9, 0x3e, 0xdc, 0x81, 0x1e,
0xc7, 0x72, 0x9d, 0x83, 0xd8, 0x8f, 0x88, 0x77
};
-static const unsigned char script_5_1rtt_secret[32] = {
+static const unsigned char rx_script_5_1rtt_secret[32] = {
0x53, 0xf2, 0x1b, 0x94, 0xa7, 0x65, 0xf7, 0x76, 0xfb, 0x06, 0x27, 0xaa,
0xd2, 0x3f, 0xe0, 0x9a, 0xbb, 0xcf, 0x99, 0x6f, 0x13, 0x2c, 0x6a, 0x37,
0x95, 0xf3, 0xda, 0x21, 0xcb, 0xcb, 0xa5, 0x26,
};
-static const unsigned char script_5_in[] = {
+static const unsigned char rx_script_5_in[] = {
/* First Packet: Initial */
0xc4, /* Long, Initial, PN Length=2 bytes */
0x00, 0x00, 0x00, 0x01, /* Version */
@@ -400,7 +396,7 @@ static const unsigned char script_5_in[] = {
0x9a, 0x31, 0x56, 0xc7,
};
-static const QUIC_PKT_HDR script_5a_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_5a_expect_hdr = {
QUIC_PKT_TYPE_INITIAL,
0, /* Spin Bit */
0, /* Key Phase */
@@ -415,7 +411,7 @@ static const QUIC_PKT_HDR script_5a_expect_hdr = {
448, NULL
};
-static const unsigned char script_5a_body[] = {
+static const unsigned char rx_script_5a_body[] = {
0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -456,7 +452,7 @@ static const unsigned char script_5a_body[] = {
0x1f, 0x54, 0x86, 0x1d,
};
-static const QUIC_PKT_HDR script_5b_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_5b_expect_hdr = {
QUIC_PKT_TYPE_HANDSHAKE,
0, /* Spin Bit */
0, /* Key Phase */
@@ -471,7 +467,7 @@ static const QUIC_PKT_HDR script_5b_expect_hdr = {
650, NULL
};
-static const unsigned char script_5b_body[] = {
+static const unsigned char rx_script_5b_body[] = {
0x06, 0x00, 0x42, 0x86, 0x08, 0x00, 0x00, 0x7d, 0x00, 0x7b, 0x00, 0x10,
0x00, 0x08, 0x00, 0x06, 0x05, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x00, 0x39,
0x00, 0x6b, 0x4b, 0x20, 0x0b, 0x1b, 0xe1, 0x1f, 0xd0, 0x78, 0xc0, 0x69,
@@ -529,7 +525,7 @@ static const unsigned char script_5b_body[] = {
0x53, 0x0a,
};
-static const QUIC_PKT_HDR script_5c_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_5c_expect_hdr = {
QUIC_PKT_TYPE_1RTT,
0, /* Spin Bit */
0, /* Key Phase */
@@ -544,7 +540,7 @@ static const QUIC_PKT_HDR script_5c_expect_hdr = {
72, NULL
};
-static const unsigned char script_5c_body[] = {
+static const unsigned char rx_script_5c_body[] = {
0x18, 0x03, 0x00, 0x04, 0x92, 0xec, 0xaa, 0xd6, 0x47, 0xd8, 0x8b, 0x56,
0x3b, 0x5f, 0x67, 0xe6, 0xb9, 0xb9, 0xca, 0x72, 0xca, 0xf2, 0x49, 0x7d,
0x18, 0x02, 0x00, 0x04, 0xa9, 0x6e, 0x9b, 0x84, 0x26, 0x43, 0x00, 0xc7,
@@ -553,92 +549,92 @@ static const unsigned char script_5c_body[] = {
0xef, 0x97, 0x1e, 0x9a, 0x3c, 0xab, 0x1e, 0xfc, 0xb7, 0x90, 0xc3, 0x1a,
};
-static const struct test_op script_5[] = {
- OP_ADD_RX_DCID(empty_conn_id)
- OP_PROVIDE_SECRET_INITIAL(script_5_c2s_init_dcid)
- OP_INJECT_N(5)
- OP_CHECK_PKT_N(5a)
- OP_CHECK_NO_PKT() /* not got secret for next packet yet */
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
- QRL_SUITE_AES128GCM, script_5_handshake_secret)
- OP_CHECK_PKT_N(5b)
- OP_CHECK_NO_PKT() /* not got secret for next packet yet */
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
- QRL_SUITE_AES128GCM, script_5_1rtt_secret)
- OP_CHECK_PKT_N(5c)
- OP_CHECK_NO_PKT()
+static const struct rx_test_op rx_script_5[] = {
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_PROVIDE_SECRET_INITIAL(rx_script_5_c2s_init_dcid)
+ RX_OP_INJECT_N(5)
+ RX_OP_CHECK_PKT_N(5a)
+ RX_OP_CHECK_NO_PKT() /* not got secret for next packet yet */
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
+ QRL_SUITE_AES128GCM, rx_script_5_handshake_secret)
+ RX_OP_CHECK_PKT_N(5b)
+ RX_OP_CHECK_NO_PKT() /* not got secret for next packet yet */
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
+ QRL_SUITE_AES128GCM, rx_script_5_1rtt_secret)
+ RX_OP_CHECK_PKT_N(5c)
+ RX_OP_CHECK_NO_PKT()
/* Try injecting the packet again */
- OP_INJECT_N(5)
+ RX_OP_INJECT_N(5)
/*
* Initial packet is not output due to receiving a Handshake packet causing
* auto-discard of Initial keys
*/
- OP_CHECK_PKT_N(5b)
- OP_CHECK_PKT_N(5c)
- OP_CHECK_NO_PKT()
+ RX_OP_CHECK_PKT_N(5b)
+ RX_OP_CHECK_PKT_N(5c)
+ RX_OP_CHECK_NO_PKT()
/* Try again with discarded keys */
- OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
- OP_INJECT_N(5)
- OP_CHECK_PKT_N(5c)
- OP_CHECK_NO_PKT()
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
+ RX_OP_INJECT_N(5)
+ RX_OP_CHECK_PKT_N(5c)
+ RX_OP_CHECK_NO_PKT()
/* Try again */
- OP_INJECT_N(5)
- OP_CHECK_PKT_N(5c)
- OP_CHECK_NO_PKT()
+ RX_OP_INJECT_N(5)
+ RX_OP_CHECK_PKT_N(5c)
+ RX_OP_CHECK_NO_PKT()
/* Try again with discarded 1-RTT keys */
- OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
- OP_INJECT_N(5)
- OP_CHECK_NO_PKT()
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
+ RX_OP_INJECT_N(5)
+ RX_OP_CHECK_NO_PKT()
/* Recreate QRL, test reading packets received before key */
- OP_SET_SCID_LEN(0)
- OP_ADD_RX_DCID(empty_conn_id)
- OP_INJECT_N(5)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET_INITIAL(script_5_c2s_init_dcid)
- OP_CHECK_PKT_N(5a)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
- QRL_SUITE_AES128GCM, script_5_handshake_secret)
- OP_CHECK_PKT_N(5b)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
- QRL_SUITE_AES128GCM, script_5_1rtt_secret)
- OP_CHECK_PKT_N(5c)
- OP_CHECK_NO_PKT()
-
- OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
- OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
- OP_INJECT_N(5)
- OP_CHECK_NO_PKT()
-
- OP_END
+ RX_OP_SET_SCID_LEN(0)
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_INJECT_N(5)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET_INITIAL(rx_script_5_c2s_init_dcid)
+ RX_OP_CHECK_PKT_N(5a)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
+ QRL_SUITE_AES128GCM, rx_script_5_handshake_secret)
+ RX_OP_CHECK_PKT_N(5b)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
+ QRL_SUITE_AES128GCM, rx_script_5_1rtt_secret)
+ RX_OP_CHECK_PKT_N(5c)
+ RX_OP_CHECK_NO_PKT()
+
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
+ RX_OP_INJECT_N(5)
+ RX_OP_CHECK_NO_PKT()
+
+ RX_OP_END
};
/*
* 6. Real World - S2C Multiple Packets
* - Initial, Handshake, 1-RTT (AES-256-GCM/SHA384)
*/
-static const QUIC_CONN_ID script_6_c2s_init_dcid = {
+static const QUIC_CONN_ID rx_script_6_c2s_init_dcid = {
4, {0xac, 0x88, 0x95, 0xbd}
};
-static const unsigned char script_6_handshake_secret[48] = {
+static const unsigned char rx_script_6_handshake_secret[48] = {
0xd1, 0x41, 0xb0, 0xf6, 0x0d, 0x8b, 0xbd, 0xe8, 0x5b, 0xa8, 0xff, 0xd7,
0x18, 0x9a, 0x23, 0x7b, 0x13, 0x5c, 0x1e, 0x90, 0x1d, 0x08, 0x95, 0xcc,
0xc5, 0x8e, 0x73, 0x4e, 0x02, 0x6f, 0x3c, 0xb6, 0x26, 0x77, 0x8d, 0x53,
0xc5, 0x62, 0x9f, 0xb5, 0xf0, 0x88, 0xfb, 0xe5, 0x14, 0x71, 0xab, 0xe6,
};
-static const unsigned char script_6_1rtt_secret[48] = {
+static const unsigned char rx_script_6_1rtt_secret[48] = {
0x2d, 0x6b, 0x9d, 0xd4, 0x39, 0xa0, 0xe7, 0xff, 0x17, 0xe2, 0xcb, 0x5c,
0x0d, 0x4a, 0xf6, 0x3f, 0xf4, 0xfe, 0xfc, 0xe5, 0x22, 0xfa, 0xf5, 0x5b,
0xc0, 0xb2, 0x18, 0xbb, 0x92, 0x4d, 0x35, 0xea, 0x67, 0xa6, 0xe7, 0xc1,
0x90, 0x10, 0xc9, 0x14, 0x46, 0xf5, 0x95, 0x57, 0x8b, 0x90, 0x88, 0x5d,
};
-static const unsigned char script_6_in[] = {
+static const unsigned char rx_script_6_in[] = {
/* First Packet: Initial */
0xc5, /* Long, Initial, PN Length=2 bytes */
0x00, 0x00, 0x00, 0x01, /* Version */
@@ -764,7 +760,7 @@ static const unsigned char script_6_in[] = {
0xfe, 0xb1, 0x25, 0x1a,
};
-static const QUIC_PKT_HDR script_6a_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_6a_expect_hdr = {
QUIC_PKT_TYPE_INITIAL,
0, /* Spin Bit */
0, /* Key Phase */
@@ -779,7 +775,7 @@ static const QUIC_PKT_HDR script_6a_expect_hdr = {
428, NULL
};
-static const unsigned char script_6a_body[] = {
+static const unsigned char rx_script_6a_body[] = {
0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -818,7 +814,7 @@ static const unsigned char script_6a_body[] = {
0xb2, 0xd9, 0xad, 0xd1, 0x14, 0xdc, 0x84, 0x61,
};
-static const QUIC_PKT_HDR script_6b_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_6b_expect_hdr = {
QUIC_PKT_TYPE_HANDSHAKE,
0, /* Spin Bit */
0, /* Key Phase */
@@ -833,7 +829,7 @@ static const QUIC_PKT_HDR script_6b_expect_hdr = {
670, NULL
};
-static const unsigned char script_6b_body[] = {
+static const unsigned char rx_script_6b_body[] = {
0x06, 0x00, 0x42, 0x9a, 0x08, 0x00, 0x00, 0x80, 0x00, 0x7e, 0x00, 0x10,
0x00, 0x08, 0x00, 0x06, 0x05, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x00, 0x39,
0x00, 0x6e, 0x47, 0xfa, 0x05, 0x5a, 0xe0, 0xec, 0x4a, 0xf3, 0x05, 0x04,
@@ -892,7 +888,7 @@ static const unsigned char script_6b_body[] = {
0xc4, 0x4e, 0x96, 0x19, 0x68, 0x2d, 0xbe, 0x6f, 0x49, 0xfa,
};
-static const QUIC_PKT_HDR script_6c_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_6c_expect_hdr = {
QUIC_PKT_TYPE_1RTT,
0, /* Spin Bit */
0, /* Key Phase */
@@ -907,7 +903,7 @@ static const QUIC_PKT_HDR script_6c_expect_hdr = {
72, NULL
};
-static const unsigned char script_6c_body[] = {
+static const unsigned char rx_script_6c_body[] = {
0x18, 0x03, 0x00, 0x04, 0xf2, 0x94, 0x49, 0xc3, 0x34, 0xa1, 0xf4, 0x0f,
0xcb, 0xb8, 0x03, 0x04, 0x1f, 0xc8, 0x69, 0xb9, 0x3b, 0xd5, 0xc6, 0x93,
0x18, 0x02, 0x00, 0x04, 0x9a, 0x4f, 0xec, 0x52, 0xde, 0xd2, 0xc8, 0xb7,
@@ -916,85 +912,85 @@ static const unsigned char script_6c_body[] = {
0xfc, 0x58, 0x0e, 0xa4, 0xf4, 0xf3, 0x23, 0x1b, 0xd6, 0x8e, 0x5b, 0x08,
};
-static const struct test_op script_6[] = {
- OP_ADD_RX_DCID(empty_conn_id)
- OP_PROVIDE_SECRET_INITIAL(script_6_c2s_init_dcid)
- OP_INJECT_N(6)
- OP_CHECK_PKT_N(6a)
- OP_CHECK_NO_PKT() /* not got secret for next packet yet */
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
- QRL_SUITE_AES256GCM, script_6_handshake_secret)
- OP_CHECK_PKT_N(6b)
- OP_CHECK_NO_PKT() /* not got secret for next packet yet */
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
- QRL_SUITE_AES256GCM, script_6_1rtt_secret)
- OP_CHECK_PKT_N(6c)
- OP_CHECK_NO_PKT()
+static const struct rx_test_op rx_script_6[] = {
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_PROVIDE_SECRET_INITIAL(rx_script_6_c2s_init_dcid)
+ RX_OP_INJECT_N(6)
+ RX_OP_CHECK_PKT_N(6a)
+ RX_OP_CHECK_NO_PKT() /* not got secret for next packet yet */
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
+ QRL_SUITE_AES256GCM, rx_script_6_handshake_secret)
+ RX_OP_CHECK_PKT_N(6b)
+ RX_OP_CHECK_NO_PKT() /* not got secret for next packet yet */
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
+ QRL_SUITE_AES256GCM, rx_script_6_1rtt_secret)
+ RX_OP_CHECK_PKT_N(6c)
+ RX_OP_CHECK_NO_PKT()
/* Try injecting the packet again */
- OP_INJECT_N(6)
+ RX_OP_INJECT_N(6)
/*
* Initial packet is not output due to receiving a Handshake packet causing
* auto-discard of Initial keys
*/
- OP_CHECK_PKT_N(6b)
- OP_CHECK_PKT_N(6c)
- OP_CHECK_NO_PKT()
+ RX_OP_CHECK_PKT_N(6b)
+ RX_OP_CHECK_PKT_N(6c)
+ RX_OP_CHECK_NO_PKT()
/* Try again with discarded keys */
- OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
- OP_INJECT_N(6)
- OP_CHECK_PKT_N(6c)
- OP_CHECK_NO_PKT()
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
+ RX_OP_INJECT_N(6)
+ RX_OP_CHECK_PKT_N(6c)
+ RX_OP_CHECK_NO_PKT()
/* Try again */
- OP_INJECT_N(6)
- OP_CHECK_PKT_N(6c)
- OP_CHECK_NO_PKT()
+ RX_OP_INJECT_N(6)
+ RX_OP_CHECK_PKT_N(6c)
+ RX_OP_CHECK_NO_PKT()
/* Try again with discarded 1-RTT keys */
- OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
- OP_INJECT_N(6)
- OP_CHECK_NO_PKT()
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
+ RX_OP_INJECT_N(6)
+ RX_OP_CHECK_NO_PKT()
/* Recreate QRL, test reading packets received before key */
- OP_SET_SCID_LEN(0)
- OP_ADD_RX_DCID(empty_conn_id)
- OP_INJECT_N(6)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET_INITIAL(script_6_c2s_init_dcid)
- OP_CHECK_PKT_N(6a)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
- QRL_SUITE_AES256GCM, script_6_handshake_secret)
- OP_CHECK_PKT_N(6b)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
- QRL_SUITE_AES256GCM, script_6_1rtt_secret)
- OP_CHECK_PKT_N(6c)
- OP_CHECK_NO_PKT()
-
- OP_END
+ RX_OP_SET_SCID_LEN(0)
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_INJECT_N(6)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET_INITIAL(rx_script_6_c2s_init_dcid)
+ RX_OP_CHECK_PKT_N(6a)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
+ QRL_SUITE_AES256GCM, rx_script_6_handshake_secret)
+ RX_OP_CHECK_PKT_N(6b)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
+ QRL_SUITE_AES256GCM, rx_script_6_1rtt_secret)
+ RX_OP_CHECK_PKT_N(6c)
+ RX_OP_CHECK_NO_PKT()
+
+ RX_OP_END
};
/*
* 7. Real World - S2C Multiple Packets
* - Initial, Handshake, 1-RTT (ChaCha20-Poly1305)
*/
-static const QUIC_CONN_ID script_7_c2s_init_dcid = {
+static const QUIC_CONN_ID rx_script_7_c2s_init_dcid = {
4, {0xfa, 0x5d, 0xd6, 0x80}
};
-static const unsigned char script_7_handshake_secret[32] = {
+static const unsigned char rx_script_7_handshake_secret[32] = {
0x85, 0x44, 0xa4, 0x02, 0x46, 0x5b, 0x2a, 0x92, 0x80, 0x71, 0xfd, 0x11,
0x89, 0x73, 0x84, 0xeb, 0x3e, 0x0d, 0x89, 0x4f, 0x71, 0xdc, 0x9c, 0xdd,
0x55, 0x77, 0x9e, 0x79, 0x7b, 0xeb, 0xfa, 0x86,
};
-static const unsigned char script_7_1rtt_secret[32] = {
+static const unsigned char rx_script_7_1rtt_secret[32] = {
0x4a, 0x77, 0xb6, 0x0e, 0xfd, 0x90, 0xca, 0xbf, 0xc0, 0x1a, 0x64, 0x9f,
0xc0, 0x03, 0xd3, 0x8d, 0xc5, 0x41, 0x04, 0x50, 0xb1, 0x5b, 0x74, 0xe7,
0xe3, 0x99, 0x0c, 0xdf, 0x74, 0x61, 0x35, 0xe6,
};
-static const unsigned char script_7_in[] = {
+static const unsigned char rx_script_7_in[] = {
/* First Packet: Initial */
0xc2, /* Long, Initial, PN Length=2 bytes */
0x00, 0x00, 0x00, 0x01, /* Version */
@@ -1121,7 +1117,7 @@ static const unsigned char script_7_in[] = {
0x7f, 0x33, 0x86, 0xbb,
};
-static const QUIC_PKT_HDR script_7a_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_7a_expect_hdr = {
QUIC_PKT_TYPE_INITIAL,
0, /* Spin Bit */
0, /* Key Phase */
@@ -1136,7 +1132,7 @@ static const QUIC_PKT_HDR script_7a_expect_hdr = {
441, NULL
};
-static const unsigned char script_7a_body[] = {
+static const unsigned char rx_script_7a_body[] = {
0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1176,7 +1172,7 @@ static const unsigned char script_7a_body[] = {
0x08, 0xa9, 0x0b, 0xfd, 0xbe, 0xf1, 0x57, 0x21, 0x34,
};
-static const QUIC_PKT_HDR script_7b_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_7b_expect_hdr = {
QUIC_PKT_TYPE_HANDSHAKE,
0, /* Spin Bit */
0, /* Key Phase */
@@ -1191,7 +1187,7 @@ static const QUIC_PKT_HDR script_7b_expect_hdr = {
657, NULL
};
-static const unsigned char script_7b_body[] = {
+static const unsigned char rx_script_7b_body[] = {
0x06, 0x00, 0x42, 0x8d, 0x08, 0x00, 0x00, 0x82, 0x00, 0x80, 0x00, 0x10,
0x00, 0x08, 0x00, 0x06, 0x05, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x00, 0x39,
0x00, 0x70, 0x46, 0x0a, 0x0d, 0xdc, 0x59, 0xf0, 0x4e, 0xb2, 0x2c, 0xac,
@@ -1249,7 +1245,7 @@ static const unsigned char script_7b_body[] = {
0x80, 0x93, 0x40, 0xda, 0x41, 0x33, 0x08, 0x10, 0x2c,
};
-static const QUIC_PKT_HDR script_7c_expect_hdr = {
+static const QUIC_PKT_HDR rx_script_7c_expect_hdr = {
QUIC_PKT_TYPE_1RTT,
0, /* Spin Bit */
0, /* Key Phase */
@@ -1264,7 +1260,7 @@ static const QUIC_PKT_HDR script_7c_expect_hdr = {
72, NULL
};
-static const unsigned char script_7c_body[] = {
+static const unsigned char rx_script_7c_body[] = {
0x18, 0x03, 0x00, 0x04, 0xf7, 0x75, 0x72, 0xa2, 0xfd, 0x17, 0xd4, 0x82,
0x8e, 0xe9, 0x5b, 0xce, 0xed, 0xec, 0x88, 0xb9, 0x73, 0xbf, 0x36, 0x9f,
0x18, 0x02, 0x00, 0x04, 0x5f, 0x43, 0x96, 0xe4, 0x15, 0xdc, 0x56, 0x6b,
@@ -1273,72 +1269,72 @@ static const unsigned char script_7c_body[] = {
0xaf, 0x0d, 0xd2, 0x38, 0xa4, 0xf1, 0x94, 0xff, 0x63, 0x24, 0xd3, 0x7a,
};
-static const struct test_op script_7[] = {
- OP_ADD_RX_DCID(empty_conn_id)
- OP_PROVIDE_SECRET_INITIAL(script_7_c2s_init_dcid)
- OP_INJECT_N(7)
- OP_CHECK_PKT_N(7a)
- OP_CHECK_NO_PKT() /* not got secret for next packet yet */
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
- QRL_SUITE_CHACHA20POLY1305, script_7_handshake_secret)
- OP_CHECK_PKT_N(7b)
- OP_CHECK_NO_PKT() /* not got secret for next packet yet */
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
- QRL_SUITE_CHACHA20POLY1305, script_7_1rtt_secret)
- OP_CHECK_PKT_N(7c)
- OP_CHECK_NO_PKT()
+static const struct rx_test_op rx_script_7[] = {
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_PROVIDE_SECRET_INITIAL(rx_script_7_c2s_init_dcid)
+ RX_OP_INJECT_N(7)
+ RX_OP_CHECK_PKT_N(7a)
+ RX_OP_CHECK_NO_PKT() /* not got secret for next packet yet */
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
+ QRL_SUITE_CHACHA20POLY1305, rx_script_7_handshake_secret)
+ RX_OP_CHECK_PKT_N(7b)
+ RX_OP_CHECK_NO_PKT() /* not got secret for next packet yet */
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
+ QRL_SUITE_CHACHA20POLY1305, rx_script_7_1rtt_secret)
+ RX_OP_CHECK_PKT_N(7c)
+ RX_OP_CHECK_NO_PKT()
/* Try injecting the packet again */
- OP_INJECT_N(7)
+ RX_OP_INJECT_N(7)
/*
* Initial packet is not output due to receiving a Handshake packet causing
* auto-discard of Initial keys
*/
- OP_CHECK_PKT_N(7b)
- OP_CHECK_PKT_N(7c)
- OP_CHECK_NO_PKT()
+ RX_OP_CHECK_PKT_N(7b)
+ RX_OP_CHECK_PKT_N(7c)
+ RX_OP_CHECK_NO_PKT()
/* Try again with discarded keys */
- OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
- OP_INJECT_N(7)
- OP_CHECK_PKT_N(7c)
- OP_CHECK_NO_PKT()
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_HANDSHAKE)
+ RX_OP_INJECT_N(7)
+ RX_OP_CHECK_PKT_N(7c)
+ RX_OP_CHECK_NO_PKT()
/* Try again */
- OP_INJECT_N(7)
- OP_CHECK_PKT_N(7c)
- OP_CHECK_NO_PKT()
+ RX_OP_INJECT_N(7)
+ RX_OP_CHECK_PKT_N(7c)
+ RX_OP_CHECK_NO_PKT()
/* Try again with discarded 1-RTT keys */
- OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
- OP_INJECT_N(7)
- OP_CHECK_NO_PKT()
+ RX_OP_DISCARD_EL(QUIC_ENC_LEVEL_1RTT)
+ RX_OP_INJECT_N(7)
+ RX_OP_CHECK_NO_PKT()
/* Recreate QRL, test reading packets received before key */
- OP_SET_SCID_LEN(0)
- OP_ADD_RX_DCID(empty_conn_id)
- OP_INJECT_N(7)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET_INITIAL(script_7_c2s_init_dcid)
- OP_CHECK_PKT_N(7a)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
- QRL_SUITE_CHACHA20POLY1305, script_7_handshake_secret)
- OP_CHECK_PKT_N(7b)
- OP_CHECK_NO_PKT()
- OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
- QRL_SUITE_CHACHA20POLY1305, script_7_1rtt_secret)
- OP_CHECK_PKT_N(7c)
- OP_CHECK_NO_PKT()
-
- OP_END
-};
-
-static const struct test_op *scripts[] = {
- script_1,
- script_2,
- script_3,
- script_4,
- script_5,
- script_6,
- script_7
+ RX_OP_SET_SCID_LEN(0)
+ RX_OP_ADD_RX_DCID(empty_conn_id)
+ RX_OP_INJECT_N(7)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET_INITIAL(rx_script_7_c2s_init_dcid)
+ RX_OP_CHECK_PKT_N(7a)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_HANDSHAKE,
+ QRL_SUITE_CHACHA20POLY1305, rx_script_7_handshake_secret)
+ RX_OP_CHECK_PKT_N(7b)
+ RX_OP_CHECK_NO_PKT()
+ RX_OP_PROVIDE_SECRET(QUIC_ENC_LEVEL_1RTT,
+ QRL_SUITE_CHACHA20POLY1305, rx_script_7_1rtt_secret)
+ RX_OP_CHECK_PKT_N(7c)
+ RX_OP_CHECK_NO_PKT()
+
+ RX_OP_END
+};
+
+static const struct rx_test_op *rx_scripts[] = {
+ rx_script_1,
+ rx_script_2,
+ rx_script_3,
+ rx_script_4,
+ rx_script_5,
+ rx_script_6,
+ rx_script_7
};
static int cmp_pkt_hdr(const QUIC_PKT_HDR *a, const QUIC_PKT_HDR *b,
@@ -1380,17 +1376,17 @@ static int cmp_pkt_hdr(const QUIC_PKT_HDR *a, const QUIC_PKT_HDR *b,
return ok;
}
-struct state {
+struct rx_state {
QUIC_DEMUX *demux;
- OSSL_QRL *qrl;
- OSSL_QRL_ARGS args;
+ OSSL_QRX *qrx;
+ OSSL_QRX_ARGS args;
};
-static void state_teardown(struct state *s)
+static void rx_state_teardown(struct rx_state *s)
{
- if (s->qrl != NULL) {
- ossl_qrl_free(s->qrl);
- s->qrl = NULL;
+ if (s->qrx != NULL) {
+ ossl_qrx_free(s->qrx);
+ s->qrx = NULL;
}
if (s->demux != NULL) {
@@ -1399,7 +1395,7 @@ static void state_teardown(struct state *s)
}
}
-static int state_ensure(struct state *s)
+static int rx_state_ensure(struct rx_state *s)
{
if (s->demux == NULL
&& !TEST_ptr(s->demux = ossl_quic_demux_new(NULL,
@@ -1407,75 +1403,76 @@ static int state_ensure(struct state *s)
1500)))
return 0;
- s->args.rx_demux = s->demux;
+ s->args.demux = s->demux;
- if (s->qrl == NULL
- && !TEST_ptr(s->qrl = ossl_qrl_new(&s->args)))
+ if (s->qrx == NULL
+ && !TEST_ptr(s->qrx = ossl_qrx_new(&s->args)))
return 0;
return 1;
}
-static int run_script(const struct test_op *script)
+static int rx_run_script(const struct rx_test_op *script)
{
int testresult = 0, pkt_outstanding = 0;
- struct state s = {0};
+ struct rx_state s = {0};
size_t i;
- OSSL_QRL_RX_PKT pkt = {0};
- const struct test_op *op = script;
+ OSSL_QRX_PKT pkt = {0};
+ const struct rx_test_op *op = script;
- for (; op->op != TEST_OP_END; ++op)
+ for (; op->op != RX_TEST_