Skip to content
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

feat: send psk_ke_modes ext in first flight #4177

Merged
merged 9 commits into from
Sep 21, 2023
Merged

Conversation

jmayclin
Copy link
Contributor

    rustls expects the psk_key_exchange_modes extension to be present in the
    first flight of messages if the client supports session resumption,
    otherwise it will not return a session ticket. This commit alters
    s2n-tls client behavior to match rustls expectations.

Resolved issues:

#4124

Description of changes:

More context is in the linked issue, but essentially rustls expects the psk_key_exchange_modes extension to be sent in the first flight of messages if the client wants a session ticket. s2n-tls does not sent this extension in the first flight of messages, so rustls servers won't send a session ticket, so s2n-tls clients can't use session resumption with rustls servers.

This PR changes s2n-tls behavior to send the psk_key_exchanges_modes extension whenever the clients supports either stateful or stateless session resumption. We still include the final check for PSKs to support out of bands PSKs.

This change should be a strict increase in compatibility with other implementations.

Testing:

We have interop testing for session resumption in the rust bindings. Additionally all of the current unit tests pass.

I'm a little concerned that there isn't any direct testing of stateful session resumption. Testing that is going to be a little tricky, and the easiest way to do so would probably be to just add it to our benchmarking harness implementation? I'm interested in reviewers thoughts about whether this is a good investment of our time.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

rustls expects the psk_key_exchange_modes extension to be present in the
first flight of messages if the client supports session resumption,
otherwise it will not return a session ticket. This commit alters
s2n-tls client behavior to match rustls expectations.
@github-actions github-actions bot added the s2n-core team label Aug 30, 2023
Copy link
Contributor

@lrstewart lrstewart left a comment

Choose a reason for hiding this comment

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

Can you add a unit / self-talk test? We don't want to rely on benchmarking tests to enforce correctness.

tls/extensions/s2n_psk_key_exchange_modes.c Outdated Show resolved Hide resolved
tls/extensions/s2n_psk_key_exchange_modes.c Outdated Show resolved Hide resolved
* add compliance comment to relevant RFC section
* add unit test for "should send" functionality
@jmayclin
Copy link
Contributor Author

#4210 adds the CI workflow to assert that the interop tests contained in the rust bench crate are passing.

@jmayclin jmayclin requested a review from lrstewart September 20, 2023 22:12
* move test above functional test
* change test name to fit voted majority
* use helper function to construct PSK
* add semi-colons to unit tests scopes
@jmayclin jmayclin requested a review from lrstewart September 20, 2023 23:19
* sentence case the test names
* remove the newline in the duvet comment
@jmayclin jmayclin enabled auto-merge (squash) September 20, 2023 23:45
* assert on relevant qualities
@jmayclin jmayclin requested a review from lrstewart September 21, 2023 00:09
Comment on lines +230 to +231
EXPECT_SUCCESS(s2n_config_set_session_tickets_onoff(no_resumption_config, false));

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I like this as a solution :)

@jmayclin jmayclin merged commit 9014236 into aws:main Sep 21, 2023
@jmayclin jmayclin deleted the rustls-interop branch December 22, 2023 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants