1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
4 #ifndef _CC_CRYPTO_CTX_H_
5 #define _CC_CRYPTO_CTX_H_
7 #include <linux/types.h>
9 #define CC_DRV_DES_IV_SIZE 8
10 #define CC_DRV_DES_BLOCK_SIZE 8
12 #define CC_DRV_DES_ONE_KEY_SIZE 8
13 #define CC_DRV_DES_DOUBLE_KEY_SIZE 16
14 #define CC_DRV_DES_TRIPLE_KEY_SIZE 24
15 #define CC_DRV_DES_KEY_SIZE_MAX CC_DRV_DES_TRIPLE_KEY_SIZE
17 #define CC_AES_IV_SIZE 16
18 #define CC_AES_IV_SIZE_WORDS (CC_AES_IV_SIZE >> 2)
20 #define CC_AES_BLOCK_SIZE 16
21 #define CC_AES_BLOCK_SIZE_WORDS 4
23 #define CC_AES_128_BIT_KEY_SIZE 16
24 #define CC_AES_128_BIT_KEY_SIZE_WORDS (CC_AES_128_BIT_KEY_SIZE >> 2)
25 #define CC_AES_192_BIT_KEY_SIZE 24
26 #define CC_AES_192_BIT_KEY_SIZE_WORDS (CC_AES_192_BIT_KEY_SIZE >> 2)
27 #define CC_AES_256_BIT_KEY_SIZE 32
28 #define CC_AES_256_BIT_KEY_SIZE_WORDS (CC_AES_256_BIT_KEY_SIZE >> 2)
29 #define CC_AES_KEY_SIZE_MAX CC_AES_256_BIT_KEY_SIZE
30 #define CC_AES_KEY_SIZE_WORDS_MAX (CC_AES_KEY_SIZE_MAX >> 2)
32 #define CC_MD5_DIGEST_SIZE 16
33 #define CC_SHA1_DIGEST_SIZE 20
34 #define CC_SHA224_DIGEST_SIZE 28
35 #define CC_SHA256_DIGEST_SIZE 32
36 #define CC_SHA256_DIGEST_SIZE_IN_WORDS 8
37 #define CC_SHA384_DIGEST_SIZE 48
38 #define CC_SHA512_DIGEST_SIZE 64
40 #define CC_SHA1_BLOCK_SIZE 64
41 #define CC_SHA1_BLOCK_SIZE_IN_WORDS 16
42 #define CC_MD5_BLOCK_SIZE 64
43 #define CC_MD5_BLOCK_SIZE_IN_WORDS 16
44 #define CC_SHA224_BLOCK_SIZE 64
45 #define CC_SHA256_BLOCK_SIZE 64
46 #define CC_SHA256_BLOCK_SIZE_IN_WORDS 16
47 #define CC_SHA1_224_256_BLOCK_SIZE 64
48 #define CC_SHA384_BLOCK_SIZE 128
49 #define CC_SHA512_BLOCK_SIZE 128
51 #define CC_DIGEST_SIZE_MAX CC_SHA512_DIGEST_SIZE
52 #define CC_HASH_BLOCK_SIZE_MAX CC_SHA512_BLOCK_SIZE /*1024b*/
54 #define CC_HMAC_BLOCK_SIZE_MAX CC_HASH_BLOCK_SIZE_MAX
56 #define CC_DRV_ALG_MAX_BLOCK_SIZE CC_HASH_BLOCK_SIZE_MAX
58 #define CC_CPP_NUM_SLOTS 8
59 #define CC_CPP_NUM_ALGS 2
66 enum drv_engine_type
{
73 DRV_ENGINE_RESERVE32B
= S32_MAX
,
77 DRV_CRYPTO_ALG_NULL
= -1,
78 DRV_CRYPTO_ALG_AES
= 0,
79 DRV_CRYPTO_ALG_DES
= 1,
80 DRV_CRYPTO_ALG_HASH
= 2,
81 DRV_CRYPTO_ALG_C2
= 3,
82 DRV_CRYPTO_ALG_HMAC
= 4,
83 DRV_CRYPTO_ALG_AEAD
= 5,
84 DRV_CRYPTO_ALG_BYPASS
= 6,
85 DRV_CRYPTO_ALG_NUM
= 7,
86 DRV_CRYPTO_ALG_RESERVE32B
= S32_MAX
89 enum drv_crypto_direction
{
90 DRV_CRYPTO_DIRECTION_NULL
= -1,
91 DRV_CRYPTO_DIRECTION_ENCRYPT
= 0,
92 DRV_CRYPTO_DIRECTION_DECRYPT
= 1,
93 DRV_CRYPTO_DIRECTION_DECRYPT_ENCRYPT
= 3,
94 DRV_CRYPTO_DIRECTION_RESERVE32B
= S32_MAX
97 enum drv_cipher_mode
{
98 DRV_CIPHER_NULL_MODE
= -1,
102 DRV_CIPHER_CBC_MAC
= 3,
104 DRV_CIPHER_XCBC_MAC
= 5,
108 DRV_CIPHER_CBC_CTS
= 11,
109 DRV_CIPHER_GCTR
= 12,
110 DRV_CIPHER_ESSIV
= 13,
111 DRV_CIPHER_RESERVE32B
= S32_MAX
122 DRV_HASH_CBC_MAC
= 6,
123 DRV_HASH_XCBC_MAC
= 7,
126 DRV_HASH_MODE_NUM
= 10,
127 DRV_HASH_RESERVE32B
= S32_MAX
130 enum drv_hash_hw_mode
{
132 DRV_HASH_HW_SHA1
= 1,
133 DRV_HASH_HW_SHA256
= 2,
134 DRV_HASH_HW_SHA224
= 10,
135 DRV_HASH_HW_SHA512
= 4,
136 DRV_HASH_HW_SHA384
= 12,
137 DRV_HASH_HW_GHASH
= 6,
138 DRV_HASH_HW_SM3
= 14,
139 DRV_HASH_HW_RESERVE32B
= S32_MAX
142 #endif /* _CC_CRYPTO_CTX_H_ */