Skip to content

Commit 509491f

Browse files
committed
dtls13: wolfSSL_is_init_finished true after last server ACK
Do not consider the handshake finished until the last server ACK. This way the application knows where to switch from wolfSSL_negotiate/wolfSSL_connect to wolfSSL_read/wolfSSL_write.
1 parent 05ff129 commit 509491f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/ssl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12811,6 +12811,13 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
1281112811
if (ssl == NULL)
1281212812
return 0;
1281312813

12814+
#if defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_NO_CLIENT)
12815+
if (ssl->options.side == WOLFSSL_CLIENT_END && ssl->options.dtls
12816+
&& IsAtLeastTLSv1_3(ssl->version)) {
12817+
return ssl->options.serverState == SERVER_FINISHED_ACKED;
12818+
}
12819+
#endif /* WOLFSSL_DTLS13 && !WOLFSSL_NO_CLIENT */
12820+
1281412821
/* Can't use ssl->options.connectState and ssl->options.acceptState
1281512822
* because they differ in meaning for TLS <=1.2 and 1.3 */
1281612823
if (ssl->options.handShakeState == HANDSHAKE_DONE)

tests/api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66072,8 +66072,7 @@ static int test_dtls13_missing_finished_server(void)
6607266072
ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
6607366073
/* Let's clear the output */
6607466074
test_memio_clear_buffer(&test_ctx, 0);
66075-
/* We should signal that the handshake is done */
66076-
ExpectTrue(wolfSSL_is_init_finished(ssl_c));
66075+
ExpectFalse(wolfSSL_is_init_finished(ssl_c));
6607766076
/* Let's send some app data */
6607866077
ExpectIntEQ(wolfSSL_write(ssl_c, test_str, sizeof(test_str)),
6607966078
sizeof(test_str));

0 commit comments

Comments
 (0)