Skip to content

Commit

Permalink
QUIC: Correct minimal frame encoding test
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #21135)
  • Loading branch information
hlandau authored and paulidale committed Jul 16, 2023
1 parent 7eebc35 commit 49a38de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/quic_multistream_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ static ossl_unused int test_dyn_frame_types(int idx)

for (i = 0; i < OSSL_NELEM(dyn_frame_types_script); ++i)
if (s[i].op == OPK_SET_INJECT_WORD) {
s[i].arg1 = forbidden_frame_types[idx].pkt_type;
s[i].arg1 = (size_t)forbidden_frame_types[idx].pkt_type;
s[i].arg2 = forbidden_frame_types[idx].frame_type;
} else if (s[i].op == OPK_C_EXPECT_CONN_CLOSE_INFO) {
s[i].arg2 = forbidden_frame_types[idx].expected_err;
Expand Down
33 changes: 20 additions & 13 deletions test/quic_wire_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,32 +533,36 @@ static int encode_case_12_dec(PACKET *pkt, ossl_ssize_t fail)
{
uint64_t max_streams_1 = 0, max_streams_2 = 0,
frame_type_1 = 0, frame_type_2 = 0;
int is_minimal;
int is_minimal = 1, success_if;

success_if = (fail < 0 || fail >= 1);
if (!TEST_int_eq(ossl_quic_wire_peek_frame_header(pkt, &frame_type_1,
&is_minimal),
fail < 0 || fail >= 1))
success_if))
return 0;

if (!TEST_true(is_minimal))
if (!TEST_true(!success_if || is_minimal))
return 0;

success_if = (fail < 0 || fail >= 3);
if (!TEST_int_eq(ossl_quic_wire_decode_frame_max_streams(pkt,
&max_streams_1),
fail < 0 || fail >= 3))
success_if))
return 0;

success_if = (fail < 0 || fail >= 4);
if (!TEST_int_eq(ossl_quic_wire_peek_frame_header(pkt, &frame_type_2,
&is_minimal),
fail < 0 || fail >= 4))
success_if))
return 0;

if (!TEST_true(is_minimal))
if (!TEST_true(!success_if || is_minimal))
return 0;

success_if = (fail < 0);
if (!TEST_int_eq(ossl_quic_wire_decode_frame_max_streams(pkt,
&max_streams_2),
fail < 0))
success_if))
return 0;

if ((fail < 0 || fail >= 3)
Expand Down Expand Up @@ -672,27 +676,30 @@ static int encode_case_15_dec(PACKET *pkt, ossl_ssize_t fail)
{
uint64_t max_streams_1 = 0, max_streams_2 = 0,
frame_type_1 = 0, frame_type_2 = 0;
int is_minimal;
int is_minimal = 1, success_if;

success_if = (fail < 0 || fail >= 1);
if (!TEST_int_eq(ossl_quic_wire_peek_frame_header(pkt, &frame_type_1,
&is_minimal),
fail < 0 || fail >= 1))
success_if))
return 0;

if (!TEST_true(is_minimal))
if (!TEST_true(!success_if || is_minimal))
return 0;

success_if = (fail < 0 || fail >= 3);
if (!TEST_int_eq(ossl_quic_wire_decode_frame_streams_blocked(pkt,
&max_streams_1),
fail < 0 || fail >= 3))
success_if))
return 0;

success_if = (fail < 0 || fail >= 4);
if (!TEST_int_eq(ossl_quic_wire_peek_frame_header(pkt, &frame_type_2,
&is_minimal),
fail < 0 || fail >= 4))
success_if))
return 0;

if (!TEST_true(is_minimal))
if (!TEST_true(!success_if || is_minimal))
return 0;

if (!TEST_int_eq(ossl_quic_wire_decode_frame_streams_blocked(pkt,
Expand Down

0 comments on commit 49a38de

Please sign in to comment.