1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 13 #ifndef TEE_GMSSL_ERR_H 14 #define TEE_GMSSL_ERR_H 15 16 /* 17 * define gmssl lib reasons err code: 18 * Delete the prefix TEE_ERR_GMSSL_ or TEE_ERR_SM2_ or TEE_ERR_SM4_, which is the error 19 * code name in the open-source library. 20 */ 21 /* for gmssl common err */ 22 #define TEE_ERR_SM2_ERR_R_MALLOC_FAILURE 0x80020041 23 #define TEE_ERR_SM2_ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED 0x80020042 24 #define TEE_ERR_SM2_ERR_R_PASSED_NULL_PARAMETER 0x80020043 25 #define TEE_ERR_SM2_ERR_R_INTERNAL_ERROR 0x80020044 26 #define TEE_ERR_SM2_ERR_R_DISABLED 0x80020045 27 #define TEE_ERR_SM2_ERR_R_INIT_FAIL 0x80020046 28 #define TEE_ERR_SM2_ERR_R_PASSED_INVALID_ARGUMENT 0x80020007 29 30 /* for sm2 ec lib err */ 31 #define TEE_ERR_SM2_EC_R_ASN1_ERROR 0x80020064 32 #define TEE_ERR_SM2_EC_R_BAD_SIGNATURE 0x80020065 33 #define TEE_ERR_SM2_EC_R_BIGNUM_OUT_OF_RANGE 0x80020066 34 #define TEE_ERR_SM2_EC_R_BUFFER_TOO_SMALL 0x80020067 35 #define TEE_ERR_SM2_EC_R_CMAC_FINAL_FAILURE 0x80020068 36 #define TEE_ERR_SM2_EC_R_CMAC_INIT_FAILURE 0x80020069 37 #define TEE_ERR_SM2_EC_R_CMAC_UPDATE_FAILURE 0x8002006a 38 #define TEE_ERR_SM2_EC_R_COORDINATES_OUT_OF_RANGE 0x8002006b 39 #define TEE_ERR_SM2_EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 0x8002006c 40 #define TEE_ERR_SM2_EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 0x8002006d 41 #define TEE_ERR_SM2_EC_R_D2I_ECPKPARAMETERS_FAILURE 0x8002006e 42 #define TEE_ERR_SM2_EC_R_DECODE_ERROR 0x8002006f 43 #define TEE_ERR_SM2_EC_R_DECRYPT_FAILED 0x80020070 44 #define TEE_ERR_SM2_EC_R_DISCRIMINANT_IS_ZERO 0x80020071 45 #define TEE_ERR_SM2_EC_R_ECDH_FAILED 0x80020072 46 #define TEE_ERR_SM2_EC_R_ECDH_FAILURE 0x80020073 47 #define TEE_ERR_SM2_EC_R_ECIES_DECRYPT_FAILED 0x80020074 48 #define TEE_ERR_SM2_EC_R_ECIES_DECRYPT_INIT_FAILURE 0x80020075 49 #define TEE_ERR_SM2_EC_R_ECIES_ENCRYPT_FAILED 0x80020076 50 #define TEE_ERR_SM2_EC_R_ECIES_VERIFY_MAC_FAILURE 0x80020077 51 #define TEE_ERR_SM2_EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 0x80020078 52 #define TEE_ERR_SM2_EC_R_ENCODE_ERROR 0x800200c6 53 #define TEE_ERR_SM2_EC_R_ENCRYPT_FAILED 0x80020079 54 #define TEE_ERR_SM2_EC_R_ENCRYPT_FAILURE 0x8002007a 55 #define TEE_ERR_SM2_EC_R_ERROR 0x8002007b 56 #define TEE_ERR_SM2_EC_R_FIELD_TOO_LARGE 0x8002007c 57 #define TEE_ERR_SM2_EC_R_GEN_MAC_FAILED 0x8002007d 58 #define TEE_ERR_SM2_EC_R_GET_PUBLIC_KEY_DATA_FAILURE 0x8002007e 59 #define TEE_ERR_SM2_EC_R_GET_TYPE1CURVE_ZETA_FAILURE 0x8002007f 60 #define TEE_ERR_SM2_EC_R_GF2M_NOT_SUPPORTED 0x80020080 61 #define TEE_ERR_SM2_EC_R_GROUP2PKPARAMETERS_FAILURE 0x80020081 62 #define TEE_ERR_SM2_EC_R_GROUP_MISMATCH 0x800200c7 63 #define TEE_ERR_SM2_EC_R_HMAC_FAILURE 0x80020082 64 #define TEE_ERR_SM2_EC_R_I2D_ECPKPARAMETERS_FAILURE 0x80020083 65 #define TEE_ERR_SM2_EC_R_INCOMPATIBLE_OBJECTS 0x80020084 66 #define TEE_ERR_SM2_EC_R_INVALID_ARGUMENT 0x80020085 67 #define TEE_ERR_SM2_EC_R_INVALID_COMPRESSED_POINT 0x80020086 68 #define TEE_ERR_SM2_EC_R_INVALID_COMPRESSION_BIT 0x80020087 69 #define TEE_ERR_SM2_EC_R_INVALID_CURVE 0x80020088 70 #define TEE_ERR_SM2_EC_R_INVALID_DIGEST 0x80020089 71 #define TEE_ERR_SM2_EC_R_INVALID_DIGEST_ALGOR 0x8002008a 72 #define TEE_ERR_SM2_EC_R_INVALID_DIGEST_TYPE 0x8002008b 73 #define TEE_ERR_SM2_EC_R_INVALID_ECIES_CIPHERTEXT 0x8002008c 74 #define TEE_ERR_SM2_EC_R_INVALID_ECIES_PARAMETERS 0x8002008d 75 #define TEE_ERR_SM2_EC_R_INVALID_ECIES_PARAMS 0x8002008e 76 #define TEE_ERR_SM2_EC_R_INVALID_EC_ENCRYPT_PARAM 0x8002008f 77 #define TEE_ERR_SM2_EC_R_INVALID_EC_SCHEME 0x80020090 78 #define TEE_ERR_SM2_EC_R_INVALID_ENCODING 0x80020091 79 #define TEE_ERR_SM2_EC_R_INVALID_ENC_PARAM 0x80020092 80 #define TEE_ERR_SM2_EC_R_INVALID_ENC_TYPE 0x80020093 81 #define TEE_ERR_SM2_EC_R_INVALID_FIELD 0x80020094 82 #define TEE_ERR_SM2_EC_R_INVALID_FORM 0x80020095 83 #define TEE_ERR_SM2_EC_R_INVALID_GROUP_ORDER 0x80020096 84 #define TEE_ERR_SM2_EC_R_INVALID_ID_LENGTH 0x80020097 85 #define TEE_ERR_SM2_EC_R_INVALID_INPUT_LENGTH 0x80020098 86 #define TEE_ERR_SM2_EC_R_INVALID_KDF_MD 0x80020099 87 #define TEE_ERR_SM2_EC_R_INVALID_KEY 0x8002009a 88 #define TEE_ERR_SM2_EC_R_INVALID_MD 0x8002009b 89 #define TEE_ERR_SM2_EC_R_INVALID_OUTPUT_LENGTH 0x8002009c 90 #define TEE_ERR_SM2_EC_R_INVALID_PEER_KEY 0x8002009d 91 #define TEE_ERR_SM2_EC_R_INVALID_PENTANOMIAL_BASIS 0x8002009e 92 #define TEE_ERR_SM2_EC_R_INVALID_PRIVATE_KEY 0x8002009f 93 #define TEE_ERR_SM2_EC_R_INVALID_SIGNER_ID 0x800200a0 94 #define TEE_ERR_SM2_EC_R_INVALID_SM2_ID 0x800200a1 95 #define TEE_ERR_SM2_EC_R_INVALID_SM2_KAP_CHECKSUM_LENGTH 0x800200a2 96 #define TEE_ERR_SM2_EC_R_INVALID_SM2_KAP_CHECKSUM_VALUE 0x800200a3 97 #define TEE_ERR_SM2_EC_R_INVALID_TRINOMIAL_BASIS 0x800200a4 98 #define TEE_ERR_SM2_EC_R_INVALID_TYPE1CURVE 0x800200a5 99 #define TEE_ERR_SM2_EC_R_INVALID_TYPE1_CURVE 0x800200a6 100 #define TEE_ERR_SM2_EC_R_INVLID_TYPE1CURVE 0x800200a7 101 #define TEE_ERR_SM2_EC_R_KDF_PARAMETER_ERROR 0x800200a8 102 #define TEE_ERR_SM2_EC_R_KEYS_NOT_SET 0x800200a9 103 #define TEE_ERR_SM2_EC_R_MISSING_PARAMETERS 0x800200aa 104 #define TEE_ERR_SM2_EC_R_MISSING_PRIVATE_KEY 0x800200ab 105 #define TEE_ERR_SM2_EC_R_NEED_NEW_SETUP_VALUES 0x800200ac 106 #define TEE_ERR_SM2_EC_R_NOT_A_NIST_PRIME 0x800200ad 107 #define TEE_ERR_SM2_EC_R_NOT_IMPLEMENTED 0x800200ae 108 #define TEE_ERR_SM2_EC_R_NOT_INITIALIZED 0x800200af 109 #define TEE_ERR_SM2_EC_R_NO_PARAMETERS_SET 0x800200b0 110 #define TEE_ERR_SM2_EC_R_NO_PRIVATE_VALUE 0x800200b1 111 #define TEE_ERR_SM2_EC_R_OPERATION_NOT_SUPPORTED 0x800200b2 112 #define TEE_ERR_SM2_EC_R_PASSED_NULL_PARAMETER 0x800200b3 113 #define TEE_ERR_SM2_EC_R_PEER_KEY_ERROR 0x800200b4 114 #define TEE_ERR_SM2_EC_R_PKPARAMETERS2GROUP_FAILURE 0x800200b5 115 #define TEE_ERR_SM2_EC_R_POINT_ARITHMETIC_FAILURE 0x800200b6 116 #define TEE_ERR_SM2_EC_R_POINT_AT_INFINITY 0x800200b7 117 #define TEE_ERR_SM2_EC_R_POINT_IS_NOT_ON_CURVE 0x800200b8 118 #define TEE_ERR_SM2_EC_R_RANDOM_NUMBER_GENERATION_FAILED 0x800200b9 119 #define TEE_ERR_SM2_EC_R_SHARED_INFO_ERROR 0x800200ba 120 #define TEE_ERR_SM2_EC_R_SLOT_FULL 0x800200bb 121 #define TEE_ERR_SM2_EC_R_SM2_DECRYPT_FAILED 0x800200bc 122 #define TEE_ERR_SM2_EC_R_SM2_ENCRYPT_FAILED 0x800200bd 123 #define TEE_ERR_SM2_EC_R_SM2_KAP_NOT_INITED 0x800200be 124 #define TEE_ERR_SM2_EC_R_UNDEFINED_GENERATOR 0x800200bf 125 #define TEE_ERR_SM2_EC_R_UNDEFINED_ORDER 0x800200c0 126 #define TEE_ERR_SM2_EC_R_UNKNOWN_GROUP 0x800200c1 127 #define TEE_ERR_SM2_EC_R_UNKNOWN_ORDER 0x800200c2 128 #define TEE_ERR_SM2_EC_R_UNSUPPORTED_FIELD 0x800200c3 129 #define TEE_ERR_SM2_EC_R_WRONG_CURVE_PARAMETERS 0x800200c4 130 #define TEE_ERR_SM2_EC_R_WRONG_ORDER 0x800200c5 131 132 #define TEE_ERR_SM4_ERR_R_MALLOC_FAILURE 0x80021041 133 #define TEE_ERR_SM4_ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED 0x80021042 134 #define TEE_ERR_SM4_ERR_R_PASSED_NULL_PARAMETER 0x80021043 135 #define TEE_ERR_SM4_ERR_R_INTERNAL_ERROR 0x80021044 136 #define TEE_ERR_SM4_ERR_R_DISABLED 0x80021045 137 #define TEE_ERR_SM4_ERR_R_INIT_FAIL 0x80021046 138 #define TEE_ERR_SM4_ERR_R_PASSED_INVALID_ARGUMENT 0x80021007 139 140 /* for sm4 evp lib err */ 141 #define TEE_ERR_SM4_EVP_R_AES_KEY_SETUP_FAILED 0x8002108f 142 #define TEE_ERR_SM4_EVP_R_BAD_DECRYPT 0x80021064 143 #define TEE_ERR_SM4_EVP_R_BUFFER_TOO_SMALL 0x8002109b 144 #define TEE_ERR_SM4_EVP_R_CAMELLIA_KEY_SETUP_FAILED 0x8002109d 145 #define TEE_ERR_SM4_EVP_R_CIPHER_PARAMETER_ERROR 0x8002107a 146 #define TEE_ERR_SM4_EVP_R_COMMAND_NOT_SUPPORTED 0x80021093 147 #define TEE_ERR_SM4_EVP_R_COPY_ERROR 0x800210ad 148 #define TEE_ERR_SM4_EVP_R_CTRL_NOT_IMPLEMENTED 0x80021084 149 #define TEE_ERR_SM4_EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 0x80021085 150 #define TEE_ERR_SM4_EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 0x8002108a 151 #define TEE_ERR_SM4_EVP_R_DECODE_ERROR 0x80021072 152 #define TEE_ERR_SM4_EVP_R_DIFFERENT_KEY_TYPES 0x80021065 153 #define TEE_ERR_SM4_EVP_R_DIFFERENT_PARAMETERS 0x80021099 154 #define TEE_ERR_SM4_EVP_R_ERROR_LOADING_SECTION 0x800210a5 155 #define TEE_ERR_SM4_EVP_R_ERROR_SETTING_FIPS_MODE 0x800210a6 156 #define TEE_ERR_SM4_EVP_R_EXPECTING_AN_HMAC_KEY 0x800210ae 157 #define TEE_ERR_SM4_EVP_R_EXPECTING_AN_RSA_KEY 0x8002107f 158 #define TEE_ERR_SM4_EVP_R_EXPECTING_A_DH_KEY 0x80021080 159 #define TEE_ERR_SM4_EVP_R_EXPECTING_A_DSA_KEY 0x80021081 160 #define TEE_ERR_SM4_EVP_R_EXPECTING_A_EC_KEY 0x8002108e 161 #define TEE_ERR_SM4_EVP_R_EXPECTING_A_PAILLIER 0x800210b0 162 #define TEE_ERR_SM4_EVP_R_FIPS_MODE_NOT_SUPPORTED 0x800210a7 163 #define TEE_ERR_SM4_EVP_R_ILLEGAL_SCRYPT_PARAMETERS 0x800210ab 164 #define TEE_ERR_SM4_EVP_R_INITIALIZATION_ERROR 0x80021086 165 #define TEE_ERR_SM4_EVP_R_INPUT_NOT_INITIALIZED 0x8002106f 166 #define TEE_ERR_SM4_EVP_R_INVALID_DIGEST 0x80021098 167 #define TEE_ERR_SM4_EVP_R_INVALID_FIPS_MODE 0x800210a8 168 #define TEE_ERR_SM4_EVP_R_INVALID_INPUT_LENGTH 0x800210a4 169 #define TEE_ERR_SM4_EVP_R_INVALID_KEY 0x800210a3 170 #define TEE_ERR_SM4_EVP_R_INVALID_KEY_LENGTH 0x80021082 171 #define TEE_ERR_SM4_EVP_R_INVALID_OPERATION 0x80021094 172 #define TEE_ERR_SM4_EVP_R_KEYGEN_FAILURE 0x80021078 173 #define TEE_ERR_SM4_EVP_R_MEMORY_LIMIT_EXCEEDED 0x800210ac 174 #define TEE_ERR_SM4_EVP_R_MESSAGE_DIGEST_IS_NULL 0x8002109f 175 #define TEE_ERR_SM4_EVP_R_METHOD_NOT_SUPPORTED 0x80021090 176 #define TEE_ERR_SM4_EVP_R_MISSING_PARAMETERS 0x80021067 177 #define TEE_ERR_SM4_EVP_R_NO_AVAIABLE_DIGEST 0x800210b2 178 #define TEE_ERR_SM4_EVP_R_NO_CIPHER_SET 0x80021083 179 #define TEE_ERR_SM4_EVP_R_NO_DEFAULT_DIGEST 0x8002109e 180 #define TEE_ERR_SM4_EVP_R_NO_DIGEST_SET 0x8002108b 181 #define TEE_ERR_SM4_EVP_R_NO_KEY_SET 0x8002109a 182 #define TEE_ERR_SM4_EVP_R_NO_OPERATION_SET 0x80021095 183 #define TEE_ERR_SM4_EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 0x80021096 184 #define TEE_ERR_SM4_EVP_R_OPERATON_NOT_INITIALIZED 0x80021097 185 #define TEE_ERR_SM4_EVP_R_PARTIALLY_OVERLAPPING 0x800210a2 186 #define TEE_ERR_SM4_EVP_R_PRIVATE_KEY_DECODE_ERROR 0x80021091 187 #define TEE_ERR_SM4_EVP_R_PRIVATE_KEY_ENCODE_ERROR 0x80021092 188 #define TEE_ERR_SM4_EVP_R_PUBLIC_KEY_NOT_RSA 0x8002106a 189 #define TEE_ERR_SM4_EVP_R_PUBLIC_KEY_NOT_RSA_OR_EC 0x800210b1 190 #define TEE_ERR_SM4_EVP_R_RSA_PUBLIC_ENCRYPT_FAILED 0x800210af 191 #define TEE_ERR_SM4_EVP_R_UNKNOWN_CIPHER 0x800210a0 192 #define TEE_ERR_SM4_EVP_R_UNKNOWN_DIGEST 0x800210a1 193 #define TEE_ERR_SM4_EVP_R_UNKNOWN_OPTION 0x800210a9 194 #define TEE_ERR_SM4_EVP_R_UNKNOWN_PBE_ALGORITHM 0x80021079 195 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_ALGORITHM 0x8002109c 196 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_CIPHER 0x8002106b 197 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_KEYLENGTH 0x8002107b 198 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 0x8002107c 199 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_KEY_SIZE 0x8002106c 200 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 0x80021087 201 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_PRF 0x8002107d 202 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 0x80021076 203 #define TEE_ERR_SM4_EVP_R_UNSUPPORTED_SALT_TYPE 0x8002107e 204 #define TEE_ERR_SM4_EVP_R_WRAP_MODE_NOT_ALLOWED 0x800210aa 205 #define TEE_ERR_SM4_EVP_R_WRONG_FINAL_BLOCK_LENGTH 0x8002106d 206 207 #endif 208