Debian Codegraph @

crt/s2n/tls/s2n_security_rules.h

raw symbols SCIP
1 /*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
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);