-
Notifications
You must be signed in to change notification settings - Fork 186
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
base: master
Are you sure you want to change the base?
Conversation
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.
tls/client-tls13-earlydata.c
Outdated
| /* 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); |
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.
why -1 ?
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.
For null termination
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.
if we receive data here then data is never use, probably it's better to to check and print
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.
This is outdated. Its using wolfSSL_peek now.
| if (wolfSSL_get_error(ssl, -1) != APP_DATA_READY) { | ||
| fprintf(stderr, "wolfSSL_connect (2nd) failed\n"); | ||
| goto cleanup; | ||
| } |
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.
did you consider reading 1-RTT data from the server here?
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.
Keeping the example minimal.
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.
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.
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.
Added.
tls/client-tls13-earlydata.c
Outdated
| /* 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); |
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.
if we receive data here then data is never use, probably it's better to to check and print
| if (wolfSSL_get_error(ssl, -1) != APP_DATA_READY) { | ||
| fprintf(stderr, "wolfSSL_connect (2nd) failed\n"); | ||
| goto cleanup; | ||
| } |
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.
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.
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