forked from wolfSSL/wolfssl
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.
This commit is contained in:
@@ -14357,6 +14357,7 @@ int wolfSSL_read_early_data(WOLFSSL* ssl, void* data, int sz, int* outSz)
|
|||||||
if (!IsAtLeastTLSv1_3(ssl->version))
|
if (!IsAtLeastTLSv1_3(ssl->version))
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
|
*outSz = 0;
|
||||||
#ifndef NO_WOLFSSL_SERVER
|
#ifndef NO_WOLFSSL_SERVER
|
||||||
if (ssl->options.side == WOLFSSL_CLIENT_END)
|
if (ssl->options.side == WOLFSSL_CLIENT_END)
|
||||||
return SIDE_ERROR;
|
return SIDE_ERROR;
|
||||||
|
@@ -69268,6 +69268,7 @@ static int test_tls13_early_data(void)
|
|||||||
ExpectFalse(wolfSSL_is_init_finished(ssl_s));
|
ExpectFalse(wolfSSL_is_init_finished(ssl_s));
|
||||||
ExpectIntEQ(wolfSSL_read_early_data(ssl_s, msgBuf, sizeof(msgBuf),
|
ExpectIntEQ(wolfSSL_read_early_data(ssl_s, msgBuf, sizeof(msgBuf),
|
||||||
&read), 0);
|
&read), 0);
|
||||||
|
ExpectIntEQ(read, 0);
|
||||||
ExpectTrue(wolfSSL_is_init_finished(ssl_s));
|
ExpectTrue(wolfSSL_is_init_finished(ssl_s));
|
||||||
|
|
||||||
ExpectIntEQ(wolfSSL_connect(ssl_c), WOLFSSL_SUCCESS);
|
ExpectIntEQ(wolfSSL_connect(ssl_c), WOLFSSL_SUCCESS);
|
||||||
@@ -69278,7 +69279,7 @@ static int test_tls13_early_data(void)
|
|||||||
ExpectFalse(wolfSSL_is_init_finished(ssl_s));
|
ExpectFalse(wolfSSL_is_init_finished(ssl_s));
|
||||||
ExpectIntEQ(wolfSSL_read_early_data(ssl_s, msgBuf, sizeof(msgBuf),
|
ExpectIntEQ(wolfSSL_read_early_data(ssl_s, msgBuf, sizeof(msgBuf),
|
||||||
&read), 0);
|
&read), 0);
|
||||||
|
ExpectIntEQ(read, 0);
|
||||||
ExpectTrue(wolfSSL_is_init_finished(ssl_s));
|
ExpectTrue(wolfSSL_is_init_finished(ssl_s));
|
||||||
|
|
||||||
/* Read server 0.5-RTT data */
|
/* Read server 0.5-RTT data */
|
||||||
|
Reference in New Issue
Block a user