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.
@julek-wolfssl julek-wolfssl requested a review from rizlik November 7, 2025 10:25
@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
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.
@julek-wolfssl julek-wolfssl requested a review from rizlik November 21, 2025 12:56
@julek-wolfssl julek-wolfssl requested a review from rizlik December 12, 2025 14:48
@rizlik rizlik assigned wolfSSL-Bot and unassigned rizlik Dec 18, 2025
@@ -0,0 +1,218 @@
/* client-dtls13-earlydata.c
Copy link
Contributor

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants