| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
#include "stuffer/s2n_stuffer.h" |
| 19 |
#include "tls/s2n_kem.h" |
| 20 |
#include "utils/s2n_result.h" |
| 21 |
|
| 22 |
typedef enum { |
| 23 |
S2N_PERFECT_FORWARD_SECRECY = 0, |
| 24 |
S2N_FIPS_140_3, |
| 25 |
S2N_SECURITY_RULES_COUNT, |
| 26 |
} s2n_security_rule_id; |
| 27 |
|
| 28 |
struct s2n_security_rule_result { |
| 29 |
bool found_error; |
| 30 |
bool write_output; |
| 31 |
struct s2n_stuffer output; |
| 32 |
}; |
| 33 |
S2N_RESULT s2n_security_rule_result_init_output(struct s2n_security_rule_result *result); |
| 34 |
S2N_CLEANUP_RESULT s2n_security_rule_result_free(struct s2n_security_rule_result *result); |
| 35 |
|
| 36 |
struct s2n_security_policy; |
| 37 |
struct s2n_cipher_suite; |
| 38 |
struct s2n_signature_scheme; |
| 39 |
struct s2n_ecc_named_curve; |
| 40 |
|
| 41 |
struct s2n_security_rule { |
| 42 |
const char *name; |
| 43 |
S2N_RESULT (*validate_cipher_suite)(const struct s2n_cipher_suite *cipher_suite, bool *valid); |
| 44 |
S2N_RESULT (*validate_sig_scheme)(const struct s2n_signature_scheme *sig_scheme, bool *valid); |
| 45 |
S2N_RESULT (*validate_cert_sig_scheme)(const struct s2n_signature_scheme *sig_scheme, bool *valid); |
| 46 |
S2N_RESULT (*validate_curve)(const struct s2n_ecc_named_curve *curve, bool *valid); |
| 47 |
S2N_RESULT (*validate_hybrid_group)(const struct s2n_kem_group *hybrid_group, bool *valid); |
| 48 |
S2N_RESULT (*validate_version)(uint8_t version, bool *valid); |
| 49 |
}; |
| 50 |
|
| 51 |
S2N_RESULT s2n_security_policy_validate_security_rules( |
| 52 |
const struct s2n_security_policy *policy, |
| 53 |
struct s2n_security_rule_result *result); |