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

Clean up receiving peer sig alg #4259

Merged
merged 4 commits into from
Oct 27, 2023
Merged

Clean up receiving peer sig alg #4259

merged 4 commits into from
Oct 27, 2023

Conversation

lrstewart
Copy link
Contributor

@lrstewart lrstewart commented Oct 24, 2023

Resolved issues:

related to #4257

Description of changes:

The next small cleanup: refactor how we receive the signature algorithm the peer selects.

The main change here is that we move the pre-TLS1.2 default logic to s2n_signature_algorithms.c. Before it was duplicated across all the files that called into s2n_signature_algorithms.c. I also rename some functions and switch to s2n_result.

Call-outs:

At the moment, s2n_signature_algorithms_get_legacy_default partially duplicates s2n_choose_default_sig_scheme. s2n_choose_default_sig_scheme will go away in the next PR: it mixes together the pre-TLS1.2 default logic, the TLS1.2 logic for defaults if no signature_algorithms are given, and our custom TLS1.2 and TLS1.3 fallback logic. This mix is confusing and prone to errors. So for now, the new code uses the simpler and more narrowly scoped s2n_signature_algorithms_get_legacy_default, which only deals with pre-TLS1.2 defaults. We only need to deal with pre-TLS1.2 defaults because the peer only doesn't explicitly specify the chosen signature algorithm for <TLS1.2.

I'm actually pretty proud of what I replace s2n_choose_default_sig_scheme with in the next PR, so I promise no duplication long-term.

Testing:

Existing tests pass. Added some new unit 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 Oct 24, 2023
@lrstewart lrstewart marked this pull request as ready for review October 25, 2023 04:05
tls/s2n_signature_algorithms.c Show resolved Hide resolved
tests/unit/s2n_signature_algorithms_test.c Outdated Show resolved Hide resolved
tls/s2n_server_hello.c Show resolved Hide resolved
tls/s2n_client_cert_verify.c Show resolved Hide resolved
tests/unit/s2n_signature_algorithms_test.c Outdated Show resolved Hide resolved
tls/s2n_server_hello.c Show resolved Hide resolved
tests/unit/s2n_signature_algorithms_test.c Outdated Show resolved Hide resolved
@lrstewart lrstewart enabled auto-merge (squash) October 27, 2023 18:11
@lrstewart lrstewart merged commit 5c860d7 into aws:main Oct 27, 2023
27 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