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

Commit 12425f3

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

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
@@ -8723,8 +8723,7 @@ static int test_quic_api_version(int clnt, int srvr)
87238723
goto end;
87248724

87258725
/* Deal with two NewSessionTickets */
8726-
if (!TEST_true(SSL_process_quic_post_handshake(clientssl))
8727-
|| !TEST_true(SSL_process_quic_post_handshake(clientssl)))
8726+
if (!TEST_true(SSL_process_quic_post_handshake(clientssl)))
87288727
goto end;
87298728

87308729
/* Dummy handshake call should succeed */
@@ -8916,8 +8915,7 @@ static int quic_setupearly_data_test(SSL_CTX **cctx, SSL_CTX **sctx,
89168915
return 0;
89178916

89188917
/* Deal with two NewSessionTickets */
8919-
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl))
8920-
|| !TEST_true(SSL_process_quic_post_handshake(*clientssl)))
8918+
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl)))
89218919
return 0;
89228920

89238921
*sess = SSL_get1_session(*clientssl);

0 commit comments

Comments
 (0)