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 "tls/s2n_config.h"
19 #include "tls/s2n_signature_scheme.h"
20 #include "tls/s2n_crypto_constants.h"
21 #include "tls/s2n_kem.h"
22 
23 #include "crypto/s2n_certificate.h"
24 #include "crypto/s2n_cipher.h"
25 #include "crypto/s2n_hmac.h"
26 #include "crypto/s2n_hash.h"
27 #include "crypto/s2n_pkey.h"
28 #include "crypto/s2n_signature.h"
29 #include "crypto/s2n_tls13_keys.h"
30 #include "crypto/s2n_dhe.h"
31 #include "crypto/s2n_ecc_evp.h"
32 
33 struct s2n_kex_parameters {
34     struct s2n_dh_params server_dh_params;
35     struct s2n_ecc_evp_params server_ecc_evp_params;
36     const struct s2n_ecc_named_curve *mutually_supported_curves[S2N_ECC_EVP_SUPPORTED_CURVES_COUNT];
37     struct s2n_ecc_evp_params client_ecc_evp_params;
38     struct s2n_kem_group_params server_kem_group_params;
39     struct s2n_kem_group_params client_kem_group_params;
40     const struct s2n_kem_group *mutually_supported_kem_groups[S2N_SUPPORTED_KEM_GROUPS_COUNT];
41     struct s2n_kem_params kem_params;
42     struct s2n_blob client_key_exchange_message;
43     struct s2n_blob client_pq_kem_extension;
44 };
45 
46 struct s2n_secrets {
47     uint8_t rsa_premaster_secret[S2N_TLS_SECRET_LEN];
48     uint8_t master_secret[S2N_TLS_SECRET_LEN];
49     uint8_t client_random[S2N_TLS_RANDOM_DATA_LEN];
50     uint8_t server_random[S2N_TLS_RANDOM_DATA_LEN];
51     uint8_t client_app_secret[S2N_TLS13_SECRET_MAX_LEN];
52     uint8_t server_app_secret[S2N_TLS13_SECRET_MAX_LEN];
53 };
54 
55 struct s2n_crypto_parameters {
56     struct s2n_cipher_suite *cipher_suite;
57     struct s2n_session_key client_key;
58     struct s2n_session_key server_key;
59     struct s2n_hmac_state client_record_mac;
60     struct s2n_hmac_state server_record_mac;
61     uint8_t client_implicit_iv[S2N_TLS_MAX_IV_LEN];
62     uint8_t server_implicit_iv[S2N_TLS_MAX_IV_LEN];
63     uint8_t client_sequence_number[S2N_TLS_SEQUENCE_NUM_LEN];
64     uint8_t server_sequence_number[S2N_TLS_SEQUENCE_NUM_LEN];
65 };
66