• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 ATTEST_ERROR_CODE_H
17 #define ATTEST_ERROR_CODE_H
18 
19 #ifdef __cplusplus
20 #if __cplusplus
21 extern "C" {
22 #endif
23 #endif /* __cplusplus */
24 
25 #define ATTEST_OK 0
26 #define ATTEST_ERR (-1)
27 
28 // 网络访问相关
29 #define WISE_HTTPS_ERROR 4999
30 #define WISE_INVALID_CHALLENGE 14001
31 #define WISE_RETRY_CNT 1
32 
33 #define IS_WISE_RETRY(d_error) ((d_error) == WISE_INVALID_CHALLENGE || (d_error) == WISE_HTTPS_ERROR)
34 
35 // 设备认证结果
36 #define DEVICE_ATTEST_INIT (-2)
37 #define DEVICE_ATTEST_FAIL (-1)
38 #define DEVICE_ATTEST_PASS (0)
39 
40 #define ERR_INVALID_PARAM 101
41 #define ERR_SYSTEM_CALL   102
42 #define ERR_OUT_CAPACITY  103
43 
44 #define ERR_ATTEST_SECURITY_INVALID_ARG                  301
45 #define ERR_ATTEST_SECURITY_MEM_MALLOC                   302
46 #define ERR_ATTEST_SECURITY_MEM_MEMSET                   303
47 #define ERR_ATTEST_SECURITY_MEM_MEMCPY                   304
48 #define ERR_ATTEST_SECURITY_MEM_SPRINTF                  305
49 #define ERR_ATTEST_SECURITY_GEN_AESKEY                   306
50 #define ERR_ATTEST_SECURITY_DECRYPT                      307
51 #define ERR_ATTEST_SECURITY_ENCRYPT                      308
52 #define ERR_ATTEST_SECURITY_BASE64_DECODE                309
53 #define ERR_ATTEST_SECURITY_BASE64_ENCODE                310
54 #define ERR_ATTEST_SECURITY_GEN_UDID                     311
55 #define ERR_ATTEST_SECURITY_GEN_TOKEN_ID                 312
56 #define ERR_ATTEST_SECURITY_GEN_TOKEN_VALUE              313
57 #define ERR_ATTEST_SECURITY_READ_FROM_OS                 314
58 #define ERR_ATTEST_SECURITY_WRITE_TO_OS                  315
59 #define ERR_ATTEST_SECURITY_MD5                          316
60 #define ERR_ATTEST_SECURITY_GET_PSK                      317
61 #define ERR_ATTEST_SECURITY_HKDF                         318
62 #define ERR_ATTEST_SECURITY_GET_TOKEN_VALUE              319
63 #define ERR_ATTEST_SECURITY_GET_TOKEN                    320
64 
65 #define ERR_NET_INVALID_ARG                            401
66 #define ERR_NET_MEM_MALLOC                             402
67 #define ERR_NET_MEM_MEMSET                             403
68 #define ERR_NET_MEM_MEMCPY                             404
69 #define ERR_NET_DRBG_SEED_FAIL                         405
70 #define ERR_NET_PARSE_CERT_FAIL                        406
71 #define ERR_NET_CONNECT_FAIL                           407
72 #define ERR_NET_SET_NON_BLOCK_FAIL                     408
73 #define ERR_NET_HANDSHAKE_FAIL                         409
74 #define ERR_NET_SET_SSL_CONFIG_FAIL                    410
75 #define ERR_NET_SETUP_FAIL                             411
76 #define ERR_NET_SET_HOSTNAME_FAIL                      412
77 #define ERR_NET_WRITE_FAIL                             413
78 #define ERR_NET_READ_FAIL                              414
79 #define ERR_NET_CERT_VERIFY_FAIL                       415
80 
81 #ifdef __cplusplus
82 #if __cplusplus
83 }
84 #endif
85 #endif /* __cplusplus */
86 
87 #endif
88 
89