Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUIC: Process multiple post-handshake messages in a single call #14

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions ssl/ssl_quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,19 @@ int SSL_process_quic_post_handshake(SSL *ssl)
}

/* if there is no data, return success as BoringSSL */
if (ssl->quic_input_data_head == NULL)
return 1;

/*
* This is always safe (we are sure to be at a record boundary) because
* SSL_read()/SSL_write() are never used for QUIC connections -- the
* application data is handled at the QUIC layer instead.
*/
ossl_statem_set_in_init(ssl, 1);
ret = ssl->handshake_func(ssl);
ossl_statem_set_in_init(ssl, 0);

if (ret <= 0)
return 0;
while (ssl->quic_input_data_head != NULL) {
/*
* This is always safe (we are sure to be at a record boundary) because
* SSL_read()/SSL_write() are never used for QUIC connections -- the
* application data is handled at the QUIC layer instead.
*/
ossl_statem_set_in_init(ssl, 1);
ret = ssl->handshake_func(ssl);
ossl_statem_set_in_init(ssl, 0);

if (ret <= 0)
return 0;
}
return 1;
}

Expand Down
6 changes: 2 additions & 4 deletions test/sslapitest.c
Original file line number Diff line number Diff line change
Expand Up @@ -6817,8 +6817,7 @@ static int test_quic_api_version(int clnt, int srvr)
goto end;

/* Deal with two NewSessionTickets */
if (!TEST_true(SSL_process_quic_post_handshake(clientssl))
|| !TEST_true(SSL_process_quic_post_handshake(clientssl)))
if (!TEST_true(SSL_process_quic_post_handshake(clientssl)))
goto end;

/* Dummy handshake call should succeed */
Expand Down Expand Up @@ -7009,8 +7008,7 @@ static int quic_setupearly_data_test(SSL_CTX **cctx, SSL_CTX **sctx,
return 0;

/* Deal with two NewSessionTickets */
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl))
|| !TEST_true(SSL_process_quic_post_handshake(*clientssl)))
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl)))
return 0;

*sess = SSL_get1_session(*clientssl);
Expand Down