-
Notifications
You must be signed in to change notification settings - Fork 192
Add TLS 1.3 early data examples #530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
julek-wolfssl
wants to merge
6
commits into
wolfSSL:master
Choose a base branch
from
julek-wolfssl:tls13-earlydata
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
rizlik
requested changes
Nov 6, 2025
rizlik
requested changes
Nov 7, 2025
rizlik
requested changes
Nov 21, 2025
During the resumed (second) DTLS connection, read any server data that arrives during the handshake and print it. This adds a memset and wolfSSL_read into recvBuf and prints when len > 0.
rizlik
requested changes
Dec 9, 2025
rizlik
approved these changes
Dec 18, 2025
dgarske
requested changes
Dec 23, 2025
| @@ -0,0 +1,218 @@ | |||
| /* client-dtls13-earlydata.c | |||
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add these to the tls/README.md and dtls/README.md
Also if wolfSSL isn't built with --enable-earlydata then you get:
gcc -o client-tls13-earlydata client-tls13-earlydata.c -Wall -I/usr/local/include -Os -L/usr/local/lib -lm -lwolfssl
client-tls13-earlydata.c: In function ‘main’:
client-tls13-earlydata.c:131:33: warning: implicit declaration of function ‘wolfSSL_SSL_get0_session’; did you mean ‘wolfSSL_get1_session’? [-Wimplicit-function-declaration]
131 | if (!wolfSSL_SessionIsSetup(wolfSSL_SSL_get0_session(ssl))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
| wolfSSL_get1_session
client-tls13-earlydata.c:131:33: warning: passing argument 1 of ‘wolfSSL_SessionIsSetup’ makes pointer from integer without a cast [-Wint-conversion]
131 | if (!wolfSSL_SessionIsSetup(wolfSSL_SSL_get0_session(ssl))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from client-tls13-earlydata.c:35:
/usr/local/include/wolfssl/ssl.h:2903:57: note: expected ‘WOLFSSL_SESSION *’ but argument is of type ‘int’
2903 | WOLFSSL_API int wolfSSL_SessionIsSetup(WOLFSSL_SESSION* session);
| ~~~~~~~~~~~~~~~~~^~~~~~~
client-tls13-earlydata.c:134:37: warning: passing argument 1 of ‘wolfSSL_SessionIsSetup’ makes pointer from integer without a cast [-Wint-conversion]
134 | if (!wolfSSL_SessionIsSetup(wolfSSL_SSL_get0_session(ssl))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
/usr/local/include/wolfssl/ssl.h:2903:57: note: expected ‘WOLFSSL_SESSION *’ but argument is of type ‘int’
2903 | WOLFSSL_API int wolfSSL_SessionIsSetup(WOLFSSL_SESSION* session);
| ~~~~~~~~~~~~~~~~~^~~~~~~
client-tls13-earlydata.c:181:11: warning: implicit declaration of function ‘wolfSSL_write_early_data’; did you mean ‘wolfSSL_set_ex_data’? [-Wimplicit-function-declaration]
181 | ret = wolfSSL_write_early_data(ssl, EARLY_DATA_MSG, EARLY_DATA_MSG_LEN, &earlyDataSent);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| wolfSSL_set_ex_data
/usr/bin/ld: /tmp/cclNqs3t.o: in function `main':
client-tls13-earlydata.c:(.text.startup+0x183): undefined reference to `wolfSSL_SSL_get0_session'
/usr/bin/ld: client-tls13-earlydata.c:(.text.startup+0x1a8): undefined reference to `wolfSSL_SSL_get0_session'
/usr/bin/ld: client-tls13-earlydata.c:(.text.startup+0x2eb): undefined reference to `wolfSSL_write_early_data'
collect2: error: ld returned 1 exit status
make: *** [Makefile:110: client-tls13-earlydata] Error 1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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