Debian Codegraph @

crt/s2n/crypto/s2n_ktls_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 "utils/s2n_blob.h"
19
20 /* clang-format off */
21 #if defined(S2N_KTLS_SUPPORTED)
22 #include <linux/tls.h>
23
24 typedef struct tls12_crypto_info_aes_gcm_128 s2n_ktls_crypto_info_tls12_aes_gcm_128;
25 typedef struct tls12_crypto_info_aes_gcm_256 s2n_ktls_crypto_info_tls12_aes_gcm_256;
26 #else
27 #define TLS_1_2_VERSION 0
28 #define TLS_1_3_VERSION 0
29
30 #define TLS_CIPHER_AES_GCM_128 0
31 typedef struct s2n_ktls_crypto_info_stub s2n_ktls_crypto_info_tls12_aes_gcm_128;
32 #define TLS_CIPHER_AES_GCM_256 0
33 typedef struct s2n_ktls_crypto_info_stub s2n_ktls_crypto_info_tls12_aes_gcm_256;
34 #endif
35 /* clang-format on */
36
37 /* To avoid compile-time errors, this must contain every field that we reference
38 * from any crypto_info. However, it is only a placeholder-- it should never
39 * actually be used.
40 */
41 struct s2n_ktls_crypto_info_stub {
42 struct {
43 uint8_t version;
44 uint8_t cipher_type;
45 } info;
46 uint8_t iv[1];
47 uint8_t key[1];
48 uint8_t salt[1];
49 uint8_t rec_seq[1];
50 };
51
52 struct s2n_ktls_crypto_info {
53 struct s2n_blob value;
54 union {
55 s2n_ktls_crypto_info_tls12_aes_gcm_128 aes_gcm_128;
56 s2n_ktls_crypto_info_tls12_aes_gcm_256 aes_gcm_256;
57 } ciphers;
58 };
59
60 struct s2n_ktls_crypto_info_inputs {
61 struct s2n_blob iv;
62 struct s2n_blob key;
63 struct s2n_blob seq;
64 };