Debian Codegraph @

crt/s2n/tls/s2n_crypto.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 "crypto/s2n_certificate.h"
19 #include "crypto/s2n_cipher.h"
20 #include "crypto/s2n_dhe.h"
21 #include "crypto/s2n_ecc_evp.h"
22 #include "crypto/s2n_hash.h"
23 #include "crypto/s2n_hmac.h"
24 #include "crypto/s2n_pkey.h"
25 #include "crypto/s2n_signature.h"
26 #include "crypto/s2n_tls13_keys.h"
27 #include "tls/s2n_crypto_constants.h"
28 #include "tls/s2n_kem.h"
29 #include "tls/s2n_signature_scheme.h"
30 #include "tls/s2n_tls13_secrets.h"
31
32 struct s2n_kex_parameters {
33 struct s2n_dh_params server_dh_params;
34 struct s2n_ecc_evp_params server_ecc_evp_params;
35 const struct s2n_ecc_named_curve *mutually_supported_curves[S2N_ECC_EVP_SUPPORTED_CURVES_COUNT];
36 struct s2n_ecc_evp_params client_ecc_evp_params;
37 struct s2n_kem_group_params server_kem_group_params;
38 struct s2n_kem_group_params client_kem_group_params;
39 const struct s2n_kem_group *mutually_supported_kem_groups[S2N_KEM_GROUPS_COUNT];
40 struct s2n_kem_params kem_params;
41 struct s2n_blob client_key_exchange_message;
42 struct s2n_blob client_pq_kem_extension;
43 };
44
45 struct s2n_tls12_secrets {
46 uint8_t rsa_premaster_secret[S2N_TLS_SECRET_LEN];
47 uint8_t master_secret[S2N_TLS_SECRET_LEN];
48 };
49
50 struct s2n_secrets {
51 union {
52 struct s2n_tls12_secrets tls12;
53 struct s2n_tls13_secrets tls13;
54 } version;
55 s2n_extract_secret_type_t extract_secret_type;
56 };
57
58 struct s2n_crypto_parameters {
59 struct s2n_cipher_suite *cipher_suite;
60 struct s2n_session_key client_key;
61 struct s2n_session_key server_key;
62 struct s2n_hmac_state client_record_mac;
63 struct s2n_hmac_state server_record_mac;
64 uint8_t client_implicit_iv[S2N_TLS_MAX_IV_LEN];
65 uint8_t server_implicit_iv[S2N_TLS_MAX_IV_LEN];
66 uint8_t client_sequence_number[S2N_TLS_SEQUENCE_NUM_LEN];
67 uint8_t server_sequence_number[S2N_TLS_SEQUENCE_NUM_LEN];
68 };
69
70 S2N_RESULT s2n_crypto_parameters_new(struct s2n_crypto_parameters **params);
71 S2N_RESULT s2n_crypto_parameters_wipe(struct s2n_crypto_parameters *params);
72 S2N_CLEANUP_RESULT s2n_crypto_parameters_free(struct s2n_crypto_parameters **params);
73 S2N_RESULT s2n_crypto_parameters_switch(struct s2n_connection *conn);