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

Commit 7250294

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

2 files changed

Lines changed: 15 additions & 18 deletions

File tree

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
@@ -10518,8 +10518,7 @@ static int test_quic_api_version(int clnt, int srvr)
1051810518
goto end;
1051910519

1052010520
/* Deal with two NewSessionTickets */
10521-
if (!TEST_true(SSL_process_quic_post_handshake(clientssl))
10522-
|| !TEST_true(SSL_process_quic_post_handshake(clientssl)))
10521+
if (!TEST_true(SSL_process_quic_post_handshake(clientssl)))
1052310522
goto end;
1052410523

1052510524
/* Dummy handshake call should succeed */
@@ -10706,8 +10705,7 @@ static int quic_setupearly_data_test(SSL_CTX **cctx, SSL_CTX **sctx,
1070610705
return 0;
1070710706

1070810707
/* Deal with two NewSessionTickets */
10709-
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl))
10710-
|| !TEST_true(SSL_process_quic_post_handshake(*clientssl)))
10708+
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl)))
1071110709
return 0;
1071210710

1071310711
*sess = SSL_get1_session(*clientssl);

0 commit comments

Comments
 (0)