@@ -13938,9 +13938,11 @@ int wolfSSL_write_early_data(WOLFSSL* ssl, const void* data,
1393813938
1393913939 \brief This function reads any early data from a client on resumption.
1394013940 Call this function instead of wolfSSL_accept() or wolfSSL_accept_TLSv13()
13941- to accept a client and read any early data in the handshake.
13942- If there is no early data than the handshake will be processed as normal.
13943- This function is only used with servers.
13941+ to accept a client and read any early data in the handshake. The function
13942+ should be invoked until wolfSSL_is_init_finished() returns true. Early data
13943+ may be sent by the client in multiple messsages. If there is no early data
13944+ then the handshake will be processed as normal. This function is only used
13945+ with servers.
1394413946
1394513947 \param [in,out] ssl a pointer to a WOLFSSL structure, created using wolfSSL_new().
1394613948 \param [out] data a buffer to hold the early data read from client.
@@ -13951,7 +13953,7 @@ int wolfSSL_write_early_data(WOLFSSL* ssl, const void* data,
1395113953 not using TLSv1.3.
1395213954 \return SIDE_ERROR if called with a client.
1395313955 \return WOLFSSL_FATAL_ERROR if accepting a connection fails.
13954- \return WOLFSSL_SUCCESS if successful .
13956+ \return Number of early data bytes read (may be zero) .
1395513957
1395613958 _Example_
1395713959 \code
@@ -13963,19 +13965,16 @@ int wolfSSL_write_early_data(WOLFSSL* ssl, const void* data,
1396313965 char buffer[80];
1396413966 ...
1396513967
13966- ret = wolfSSL_read_early_data(ssl, earlyData, sizeof(earlyData), &outSz);
13967- if (ret != SSL_SUCCESS) {
13968- err = wolfSSL_get_error(ssl, ret);
13969- printf(“error = %d, %s\n”, err, wolfSSL_ERR_error_string(err, buffer));
13970- }
13971- if (outSz > 0) {
13972- // early data available
13973- }
13974- ret = wolfSSL_accept_TLSv13(ssl);
13975- if (ret != SSL_SUCCESS) {
13976- err = wolfSSL_get_error(ssl, ret);
13977- printf(“error = %d, %s\n”, err, wolfSSL_ERR_error_string(err, buffer));
13978- }
13968+ do {
13969+ ret = wolfSSL_read_early_data(ssl, earlyData, sizeof(earlyData), &outSz);
13970+ if (ret < 0) {
13971+ err = wolfSSL_get_error(ssl, ret);
13972+ printf(“error = %d, %s\n”, err, wolfSSL_ERR_error_string(err, buffer));
13973+ }
13974+ if (outSz > 0) {
13975+ // early data available
13976+ }
13977+ } while (!wolfSSL_is_init_finished(ssl));
1397913978 \endcode
1398013979
1398113980 \sa wolfSSL_write_early_data
0 commit comments