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

Commit 23b042f

Browse files
tatsuhiro-twbl
authored andcommitted
QUIC: Process multiple post-handshake messages in a single call (#14)
1 parent 21b3dbc commit 23b042f

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
@@ -341,20 +341,19 @@ int SSL_process_quic_post_handshake(SSL *ssl)
341341
}
342342

343343
/* if there is no data, return success as BoringSSL */
344-
if (ssl->quic_input_data_head == NULL)
345-
return 1;
346-
347-
/*
348-
* This is always safe (we are sure to be at a record boundary) because
349-
* SSL_read()/SSL_write() are never used for QUIC connections -- the
350-
* application data is handled at the QUIC layer instead.
351-
*/
352-
ossl_statem_set_in_init(ssl, 1);
353-
ret = ssl->handshake_func(ssl);
354-
ossl_statem_set_in_init(ssl, 0);
355-
356-
if (ret <= 0)
357-
return 0;
344+
while (ssl->quic_input_data_head != NULL) {
345+
/*
346+
* This is always safe (we are sure to be at a record boundary) because
347+
* SSL_read()/SSL_write() are never used for QUIC connections -- the
348+
* application data is handled at the QUIC layer instead.
349+
*/
350+
ossl_statem_set_in_init(ssl, 1);
351+
ret = ssl->handshake_func(ssl);
352+
ossl_statem_set_in_init(ssl, 0);
353+
354+
if (ret <= 0)
355+
return 0;
356+
}
358357
return 1;
359358
}
360359

test/sslapitest.c

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

73937393
/* Deal with two NewSessionTickets */
7394-
if (!TEST_true(SSL_process_quic_post_handshake(clientssl))
7395-
|| !TEST_true(SSL_process_quic_post_handshake(clientssl)))
7394+
if (!TEST_true(SSL_process_quic_post_handshake(clientssl)))
73967395
goto end;
73977396

73987397
/* Dummy handshake call should succeed */
@@ -7583,8 +7582,7 @@ static int quic_setupearly_data_test(SSL_CTX **cctx, SSL_CTX **sctx,
75837582
return 0;
75847583

75857584
/* Deal with two NewSessionTickets */
7586-
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl))
7587-
|| !TEST_true(SSL_process_quic_post_handshake(*clientssl)))
7585+
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl)))
75887586
return 0;
75897587

75907588
*sess = SSL_get1_session(*clientssl);

0 commit comments

Comments
 (0)