• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CRYPTO_ERR_H
14 #define TEE_CRYPTO_ERR_H
15 
16 #include <tee_gmssl_err.h>
17 #ifdef OPENSSL_ENABLE
18 #include <tee_openssl_err.h>
19 #endif
20 
21 #define MAX_COMMON_CRYPTO_ENGINE_ERR   99
22 /*
23  * notes: all extension tee error rule is TEE_EXT_ERROR_BASE | CRYPTO_MODULE_ERR_ID | ALG_ERR_ID | base_error_value,
24  * For example, the crypto module extension error codes are prefixed with 0x8002,
25  * and base_error_value is opensoure lib err.
26  */
27 enum soft_algthorm_err_id {
28     SM2_LIB_ERR_ID         = 0x0000, /* GMSSL common err and ec err */
29     SM4_LIB_ERR_ID         = 0x1000, /* GMSSL evp err */
30     /* as below: for openssl opensource lib */
31     COMM_LIB_ERR_ID        = 0x2000,
32     BN_LIB_ERR_ID          = 0x3000,
33     RSA_LIB_ERR_ID         = 0x4000,
34     EVP_LIB_ERR_ID         = 0x5000,
35     PEM_LIB_ERR_ID         = 0x6000,
36     X509_LIB_ERR_ID        = 0x7000,
37     ASN1_LIB_ERR_ID        = 0x8000,
38     CRYPTO_LIB_ERR_ID      = 0x9000,
39     EC_LIB_ERR_ID          = 0xa000,
40     PKCS7_LIB_ERR_ID       = 0xb000,
41     OTHER_LIB_ERR_ID       = 0xc000,
42 };
43 #endif
44