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

Commit 59b3cf3

Browse files
tatsuhiro-ttmshort
authored andcommitted
QUIC: Process multiple post-handshake messages in a single call (#14)
1 parent cf0745c commit 59b3cf3

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
@@ -7240,8 +7240,7 @@ static int test_quic_api_version(int clnt, int srvr)
72407240
goto end;
72417241

72427242
/* Deal with two NewSessionTickets */
7243-
if (!TEST_true(SSL_process_quic_post_handshake(clientssl))
7244-
|| !TEST_true(SSL_process_quic_post_handshake(clientssl)))
7243+
if (!TEST_true(SSL_process_quic_post_handshake(clientssl)))
72457244
goto end;
72467245

72477246
/* Dummy handshake call should succeed */
@@ -7432,8 +7431,7 @@ static int quic_setupearly_data_test(SSL_CTX **cctx, SSL_CTX **sctx,
74327431
return 0;
74337432

74347433
/* Deal with two NewSessionTickets */
7435-
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl))
7436-
|| !TEST_true(SSL_process_quic_post_handshake(*clientssl)))
7434+
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl)))
74377435
return 0;
74387436

74397437
*sess = SSL_get1_session(*clientssl);

0 commit comments

Comments
 (0)