1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HKS_CONFIG_H 17 #define HKS_CONFIG_H 18 19 #define HKS_ENABLE_EVENT_DELETE 20 21 #define HKS_SUPPORT_POSIX 22 23 #define HKS_SUPPORT_THREAD 24 25 #define HKS_LOG_ENGINE_LOG_CORE 26 #define HKS_ENABLE_LOG_PUBLIC 27 28 #define HKS_SUPPORT_API_ATTEST_KEY 29 30 #define HKS_SUPPORT_ACCESS_TOKEN 31 32 /* AES */ 33 #define HKS_SUPPORT_AES_C 34 #define HKS_SUPPORT_AES_GENERATE_KEY 35 #define HKS_SUPPORT_AES_CBC_NOPADDING 36 #define HKS_SUPPORT_AES_CBC_PKCS7 37 #define HKS_SUPPORT_AES_GCM 38 #define HKS_SUPPORT_AES_CTR_NOPADDING 39 #define HKS_SUPPORT_AES_ECB_NOPADDING 40 #define HKS_SUPPORT_AES_ECB_PKCS7PADDING 41 42 /* BN */ 43 #define HKS_SUPPORT_BN_C 44 45 /* ECC */ 46 #define HKS_SUPPORT_ECC_C 47 #define HKS_SUPPORT_ECC_GENERATE_KEY 48 #define HKS_SUPPORT_ECC_GET_PUBLIC_KEY 49 50 #define HKS_SUPPORT_ECDH_C 51 #define HKS_SUPPORT_ECDH_AGREE_KEY 52 53 #define HKS_SUPPORT_ECDSA_C 54 #define HKS_SUPPORT_ECDSA_SIGN_VERIFY 55 56 /* ED25519 */ 57 #define HKS_SUPPORT_ED25519_C 58 #define HKS_SUPPORT_ED25519_GENERATE_KEY 59 #define HKS_SUPPORT_ED25519_SIGN_VERIFY 60 #define HKS_SUPPORT_ED2519_GET_PUBLIC_KEY 61 62 /* HASH */ 63 #define HKS_SUPPORT_HASH_C 64 #define HKS_SUPPORT_HASH_SHA1 65 #define HKS_SUPPORT_HASH_SHA224 66 #define HKS_SUPPORT_HASH_SHA256 67 #define HKS_SUPPORT_HASH_SHA384 68 #define HKS_SUPPORT_HASH_SHA512 69 #define HKS_SUPPORT_HASH_MD5 70 71 /* HMAC */ 72 #define HKS_SUPPORT_HMAC_C 73 #define HKS_SUPPORT_HMAC_GENERATE_KEY 74 #define HKS_SUPPORT_HMAC_SHA1 75 #define HKS_SUPPORT_HMAC_SHA224 76 #define HKS_SUPPORT_HMAC_SHA256 77 #define HKS_SUPPORT_HMAC_SHA384 78 #define HKS_SUPPORT_HMAC_SHA512 79 80 /* KDF */ 81 #define HKS_SUPPORT_KDF_C 82 #define HKS_SUPPORT_KDF_PBKDF2 83 #define HKS_SUPPORT_KDF_HKDF 84 85 /* RSA */ 86 #define HKS_SUPPORT_RSA_C 87 #define HKS_SUPPORT_RSA_GENERATE_KEY 88 #define HKS_SUPPORT_RSA_CRYPT 89 #define HKS_SUPPORT_RSA_SIGN_VERIFY 90 #define HKS_SUPPORT_RSA_GET_PUBLIC_KEY 91 #define HKS_SUPPORT_RSA_ECB_NOPADDING 92 #define HKS_SUPPORT_RSA_ECB_PKCS1PADDING 93 #define HKS_SUPPORT_RSA_ECB_OAEPPADDING_SHA1MGF1 94 #define HKS_SUPPORT_RSA_ECB_OAEPPADDING_SHA224MGF1 95 #define HKS_SUPPORT_RSA_ECB_OAEPPADDING_SHA256MGF1 96 #define HKS_SUPPORT_RSA_ECB_OAEPPADDING_SHA384MGF1 97 #define HKS_SUPPORT_RSA_ECB_OAEPPADDING_SHA512MGF1 98 #define HKS_SUPPORT_RSA_ECB_OEAPPADDING 99 #define HKS_SUPPORT_RSA_PSS 100 101 /* DH */ 102 #define HKS_SUPPORT_DH_C 103 #define HKS_SUPPORT_DH_GENERATE_KEY 104 #define HKS_SUPPORT_DH_AGREE_KEY 105 #define HKS_SUPPORT_DH_GET_PUBLIC_KEY 106 107 /* DSA */ 108 #define HKS_SUPPORT_DSA_C 109 #define HKS_SUPPORT_DSA_GENERATE_KEY 110 #define HKS_SUPPORT_DSA_SIGN_VERIFY 111 #define HKS_SUPPORT_DSA_GET_PUBLIC_KEY 112 113 /* X25519 */ 114 #define HKS_SUPPORT_X25519_C 115 #define HKS_SUPPORT_X25519_GENERATE_KEY 116 #define HKS_SUPPORT_X25519_AGREE_KEY 117 #define HKS_SUPPORT_X25519_GET_PUBLIC_KEY 118 119 #define HKS_SUPPORT_ED25519_TO_X25519 120 121 /* SM2 */ 122 #ifdef HKS_SUPPORT_ECC_C 123 #define HKS_SUPPORT_SM2_C 124 #define HKS_SUPPORT_SM2_SIGN_VERIFY 125 #define HKS_SUPPORT_SM2_ENCRYPT_DECRYPT 126 #ifdef HKS_SUPPORT_ECC_GENERATE_KEY 127 #define HKS_SUPPORT_SM2_GENERATE_KEY 128 #endif 129 #ifdef HKS_SUPPORT_ECC_GET_PUBLIC_KEY 130 #define HKS_SUPPORT_SM2_GET_PUBLIC_KEY 131 #endif 132 #endif 133 134 /* SM3 */ 135 #define HKS_SUPPORT_SM3_C 136 #define HKS_SUPPORT_SM3_GENERATE_KEY 137 #if defined(HKS_SUPPORT_SM3_C) && defined(HKS_SUPPORT_HMAC_C) 138 #define HKS_SUPPORT_HMAC_SM3 139 #endif 140 #if defined(HKS_SUPPORT_SM3_C) && defined(HKS_SUPPORT_HASH_C) 141 #define HKS_SUPPORT_HASH_SM3 142 #define HKS_SUPPORT_KDF_SM3 143 #endif 144 145 /* SM4 */ 146 #define HKS_SUPPORT_SM4_C 147 #define HKS_SUPPORT_SM4_GENERATE_KEY 148 #define HKS_SUPPORT_SM4_CBC_NOPADDING 149 #define HKS_SUPPORT_SM4_CBC_PKCS7 150 #define HKS_SUPPORT_SM4_CTR_NOPADDING 151 #define HKS_SUPPORT_SM4_ECB_NOPADDING 152 #define HKS_SUPPORT_SM4_ECB_PKCS7 153 154 /* enable cfi */ 155 #define HKS_SUPPORT_CFI 156 157 #if defined(_SUPPORT_HKS_TEE_) && defined(HKS_SUPPORT_HMAC_GENERATE_KEY) 158 #define HKS_SUPPORT_GET_AT_KEY 159 #endif 160 161 #if defined(HKS_SUPPORT_AES_GENERATE_KEY) || defined(HKS_SUPPORT_DH_GENERATE_KEY) || \ 162 defined(HKS_SUPPORT_DSA_GENERATE_KEY) || defined(HKS_SUPPORT_ECC_GENERATE_KEY) || \ 163 defined(HKS_SUPPORT_ED25519_GENERATE_KEY) || defined(HKS_SUPPORT_HMAC_GENERATE_KEY) || \ 164 defined(HKS_SUPPORT_RSA_GENERATE_KEY) || defined(HKS_SUPPORT_X25519_GENERATE_KEY) || \ 165 defined(HKS_SUPPORT_SM2_GENERATE_KEY) || defined(HKS_SUPPORT_SM3_GENERATE_KEY) || \ 166 defined(HKS_SUPPORT_SM4_GENERATE_KEY) 167 #define HKS_SUPPORT_API_GENERATE_KEY 168 #define HKS_SUPPORT_API_DELETE_KEY 169 #define HKS_SUPPORT_API_GET_KEY_PARAM_SET 170 #define HKS_SUPPORT_API_KEY_EXIST 171 #endif 172 173 #if defined(HKS_SUPPORT_ECC_C) || defined(HKS_SUPPORT_RSA_C) || defined(HKS_SUPPORT_ED25519_C) || \ 174 defined(HKS_SUPPORT_X25519_C) || defined(HKS_SUPPORT_AES_C) || defined(HKS_SUPPORT_DSA_C) || \ 175 defined(HKS_SUPPORT_DH_C) || defined(HKS_SUPPORT_SM2_C) 176 #define HKS_SUPPORT_API_IMPORT 177 #endif 178 179 #if defined(HKS_SUPPORT_ECC_C) || defined(HKS_SUPPORT_RSA_C) || defined(HKS_SUPPORT_ED25519_C) || \ 180 defined(HKS_SUPPORT_X25519_C) || defined(HKS_SUPPORT_AES_C) || defined(HKS_SUPPORT_DSA_C) || \ 181 defined(HKS_SUPPORT_DH_C) || defined(HKS_SUPPORT_SM2_C) 182 #define HKS_SUPPORT_API_EXPORT 183 #endif 184 185 #if defined(HKS_SUPPORT_ECC_C) || defined(HKS_SUPPORT_RSA_C) || defined(HKS_SUPPORT_ED25519_C) || \ 186 defined(HKS_SUPPORT_X25519_C) || defined(HKS_SUPPORT_AES_C) || defined(HKS_SUPPORT_DSA_C) || \ 187 defined(HKS_SUPPORT_DH_C) || defined(HKS_SUPPORT_SM2_C) 188 #define HKS_SUPPORT_API_IMPORT_WRAPPED_KEY 189 #endif 190 191 #define HKS_SUPPORT_API_GENERATE_RANDOM 192 193 #if defined(HKS_SUPPORT_ECDSA_SIGN_VERIFY) || defined(HKS_SUPPORT_ED25519_SIGN_VERIFY) || \ 194 defined(HKS_SUPPORT_RSA_SIGN_VERIFY) || defined(HKS_SUPPORT_DSA_SIGN_VERIFY) 195 #define HKS_SUPPORT_API_SIGN_VERIFY 196 #endif 197 198 #if defined(HKS_SUPPORT_AES_C) || defined(HKS_SUPPORT_RSA_CRYPT) 199 #define HKS_SUPPORT_API_CIPHER 200 #endif 201 202 #if defined(HKS_SUPPORT_X25519_AGREE_KEY) || defined(HKS_SUPPORT_ECDH_AGREE_KEY) || defined(HKS_SUPPORT_DH_AGREE_KEY) 203 #define HKS_SUPPORT_API_AGREE_KEY 204 #endif 205 206 #ifdef HKS_SUPPORT_KDF_C 207 #define HKS_SUPPORT_API_DERIVE_KEY 208 #endif 209 210 #ifdef HKS_SUPPORT_HMAC_C 211 #define HKS_SUPPORT_API_MAC 212 #endif 213 214 #ifdef HKS_SUPPORT_HASH_C 215 #define HKS_SUPPORT_API_HASH 216 #endif 217 218 #ifdef HKS_SUPPORT_BN_C 219 #define HKS_SUPPORT_API_BN_EXP_MOD 220 #endif 221 222 #ifndef HKS_SUPPORT_LITE_HEAP 223 #define HKS_SUPPORT_API_GET_KEY_INFO_LIST 224 #endif 225 226 #ifndef HKS_SUPPORT_CHIPSET_PLATFORM_DECRYPT 227 #define HKS_SUPPORT_CHIPSET_PLATFORM_DECRYPT 228 #endif 229 230 #endif /* HKS_CONFIG_H */ 231