Skip to content

Commit 0bc8864

Browse files
tatsuhiro-tLycs-D
authored andcommitted
QUIC: Process multiple post-handshake messages in a single call (quictls#16)
1 parent 4186045 commit 0bc8864

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
@@ -10413,8 +10413,7 @@ static int test_quic_api_version(int clnt, int srvr)
1041310413
goto end;
1041410414

1041510415
/* Deal with two NewSessionTickets */
10416-
if (!TEST_true(SSL_process_quic_post_handshake(clientssl))
10417-
|| !TEST_true(SSL_process_quic_post_handshake(clientssl)))
10416+
if (!TEST_true(SSL_process_quic_post_handshake(clientssl)))
1041810417
goto end;
1041910418

1042010419
/* Dummy handshake call should succeed */
@@ -10606,8 +10605,7 @@ static int quic_setupearly_data_test(SSL_CTX **cctx, SSL_CTX **sctx,
1060610605
return 0;
1060710606

1060810607
/* Deal with two NewSessionTickets */
10609-
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl))
10610-
|| !TEST_true(SSL_process_quic_post_handshake(*clientssl)))
10608+
if (!TEST_true(SSL_process_quic_post_handshake(*clientssl)))
1061110609
return 0;
1061210610

1061310611
*sess = SSL_get1_session(*clientssl);

0 commit comments

Comments
 (0)