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

tests: use sig schemes as source of truth for valid hash+sig algs #5129

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

lrstewart
Copy link
Contributor

@lrstewart lrstewart commented Feb 19, 2025

Release Summary:

Resolved issues:

related to #5105

Description of changes:

Fixing an issue that keeps causing problems in my hash and signing PRs.

It's hard to define "all valid hash algs" in the context of signing. Different libcryptos decide to forbid different combinations, like no MD5 at all or no MD5+SHA1 for ECDSA. We have more than one test trying to define those rules, and the reasoning behind those definitions aren't particularly clear.

Rather than try to separately define all those banned combinations, we should just treat "all valid hash algs" as all the hash algs for which there exists a signature scheme. Signature schemes are the real source of truth for all allowed hash alg + sig scheme combinations. They're the only combinations we'll ever need to care about.

Call-outs:

The one "miss" here is that we no longer check that signing methods flag "invalid" algs as invalid. I'm not particularly concerned about that. Without a signature scheme to trigger the signing process, those methods will never get any "invalid" combination in the first place. Also, the libcryptos will happily reject what they define as invalid combos 🙃

Testing:

This is a testing change

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 Feb 19, 2025
@lrstewart lrstewart force-pushed the openssl3fips_evp_validalg branch 6 times, most recently from 7ee526a to ddf0c81 Compare February 20, 2025 02:20
@lrstewart lrstewart force-pushed the openssl3fips_evp_validalg branch from ddf0c81 to 50f9458 Compare February 20, 2025 02:26
#include "tls/s2n_signature_scheme.c"
#include "tls/s2n_signature_scheme.h"
Copy link
Contributor Author

@lrstewart lrstewart Feb 20, 2025

Choose a reason for hiding this comment

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

This typo made me think I was going insane.

My pointer comparisons in this test weren't working in the OSX github action, and ONLY in the OSX github action. I couldn't repro locally. Like sig_scheme == all_prefs->signature_schemes[all_i] was false for the same signature scheme. I added print statements to print the pointer addresses. They were different?!

It was because of this typo. s2n_signature_preferences_all was the duplicate copy from this include, using its own local copies of the signature schemes. The signature schemes from security_policy_selection were the originals used by the rest of the library -_-

The best part is that I have only myself to blame 😔

@lrstewart lrstewart marked this pull request as ready for review February 20, 2025 02:42
@lrstewart lrstewart requested a review from maddeleine February 20, 2025 23:36
@lrstewart lrstewart added this pull request to the merge queue Feb 21, 2025
Merged via the queue into aws:main with commit 24eaea5 Feb 21, 2025
46 checks passed
@lrstewart lrstewart deleted the openssl3fips_evp_validalg branch February 21, 2025 05:25
dougch pushed a commit to dougch/s2n-tls that referenced this pull request Mar 3, 2025
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