Skip to content

Commit e923d4c

Browse files
committed
tls13: read_early_data: set outSz to 0 if no early data
If not data is read, set outSz to 0. This way the caller can detect if no early data was read.
1 parent 83ae724 commit e923d4c

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/tls13.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14357,6 +14357,7 @@ int wolfSSL_read_early_data(WOLFSSL* ssl, void* data, int sz, int* outSz)
1435714357
if (!IsAtLeastTLSv1_3(ssl->version))
1435814358
return BAD_FUNC_ARG;
1435914359

14360+
*outSz = 0;
1436014361
#ifndef NO_WOLFSSL_SERVER
1436114362
if (ssl->options.side == WOLFSSL_CLIENT_END)
1436214363
return SIDE_ERROR;

tests/api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69268,6 +69268,7 @@ static int test_tls13_early_data(void)
6926869268
ExpectFalse(wolfSSL_is_init_finished(ssl_s));
6926969269
ExpectIntEQ(wolfSSL_read_early_data(ssl_s, msgBuf, sizeof(msgBuf),
6927069270
&read), 0);
69271+
ExpectIntEQ(read, 0);
6927169272
ExpectTrue(wolfSSL_is_init_finished(ssl_s));
6927269273

6927369274
ExpectIntEQ(wolfSSL_connect(ssl_c), WOLFSSL_SUCCESS);
@@ -69278,7 +69279,7 @@ static int test_tls13_early_data(void)
6927869279
ExpectFalse(wolfSSL_is_init_finished(ssl_s));
6927969280
ExpectIntEQ(wolfSSL_read_early_data(ssl_s, msgBuf, sizeof(msgBuf),
6928069281
&read), 0);
69281-
69282+
ExpectIntEQ(read, 0);
6928269283
ExpectTrue(wolfSSL_is_init_finished(ssl_s));
6928369284

6928469285
/* Read server 0.5-RTT data */

0 commit comments

Comments
 (0)