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
Added certificate signature preferences #2370
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2370 +/- ##
==========================================
+ Coverage 81.92% 81.96% +0.03%
==========================================
Files 271 271
Lines 18663 18703 +40
==========================================
+ Hits 15290 15330 +40
Misses 3373 3373 |
@@ -138,20 +151,23 @@ const struct s2n_signature_scheme s2n_rsa_pss_rsae_sha256 = { | |||
.iana_value = TLS_SIGNATURE_SCHEME_RSA_PSS_RSAE_SHA256, | |||
.hash_alg = S2N_HASH_SHA256, | |||
.sig_alg = S2N_SIGNATURE_RSA_PSS_RSAE, | |||
.libcrypto_nid = NID_rsassaPss, |
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.
Is this the right nid? Why does this id not include the hash algorithm?
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.
I am still looking into why the id does not include the hash, but this is the correct id.
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.
Resolved offline; I will make a github issue to track this.
9fca4d7
to
508aa96
Compare
@@ -87,7 +89,7 @@ void s2n_x509_trust_store_wipe(struct s2n_x509_trust_store *store); | |||
/** Initialize the validator in unsafe mode. No validity checks for OCSP, host checks, or X.509 will be performed. */ | |||
int s2n_x509_validator_init_no_x509_validation(struct s2n_x509_validator *validator); | |||
|
|||
/** Initialize the validator in safe mode. Will use trust store to validate x.509 cerficiates, ocsp responses, and will call | |||
/** Initialize the validator in safe mode. Will use trust store to validate x.509 certificates, ocsp responses, and will call |
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.
Loving all these spelling fixes!
tls/s2n_x509_validator.c
Outdated
if (conn->config->security_policy->certificate_signature_preferences == NULL) { | ||
*validation_code = S2N_CERT_OK; | ||
return S2N_RESULT_OK; | ||
} |
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.
What if there's an override policy on the connection? You need to use s2n_connection_get_security_policy to retrieve the policy.
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.
Also, do you have a test for this case? It's a pretty important case.
d55940a
to
c61632a
Compare
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.
LGTM :)
* Added certificate signature preferences
Resolved issues:
resolves #1538 #1442
Description of changes:
This adds a certificate signature preferences struct to our security policies. This struct indicates which signature algorithms the peer will accept on the certificate. The only security policy to take advantage of this is the "default_tls13" policy, which now will not allow SHA-1 legacy signatures in certificates. Also I found a few spelling mistakes.
Call-outs:
Our test certificates aren't named for the signature algorithms they contain, so if you would like to check that I am testing the correct signature algorithms, use the openssl command:
openssl x509 -noout -text -in name_of_certfile.pem | grep "Signature Algorithm"
Another call out is that I had to add the Openssl ids for signature schemes as s2n uses Openssl's x509 functions to parse certificates.
Testing:
How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer?
Unit tests, integ tests that use authentication still pass.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.