Debian Codegraph @

crt/s2n/tls/s2n_kem_preferences.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 <stdbool.h>
19
20 #include "tls/s2n_kem.h"
21 #include "tls/s2n_kex.h"
22
23 struct s2n_kem_preferences {
24 /* kems used for hybrid TLS 1.2 */
25 uint8_t kem_count;
26 const struct s2n_kem **kems;
27
28 /* tls13_kem_groups used for hybrid TLS 1.3 */
29 const uint8_t tls13_kem_group_count;
30 const struct s2n_kem_group **tls13_kem_groups;
31
32 /* Which draft revision data format should the client use in its ClientHello. Currently the server will auto-detect
33 * the format the client used from the TotalLength, and will match the client's behavior for backwards compatibility.
34 *
35 * Link: https://datatracker.ietf.org/doc/html/draft-ietf-tls-hybrid-design
36 * - Draft 0: PQ Hybrid KEM format: (Total Length, PQ Length, PQ Share, ECC Length, ECC Share)
37 * - Draft 1-5: PQ Hybrid KEM format: (Total Length, PQ Share, ECC Share)
38 */
39 uint8_t tls13_pq_hybrid_draft_revision;
40 };
41
42 extern const struct s2n_kem_group *pq_kem_groups_ietf_2024_10[];
43
44 extern const struct s2n_kem_preferences kem_preferences_pq_tls_1_3_ietf_2025_07;
45 extern const struct s2n_kem_preferences kem_preferences_pq_tls_1_3_ietf_2024_10;
46 extern const struct s2n_kem_preferences kem_preferences_pq_tls_1_3_cnsa2_2026_02;
47 extern const struct s2n_kem_preferences kem_preferences_all;
48 extern const struct s2n_kem_preferences kem_preferences_null;
49
50 bool s2n_kem_preferences_includes_tls13_kem_group(const struct s2n_kem_preferences *kem_preferences,
51 uint16_t query_iana_id);
52
53 bool s2n_tls13_client_must_use_hybrid_kem_length_prefix(const struct s2n_kem_preferences *kem_pref);
54
55 const struct s2n_kem_group *s2n_kem_preferences_get_highest_priority_group(const struct s2n_kem_preferences *kem_preferences);
56
57 S2N_RESULT s2n_kem_preferences_groups_available(const struct s2n_kem_preferences *kem_preferences, uint32_t *groups_available);