1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2019 Marvell International Ltd.
5 #ifndef _NITROX_SYM_CTX_H_
6 #define _NITROX_SYM_CTX_H_
10 #include <rte_crypto.h>
12 #define AES_MAX_KEY_SIZE 32
13 #define AES_BLOCK_SIZE 16
14 #define AES_GCM_SALT_SIZE 4
17 NITROX_CHAIN_CIPHER_ONLY,
18 NITROX_CHAIN_CIPHER_AUTH,
19 NITROX_CHAIN_AUTH_CIPHER,
20 NITROX_CHAIN_COMBINED,
21 NITROX_CHAIN_NOT_SUPPORTED
30 uint8_t key[AES_MAX_KEY_SIZE];
31 uint8_t iv[AES_BLOCK_SIZE];
39 struct flexi_crypto_context {
43 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
44 uint64_t cipher_type : 4;
45 uint64_t reserved_59 : 1;
46 uint64_t aes_keylen : 2;
47 uint64_t iv_source : 1;
48 uint64_t hash_type : 4;
49 uint64_t reserved_49_51 : 3;
50 uint64_t auth_input_type : 1;
52 uint64_t reserved_0_39 : 40;
54 uint64_t reserved_0_39 : 40;
56 uint64_t auth_input_type : 1;
57 uint64_t reserved_49_51 : 3;
58 uint64_t hash_type : 4;
59 uint64_t iv_source : 1;
60 uint64_t aes_keylen : 2;
61 uint64_t reserved_59 : 1;
62 uint64_t cipher_type : 4;
66 struct crypto_keys crypto;
67 struct auth_keys auth;
70 struct nitrox_crypto_ctx {
71 struct flexi_crypto_context fctx;
72 enum nitrox_chain nitrox_chain;
78 uint8_t salt[AES_GCM_SALT_SIZE];
79 uint16_t digest_length;
85 #endif /* _NITROX_SYM_CTX_H_ */