+/* RFC 9001 s. A.4 */
+static const QUIC_CONN_ID retry_orig_dcid = {
+ 8, { 0x83, 0x94, 0xc8, 0xf0, 0x3e, 0x51, 0x57, 0x08 }
+};
+
+static const unsigned char retry_encoded[] = {
+ 0xff, /* Long Header, Retry */
+ 0x00, 0x00, 0x00, 0x01, /* Version 1 */
+ 0x00, /* DCID */
+ 0x08, 0xf0, 0x67, 0xa5, 0x50, 0x2a, 0x42, 0x62, 0xb5, /* SCID */
+
+ /* Retry Token */
+ 0x74, 0x6f, 0x6b, 0x65, 0x6e,
+
+ /* Retry Integrity Tag */
+ 0x04, 0xa2, 0x65, 0xba, 0x2e, 0xff, 0x4d, 0x82, 0x90, 0x58, 0xfb, 0x3f, 0x0f,
+ 0x24, 0x96, 0xba
+};
+
+static int test_wire_retry_integrity_tag(void)
+{
+ int testresult = 0;
+ PACKET pkt = {0};
+ QUIC_PKT_HDR hdr = {0};
+ unsigned char got_tag[QUIC_RETRY_INTEGRITY_TAG_LEN] = {0};
+
+ if (!TEST_true(PACKET_buf_init(&pkt, retry_encoded, sizeof(retry_encoded))))
+ goto err;
+
+ if (!TEST_true(ossl_quic_wire_decode_pkt_hdr(&pkt, 0, 0, 0, &hdr, NULL)))
+ goto err;
+
+ if (!TEST_int_eq(hdr.type, QUIC_PKT_TYPE_RETRY))
+ goto err;
+
+ if (!TEST_true(ossl_quic_calculate_retry_integrity_tag(NULL, NULL, &hdr,
+ &retry_orig_dcid,
+ got_tag)))
+ goto err;
+
+ if (!TEST_mem_eq(got_tag, sizeof(got_tag),
+ retry_encoded + sizeof(retry_encoded)
+ - QUIC_RETRY_INTEGRITY_TAG_LEN,
+ QUIC_RETRY_INTEGRITY_TAG_LEN))
+ goto err;
+
+ if (!TEST_true(ossl_quic_validate_retry_integrity_tag(NULL, NULL, &hdr,
+ &retry_orig_dcid)))
+ goto err;
+
+ testresult = 1;
+err:
+ return testresult;
+}
+
+/* is_minimal=0 test */
+static const unsigned char non_minimal_1[] = {
+ 0x40, 0x00,
+};
+
+static const unsigned char non_minimal_2[] = {
+ 0x40, 0x3F,
+};
+
+static const unsigned char non_minimal_3[] = {
+ 0x80, 0x00, 0x00, 0x00,
+};
+
+static const unsigned char non_minimal_4[] = {
+ 0x80, 0x00, 0x3F, 0xFF,
+};
+
+static const unsigned char non_minimal_5[] = {
+ 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const unsigned char non_minimal_6[] = {
+ 0xC0, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF
+};
+
+static const unsigned char *const non_minimal[] = {
+ non_minimal_1,
+ non_minimal_2,
+ non_minimal_3,
+ non_minimal_4,
+ non_minimal_5,
+ non_minimal_6,
+};
+
+static const size_t non_minimal_len[] = {
+ OSSL_NELEM(non_minimal_1),
+ OSSL_NELEM(non_minimal_2),
+ OSSL_NELEM(non_minimal_3),
+ OSSL_NELEM(non_minimal_4),
+ OSSL_NELEM(non_minimal_5),
+ OSSL_NELEM(non_minimal_6),
+};
+
+static int test_wire_minimal(int idx)
+{
+ int testresult = 0;
+ int is_minimal;
+ uint64_t frame_type;
+ PACKET pkt;
+
+ if (!TEST_true(PACKET_buf_init(&pkt, non_minimal[idx],
+ non_minimal_len[idx])))
+ goto err;
+
+ if (!TEST_true(ossl_quic_wire_peek_frame_header(&pkt, &frame_type,
+ &is_minimal)))
+ goto err;
+
+ if (!TEST_false(is_minimal))
+ goto err;
+
+ testresult = 1;
+err:
+ return testresult;
+}
+