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

fix: Initial config influences client hello parsing #4676

Merged
merged 13 commits into from
Aug 15, 2024
Merged

Conversation

maddeleine
Copy link
Contributor

@maddeleine maddeleine commented Jul 30, 2024

Resolved issues:

Partially tackles #4585

Description of changes:

This PR strengthens our assertion that servers don't use the config before the client hello callback is invoked (allowing the user to swap out the config based on information in the client hello.)
I added a test that we aren't dereferencing anything on the config before the client hello cb is invoked. The way I do this is by setting the connection's config pointer to null. Any attempt to dereference pointers on that config will error/segfault.

I fixed a couple places where we do reference the config before the callback is invoked. One of those is setting a default ecc curve if the client doesn't send any ecc preferences in the extensions. I moved that chunk of code from the "parsing" function to the "processing" function.

Call-outs:

I'm not fixing everything in #4585. Our sslv2 client hello processing code uses the config before the client hello callback is invoked. I don't want to refactor our sslv2 client hello code right now, as we don't yet have an integration test for that behavior. Once this is done, we should have more assurance that a refactor is safe.

Testing:

Adds tests.

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

@github-actions github-actions bot added the s2n-core team label Jul 30, 2024
@maddeleine maddeleine changed the title Initial config fix: Initial config influences client hello parsing Jul 30, 2024
tests/unit/s2n_client_hello_recv_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_config_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_config_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_config_test.c Outdated Show resolved Hide resolved
tls/s2n_client_hello.c Outdated Show resolved Hide resolved
tls/s2n_client_hello.c Outdated Show resolved Hide resolved
tests/unit/s2n_config_test.c Show resolved Hide resolved
tls/s2n_handshake_io.c Outdated Show resolved Hide resolved
error/s2n_errno.h Outdated Show resolved Hide resolved
tls/s2n_handshake_io.c Show resolved Hide resolved
tls/s2n_handshake_io.c Outdated Show resolved Hide resolved
error/s2n_errno.c Outdated Show resolved Hide resolved
tests/unit/s2n_config_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_config_test.c Show resolved Hide resolved
@maddeleine maddeleine enabled auto-merge (squash) August 14, 2024 21:49
@maddeleine maddeleine merged commit 9cca574 into main Aug 15, 2024
38 checks passed
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