Skip to content

Commit

Permalink
QUIC: Test crypto stream FC limits
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>
(Merged from #21547)
  • Loading branch information
hlandau authored and mattcaswell committed Aug 8, 2023
1 parent 27c2f62 commit ab6c634
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions test/quic_multistream_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@ static int script_42_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr,
return 0;

if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, OSSL_QUIC_FRAME_TYPE_CRYPTO))
|| !TEST_true(WPACKET_quic_write_vlint(&wpkt, (((uint64_t)1) << 62) - 1))
|| !TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1))
|| !TEST_true(WPACKET_quic_write_vlint(&wpkt, 1))
|| !TEST_true(WPACKET_put_bytes_u8(&wpkt, 0x42)))
goto err;
Expand Down Expand Up @@ -3077,14 +3077,35 @@ static const struct script_op script_42[] = {
OP_S_BIND_STREAM_ID (a, C_BIDI_ID(0))
OP_S_READ_EXPECT (a, "apple", 5)

OP_SET_INJECT_WORD (1, 0)
OP_SET_INJECT_WORD (1, (((uint64_t)1) << 62) - 1)
OP_S_WRITE (a, "orange", 6)

OP_C_EXPECT_CONN_CLOSE_INFO(QUIC_ERR_FRAME_ENCODING_ERROR,0,0)

OP_END
};

/* 43. Fault injection - CRYPTO frame exceeding FC */
static const struct script_op script_43[] = {
OP_S_SET_INJECT_PLAIN (script_42_inject_plain)
OP_C_SET_ALPN ("ossltest")
OP_C_CONNECT_WAIT ()
OP_C_SET_DEFAULT_STREAM_MODE(SSL_DEFAULT_STREAM_MODE_NONE)

OP_C_NEW_STREAM_BIDI (a, C_BIDI_ID(0))
OP_C_WRITE (a, "apple", 5)

OP_S_BIND_STREAM_ID (a, C_BIDI_ID(0))
OP_S_READ_EXPECT (a, "apple", 5)

OP_SET_INJECT_WORD (1, 0x100000 /* 1 MiB */)
OP_S_WRITE (a, "orange", 6)

OP_C_EXPECT_CONN_CLOSE_INFO(QUIC_ERR_CRYPTO_BUFFER_EXCEEDED,0,0)

OP_END
};

static const struct script_op *const scripts[] = {
script_1,
script_2,
Expand Down Expand Up @@ -3128,6 +3149,7 @@ static const struct script_op *const scripts[] = {
script_40,
script_41,
script_42,
script_43,
};

static int test_script(int idx)
Expand Down

0 comments on commit ab6c634

Please sign in to comment.