-
Notifications
You must be signed in to change notification settings - Fork 749
Fix/add security policy validation checks #5565
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1866,6 +1866,44 @@ int s2n_validate_kem_preferences(const struct s2n_kem_preferences *kem_preferenc | |||||||||||||||||||||||||||||||||||||||
| return S2N_SUCCESS; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| int s2n_validate_cipher_preferences(const struct s2n_cipher_preferences *cipher_preferences) | ||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that you're adding these functions, but I don't think they're actually getting called anywhere? |
||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| POSIX_ENSURE_REF(cipher_preferences); | ||||||||||||||||||||||||||||||||||||||||
| /* checks to assert that the count is 0 */ | ||||||||||||||||||||||||||||||||||||||||
| /* iff */ | ||||||||||||||||||||||||||||||||||||||||
| /* the associated list is null */ | ||||||||||||||||||||||||||||||||||||||||
| POSIX_ENSURE(S2N_IFF(cipher_preferences->count==0, cipher_preferences->suites==NULL), | ||||||||||||||||||||||||||||||||||||||||
| S2N_ERR_INVALID_SECURITY_POLICY); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return S2N_SUCCESS; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| int s2n_validate_signature_preferences(const struct s2n_signature_preferences *signature_preferences) | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| POSIX_ENSURE_REF(signature_preferences); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| /* checks to assert that the count is 0 */ | ||||||||||||||||||||||||||||||||||||||||
| /* iff */ | ||||||||||||||||||||||||||||||||||||||||
| /* the associated list is null */ | ||||||||||||||||||||||||||||||||||||||||
| POSIX_ENSURE(S2N_IFF(signature_preferences->count == 0, signature_preferences->signature_schemes == NULL), | ||||||||||||||||||||||||||||||||||||||||
| S2N_ERR_INVALID_SECURITY_POLICY); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return S2N_SUCCESS; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1881
to
+1892
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I think we could make better use of the whitespace.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| int s2n_validate_ecc_preferences(const struct s2n_ecc_preferences *ecc_preferences) | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| POSIX_ENSURE_REF(ecc_preferences); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| /* checks to assert that the count is 0 */ | ||||||||||||||||||||||||||||||||||||||||
| /* iff */ | ||||||||||||||||||||||||||||||||||||||||
| /* the associated list is null */ | ||||||||||||||||||||||||||||||||||||||||
| POSIX_ENSURE(S2N_IFF(ecc_preferences->count == 0, ecc_preferences->ecc_curves == NULL), | ||||||||||||||||||||||||||||||||||||||||
| S2N_ERR_INVALID_SECURITY_POLICY); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return S2N_SUCCESS; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| S2N_RESULT s2n_validate_certificate_signature_preferences(const struct s2n_signature_preferences *certificate_signature_preferences) | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| RESULT_ENSURE_REF(certificate_signature_preferences); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
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 think this is unrelated to the security policy validation checks? I haven't totally read through what this is doing, but probably better to do in separate PR.