Skip to content

Commit 66d3f69

Browse files
committed
Update readme
1 parent d52e8fa commit 66d3f69

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

dtls/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
- 5.2.4.1. Variables
8080
- 5.2.4.2. Adding a Loop
8181
- 5.2.5. Final Note
82+
- Chapter 6: DTLS 1.3 Early Data (0-RTT) with Session Resumption
8283
- References
8384
## CHAPTER 1: A Simple UDP Server & Client
8485
### Section 1: By Kaleb Himes
@@ -1679,6 +1680,50 @@ The code above was taken directly from the DTLS server nonblocking file.
16791680

16801681
Be sure to keep in mind that the `AwaitDatagram` code is essentially one large loop that will attempt to listen for a client (in a nonblocking fashion) at every iteration, and will close the loop upon a signal passed by the user.
16811682

1683+
## Chapter 6: DTLS 1.3 Early Data (0-RTT) with Session Resumption
1684+
1685+
This pair of examples demonstrates DTLS 1.3 early data (0-RTT) using wolfSSL.
1686+
The client performs an initial connection to obtain a session ticket, then
1687+
reconnects and sends early data during the resumed handshake. The server reads
1688+
early data and can send application data immediately (so-called 0.5-RTT), then
1689+
continues with the normal handshake/application data flow.
1690+
1691+
It is recommended to build wolfSSL with `WOLFSSL_DTLS13_NO_HRR_ON_RESUME` so the
1692+
server does not send a HelloRetryRequest (HRR) when resuming sessions. (The
1693+
server example also enables this behavior per-connection with
1694+
`wolfSSL_dtls13_no_hrr_on_resume()`.)
1695+
1696+
Files:
1697+
- `server-dtls13-earlydata.c`: DTLS 1.3 server that receives early data using
1698+
`wolfSSL_read_early_data()`. It sets a maximum early data size using
1699+
`wolfSSL_CTX_set_max_early_data()` and may send 0.5-RTT application data.
1700+
- `client-dtls13-earlydata.c`: DTLS 1.3 client that first connects to obtain a
1701+
session ticket, then reconnects and sends early data using
1702+
`wolfSSL_write_early_data()` before finishing the handshake. After the
1703+
handshake, it also sends a normal (post-handshake) application data message.
1704+
1705+
Build requirements:
1706+
- wolfSSL must be built with DTLS 1.3 and early data support enabled.
1707+
Enable early data support by building wolfSSL with
1708+
`--enable-earlydata --enable-session-ticket`.
1709+
1710+
Build and run (in `wolfssl-examples/dtls`, in separate terminals):
1711+
1712+
```sh
1713+
make clean && make
1714+
./server-dtls13-earlydata
1715+
./client-dtls13-earlydata 127.0.0.1
1716+
```
1717+
1718+
Expected behavior:
1719+
- On the first client run/connection, a full handshake completes and a session
1720+
ticket is obtained.
1721+
- On the second connection, the client sends early data immediately and then
1722+
completes the DTLS handshake.
1723+
- The server logs any received early data, may send a reply during early-data
1724+
processing, then finishes the handshake and sends a normal reply after
1725+
handshake completion.
1726+
16821727
#### 5.2.5 Final note
16831728
And that's it! The server has been made into a nonblocking server, and the client has been made into a nonblocking client.
16841729

tls/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,46 @@ Execute them like so:
14421442
./client-tls13-certauth-clienthello 127.0.0.1
14431443
```
14441444

1445+
## TLS 1.3 Early Data (0-RTT) with Session Resumption
1446+
1447+
This pair of examples demonstrates TLS 1.3 early data (0-RTT) using wolfSSL.
1448+
The client performs an initial connection to obtain a session ticket, then
1449+
reconnects and sends early data during the resumed handshake. The server reads
1450+
early data and can send application data immediately (so-called 0.5-RTT), then
1451+
continues with the normal handshake/application data flow.
1452+
1453+
Files:
1454+
- `server-tls13-earlydata.c`: TLS 1.3 server that accepts connections and reads
1455+
early data using `wolfSSL_read_early_data()`. It also sets a maximum early
1456+
data size with `wolfSSL_CTX_set_max_early_data()`.
1457+
- `client-tls13-earlydata.c`: TLS 1.3 client that first connects to obtain a
1458+
session ticket, then reconnects and sends early data with
1459+
`wolfSSL_write_early_data()` before finishing the handshake.
1460+
1461+
Build requirements:
1462+
- wolfSSL must be built with TLS 1.3 and early data support enabled.
1463+
Enable early data support by building wolfSSL with
1464+
`--enable-earlydata --enable-session-ticket`.
1465+
- If early data support is not enabled, these examples will print a message and
1466+
exit.
1467+
1468+
Build and run (in `wolfssl-examples/tls`, in separate terminals):
1469+
1470+
```sh
1471+
make clean && make
1472+
./server-tls13-earlydata
1473+
./client-tls13-earlydata 127.0.0.1
1474+
```
1475+
1476+
Expected behavior:
1477+
- On the first client connection, a full handshake completes and a session ticket
1478+
is obtained.
1479+
- On the second client connection, the client sends early data immediately and
1480+
then completes the TLS handshake.
1481+
- The server logs the received early data and replies both during early-data
1482+
processing and again after the handshake is complete.
1483+
1484+
14451485
## Support
14461486

14471487
Please contact wolfSSL at support@wolfssl.com with any questions, bug fixes,

0 commit comments

Comments
 (0)