Debian Codegraph @

crt/s2n/tls/s2n_tls13_secrets.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 "tls/s2n_crypto_constants.h"
19 #include "tls/s2n_quic_support.h"
20 #include "utils/s2n_blob.h"
21 #include "utils/s2n_result.h"
22
23 /* tls/s2n_tls13_secrets should eventually replace crypto/s2n_tls13_keys.h */
24 #include "crypto/s2n_tls13_keys.h"
25
26 typedef enum {
27 S2N_NONE_SECRET = 0,
28 S2N_EARLY_SECRET,
29 S2N_HANDSHAKE_SECRET,
30 S2N_MASTER_SECRET
31 } s2n_extract_secret_type_t;
32
33 struct s2n_tls13_secrets {
34 uint8_t extract_secret[S2N_TLS13_SECRET_MAX_LEN];
35
36 uint8_t client_early_secret[S2N_TLS13_SECRET_MAX_LEN];
37 uint8_t client_handshake_secret[S2N_TLS13_SECRET_MAX_LEN];
38 uint8_t server_handshake_secret[S2N_TLS13_SECRET_MAX_LEN];
39
40 uint8_t client_app_secret[S2N_TLS13_SECRET_MAX_LEN];
41 uint8_t server_app_secret[S2N_TLS13_SECRET_MAX_LEN];
42 uint8_t resumption_master_secret[S2N_TLS13_SECRET_MAX_LEN];
43 uint8_t exporter_master_secret[S2N_TLS13_SECRET_MAX_LEN];
44
45 s2n_extract_secret_type_t extract_secret_type;
46 };
47
48 S2N_RESULT s2n_tls13_empty_transcripts_init();
49
50 S2N_RESULT s2n_tls13_secrets_update(struct s2n_connection *conn);
51 S2N_RESULT s2n_tls13_secrets_get(struct s2n_connection *conn, s2n_extract_secret_type_t secret_type,
52 s2n_mode mode, struct s2n_blob *secret);
53 S2N_RESULT s2n_tls13_secrets_clean(struct s2n_connection *conn);
54
55 S2N_RESULT s2n_derive_binder_key(struct s2n_psk *psk, struct s2n_blob *output);
56 S2N_RESULT s2n_derive_resumption_master_secret(struct s2n_connection *conn);
57 S2N_RESULT s2n_derive_exporter_master_secret(struct s2n_connection *conn, struct s2n_blob *output);