Skip to content

Conversation

@julek-wolfssl
Copy link
Member

@julek-wolfssl julek-wolfssl commented Oct 29, 2025

Introduces client and server examples that demonstrate the use of
TLS 1.3 early data (0-RTT) with session resumption.

The client example performs an initial handshake to obtain a session
ticket, then reconnects and sends early data. The server example
receives early data and sends back a reply.

DTLS 1.3 examples depend on wolfSSL/wolfssl#9367

Introduces client and server examples that demonstrate the use of
TLS 1.3 early data (0-RTT) with session resumption.

The client example performs an initial handshake to obtain a session
ticket, then reconnects and sends early data. The server example
receives early data and sends back a reply.
/* Check if ticket was received */
if (!wolfSSL_SessionIsSetup(wolfSSL_SSL_get0_session(ssl))) {
/* Attempt to read a session ticket from server */
(void)wolfSSL_read(ssl, recvBuf, sizeof(recvBuf)-1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why -1 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For null termination

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we receive data here then data is never use, probably it's better to to check and print

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outdated. Its using wolfSSL_peek now.

Comment on lines +182 to +185
if (wolfSSL_get_error(ssl, -1) != APP_DATA_READY) {
fprintf(stderr, "wolfSSL_connect (2nd) failed\n");
goto cleanup;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you consider reading 1-RTT data from the server here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping the example minimal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this is very important to showcase minimum latency. Also the server side already writes the 1-rtt data that we never read.
I think adding 1-RTT data from the server completes the example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@julek-wolfssl julek-wolfssl requested a review from rizlik November 7, 2025 10:25
/* Check if ticket was received */
if (!wolfSSL_SessionIsSetup(wolfSSL_SSL_get0_session(ssl))) {
/* Attempt to read a session ticket from server */
(void)wolfSSL_read(ssl, recvBuf, sizeof(recvBuf)-1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we receive data here then data is never use, probably it's better to to check and print

Comment on lines +182 to +185
if (wolfSSL_get_error(ssl, -1) != APP_DATA_READY) {
fprintf(stderr, "wolfSSL_connect (2nd) failed\n");
goto cleanup;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this is very important to showcase minimum latency. Also the server side already writes the 1-rtt data that we never read.
I think adding 1-RTT data from the server completes the example.

@rizlik rizlik assigned julek-wolfssl and unassigned rizlik Nov 7, 2025
@julek-wolfssl julek-wolfssl requested a review from rizlik November 7, 2025 12:58
@julek-wolfssl julek-wolfssl assigned rizlik and unassigned julek-wolfssl Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants