Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit f76a11c

Browse files
tatsuhiro-ttmshort
authored andcommitted
QUIC: Process multiple post-handshake messages in a single call (#16)
1 parent 61374fe commit f76a11c

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

ssl/ssl_quic.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -334,20 +334,19 @@ int SSL_process_quic_post_handshake(SSL *ssl)
334334
}
335335

336336
/* if there is no data, return success as BoringSSL */
337-
if (ssl->quic_input_data_head == NULL)
338-
return 1;
339-
340-
/*
341-
* This is always safe (we are sure to be at a record boundary) because
342-
* SSL_read()/SSL_write() are never used for QUIC connections -- the
343-
* application data is handled at the QUIC layer instead.
344-
*/
345-
ossl_statem_set_in_init(ssl, 1);
346-
ret = ssl->handshake_func(ssl);
347-
ossl_statem_set_in_init(ssl, 0);
348-
349-
if (ret <= 0)
350-
return 0;
337+
while (ssl->quic_input_data_head != NULL) {
338+
/*
339+
* This is always safe (we are sure to be at a record boundary) because
340+
* SSL_read()/SSL_write() are never used for QUIC connections -- the
341+
* application data is handled at the QUIC layer instead.
342+
*/
343+
ossl_statem_set_in_init(ssl, 1);
344+
ret = ssl->handshake_func(ssl);
345+
ossl_statem_set_in_init(ssl, 0);
346+
347+
if (ret <= 0)
348+
return 0;
349+
}
351350
return 1;
352351
}
353352

test/sslapitest.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9550,8 +9550,7 @@ static int test_quic_api_version(int clnt, int srvr)
95509550
goto end;
95519551

95529552
/* Deal with two NewSessionTickets */
9553-
if (!TEST_true(SSL_process_quic_post_handshake(clientssl))
9554-
|| !TEST_true(SSL_process_quic_post_handshake(clientssl)))
9553+
if (!TEST_true(SSL_process_quic_post_handshake(clientssl)))
95559554
goto end;
95569555

95579556
/* Dummy handshake call should succeed */
@@ -9743,8 +9742,7 @@ static int quic_setupearly_data_test(SSL_CTX **cctx, SSL_CTX **sctx,
97439742
return 0;
97449743

97459744
/* Deal with two NewSessionTickets */
9746-
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl))
9747-
|| !TEST_true(SSL_process_quic_post_handshake(*clientssl)))
9745+
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl)))
97489746
return 0;
97499747

97509748
*sess = SSL_get1_session(*clientssl);

0 commit comments

Comments
 (0)