117fd14ceSopenharmony_ci/*
217fd14ceSopenharmony_ci * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
317fd14ceSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
417fd14ceSopenharmony_ci * you may not use this file except in compliance with the License.
517fd14ceSopenharmony_ci * You may obtain a copy of the License at
617fd14ceSopenharmony_ci *
717fd14ceSopenharmony_ci *    http://www.apache.org/licenses/LICENSE-2.0
817fd14ceSopenharmony_ci *
917fd14ceSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1017fd14ceSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1117fd14ceSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1217fd14ceSopenharmony_ci * See the License for the specific language governing permissions and
1317fd14ceSopenharmony_ci * limitations under the License.
1417fd14ceSopenharmony_ci */
1517fd14ceSopenharmony_ci
1617fd14ceSopenharmony_ci#ifndef DEVICE_AUTH_DEFINES_H
1717fd14ceSopenharmony_ci#define DEVICE_AUTH_DEFINES_H
1817fd14ceSopenharmony_ci
1917fd14ceSopenharmony_ci/**
2017fd14ceSopenharmony_ci * @brief describes all error codes
2117fd14ceSopenharmony_ci */
2217fd14ceSopenharmony_cienum {
2317fd14ceSopenharmony_ci    /* common error code, 0x00000000 ~ 0x00000FFF */
2417fd14ceSopenharmony_ci    HC_SUCCESS = 0x00000000,                                              // 0
2517fd14ceSopenharmony_ci
2617fd14ceSopenharmony_ci    HC_ERROR = 0x00000001,                                                // 1
2717fd14ceSopenharmony_ci    HC_ERR_INVALID_PARAMS = 0x00000002,                                   // 2
2817fd14ceSopenharmony_ci    HC_ERR_INVALID_LEN = 0x00000003,                                      // 3
2917fd14ceSopenharmony_ci    HC_ERR_NULL_PTR = 0x00000004,                                         // 4
3017fd14ceSopenharmony_ci    HC_ERR_ALLOC_MEMORY = 0x00000005,                                     // 5
3117fd14ceSopenharmony_ci    HC_ERR_MEMORY_COPY = 0x00000006,                                      // 6
3217fd14ceSopenharmony_ci    HC_ERR_CONVERT_FAILED = 0x00000007,                                   // 7
3317fd14ceSopenharmony_ci    HC_ERR_NOT_SUPPORT = 0x00000008,                                      // 8
3417fd14ceSopenharmony_ci    HC_ERR_TIME_OUT = 0x00000009,                                         // 9
3517fd14ceSopenharmony_ci    HC_ERR_CASE = 0x0000000A,                                             // 10
3617fd14ceSopenharmony_ci    HC_ERR_BAD_TIMING = 0x0000000B,                                       // 11
3717fd14ceSopenharmony_ci    HC_ERR_PEER_ERROR = 0x0000000C,                                       // 12
3817fd14ceSopenharmony_ci    HC_ERR_FILE = 0x0000000D,                                             // 13
3917fd14ceSopenharmony_ci    HC_ERR_MEMORY_COMPARE = 0x0000000E,                                   // 14
4017fd14ceSopenharmony_ci    HC_ERR_OUT_OF_LIMIT = 0x0000000F,                                     // 15
4117fd14ceSopenharmony_ci    HC_ERR_INIT_FAILED = 0x00000010,                                      // 16
4217fd14ceSopenharmony_ci
4317fd14ceSopenharmony_ci    /* error code for algorithm adapter , 0x00001000 ~ 0x00001FFF */
4417fd14ceSopenharmony_ci    HC_ERR_KEY_NOT_EXIST = 0x00001001,                                    // 4097
4517fd14ceSopenharmony_ci    HC_ERR_GENERATE_KEY_FAILED = 0x00001002,                              // 4098
4617fd14ceSopenharmony_ci    HC_ERR_INVALID_PUBLIC_KEY = 0x00001003,                               // 4099
4717fd14ceSopenharmony_ci    HC_ERR_VERIFY_FAILED = 0x00001004,                                    // 4100
4817fd14ceSopenharmony_ci    HC_ERR_HASH_FAIL = 0x00001005,                                        // 4101
4917fd14ceSopenharmony_ci    HC_ERR_ALG_FAIL = 0x00001006,                                         // 4102
5017fd14ceSopenharmony_ci    HC_ERR_HKS_PARAM_SET_FAILED = 0x00001007,                             // 4103
5117fd14ceSopenharmony_ci
5217fd14ceSopenharmony_ci    /* error code for json util , 0x00002000 ~ 0x00002FFF */
5317fd14ceSopenharmony_ci    HC_ERR_JSON_FAIL = 0x00002001,                                        // 8193
5417fd14ceSopenharmony_ci    HC_ERR_JSON_CREATE = 0x00002002,                                      // 8194
5517fd14ceSopenharmony_ci    HC_ERR_JSON_GET = 0x00002003,                                         // 8195
5617fd14ceSopenharmony_ci    HC_ERR_JSON_ADD = 0x00002004,                                         // 8196
5717fd14ceSopenharmony_ci    HC_ERR_PACKAGE_JSON_TO_STRING_FAIL = 0x00002005,                      // 8197
5817fd14ceSopenharmony_ci
5917fd14ceSopenharmony_ci    /* error code for ipc, 0x00003000 ~ 0x00003FFF */
6017fd14ceSopenharmony_ci    HC_ERR_IPC_INTERNAL_FAILED = 0x00003001,                              // 12289
6117fd14ceSopenharmony_ci    HC_ERR_IPC_UNKNOW_OPCODE = 0x00003002,                                // 12290
6217fd14ceSopenharmony_ci    HC_ERR_IPC_CALL_DATA_LENGTH = 0x00003003,                             // 12291
6317fd14ceSopenharmony_ci    HC_ERR_IPC_METHOD_ID_INVALID = 0x00003004,                            // 12292
6417fd14ceSopenharmony_ci    HC_ERR_IPC_BAD_MESSAGE_LENGTH = 0x00003005,                           // 12293
6517fd14ceSopenharmony_ci    HC_ERR_IPC_BAD_VAL_LENGTH = 0x00003006,                               // 12294
6617fd14ceSopenharmony_ci    HC_ERR_IPC_BAD_PARAM_NUM = 0x00003007,                                // 12295
6717fd14ceSopenharmony_ci    HC_ERR_IPC_BAD_MSG_TYPE = 0x00003008,                                 // 12296
6817fd14ceSopenharmony_ci    HC_ERR_IPC_GET_SERVICE = 0x00003009,                                  // 12297
6917fd14ceSopenharmony_ci    HC_ERR_IPC_GET_PROXY = 0x0000300A,                                    // 12298
7017fd14ceSopenharmony_ci    HC_ERR_IPC_INIT = 0x0000300B,                                         // 12299
7117fd14ceSopenharmony_ci    HC_ERR_IPC_BUILD_PARAM = 0x0000300C,                                  // 12300
7217fd14ceSopenharmony_ci    HC_ERR_IPC_PROC_FAILED = 0x0000300D,                                  // 12301
7317fd14ceSopenharmony_ci    HC_ERR_IPC_UNKNOW_REPLY = 0x0000300E,                                 // 12302
7417fd14ceSopenharmony_ci    HC_ERR_IPC_OUT_DATA_NUM = 0x0000300F,                                 // 12303
7517fd14ceSopenharmony_ci    HC_ERR_IPC_OUT_DATA = 0x00003010,                                     // 12304
7617fd14ceSopenharmony_ci    HC_ERR_IPC_BAD_PARAM = 0x00003011,                                    // 12305
7717fd14ceSopenharmony_ci    HC_ERR_IPC_SERVICE_DIED = 0x00003012,                                 // 12306
7817fd14ceSopenharmony_ci
7917fd14ceSopenharmony_ci    /* error code for module , 0x00004000 ~ 0x00004FFF */
8017fd14ceSopenharmony_ci    HC_ERR_MODULE_NOT_FOUNT = 0x00004001,                                 // 16385
8117fd14ceSopenharmony_ci    HC_ERR_UNSUPPORTED_METHOD = 0x00004002,                               // 16386
8217fd14ceSopenharmony_ci    HC_ERR_UNSUPPORTED_VERSION = 0x00004003,                              // 16387
8317fd14ceSopenharmony_ci    HC_ERR_UNSUPPORTED_CURVE = 0x00004004,                                // 16388
8417fd14ceSopenharmony_ci    HC_ERR_BAD_MESSAGE = 0x00004005,                                      // 16389
8517fd14ceSopenharmony_ci    HC_ERR_PROOF_NOT_MATCH = 0x00004006,                                  // 16390
8617fd14ceSopenharmony_ci    HC_ERR_INIT_TASK_FAIL = 0x00004007,                                   // 16391
8717fd14ceSopenharmony_ci    HC_ERR_TASK_IS_NULL = 0x00004008,                                     // 16392
8817fd14ceSopenharmony_ci    HC_ERR_TASK_ID_IS_NOT_MATCH = 0x00004009,                             // 16393
8917fd14ceSopenharmony_ci    HC_ERR_INVALID_ALG = 0x0000400A,                                      // 16394
9017fd14ceSopenharmony_ci    HC_ERR_IGNORE_MSG = 0x0000400B,                                       // 16395
9117fd14ceSopenharmony_ci    HC_ERR_LOCAL_IDENTITY_NOT_EXIST = 0x0000400C,                         // 16396
9217fd14ceSopenharmony_ci    HC_ERR_UNSUPPORTED_OPCODE = 0x0000400D,                               // 16397
9317fd14ceSopenharmony_ci    HC_ERR_AUTH_TOKEN = 0x0000400E,                                       // 16398
9417fd14ceSopenharmony_ci    HC_ERR_PSK = 0x0000400F,                                              // 16399
9517fd14ceSopenharmony_ci    HC_ERR_TOKEN = 0x00004010,                                            // 16400
9617fd14ceSopenharmony_ci    HC_ERR_GENERATE_RANDOM = 0x00004011,                                  // 16401
9717fd14ceSopenharmony_ci    HC_ERR_STATUS = 0x00004012,                                           // 16402
9817fd14ceSopenharmony_ci    HC_ERR_STEP = 0x00004013,                                             // 16403
9917fd14ceSopenharmony_ci    HC_ERR_IDENTITY_DUPLICATED = 0x00004014,                              // 16404
10017fd14ceSopenharmony_ci
10117fd14ceSopenharmony_ci    /* error code for group , 0x00005000 ~ 0x00005FFF */
10217fd14ceSopenharmony_ci    HC_ERR_ACCESS_DENIED = 0x00005001,                                    // 20481
10317fd14ceSopenharmony_ci    HC_ERR_CALLBACK_NOT_FOUND = 0x00005002,                               // 20482
10417fd14ceSopenharmony_ci    HC_ERR_SERVICE_NEED_RESTART = 0x00005003,                             // 20483
10517fd14ceSopenharmony_ci    HC_ERR_NO_CANDIDATE_GROUP = 0x00005004,                               // 20484
10617fd14ceSopenharmony_ci    HC_ERR_TRANSMIT_FAIL = 0x00005005,                                    // 20485
10717fd14ceSopenharmony_ci    HC_ERR_REQUEST_EXIST = 0x00005006,                                    // 20486
10817fd14ceSopenharmony_ci    HC_ERR_REQUEST_NOT_FOUND = 0x00005007,                                // 20487
10917fd14ceSopenharmony_ci    HC_ERR_SESSION_NOT_EXIST = 0x00005008,                                // 20488
11017fd14ceSopenharmony_ci    HC_ERR_SESSION_ID_CONFLICT = 0x00005009,                              // 20489
11117fd14ceSopenharmony_ci    HC_ERR_REQ_REJECTED = 0x0000500A,                                     // 20490
11217fd14ceSopenharmony_ci    HC_ERR_SERVER_CONFIRM_FAIL = 0x0000500B,                              // 20491
11317fd14ceSopenharmony_ci    HC_ERR_CREATE_SESSION_FAIL = 0x0000500C,                              // 20492
11417fd14ceSopenharmony_ci    HC_ERR_SESSION_IS_FULL = 0x0000500D,                                  // 20493
11517fd14ceSopenharmony_ci    HC_ERR_INVALID_UDID = 0x0000500E,                                     // 20494
11617fd14ceSopenharmony_ci    HC_ERR_INVALID_TCIS_ID = 0x0000500F,                                  // 20495
11717fd14ceSopenharmony_ci    HC_ERR_DEL_GROUP = 0x00005010,                                        // 20496
11817fd14ceSopenharmony_ci    HC_ERR_INFORM_ERR = 0x00005011,                                       // 20497
11917fd14ceSopenharmony_ci    HC_ERR_ONLY_ACCOUNT_RELATED = 0x00005012,                             // 20498
12017fd14ceSopenharmony_ci    HC_ERR_CROSS_USER_ACCESS = 0x00005013,                                // 20499
12117fd14ceSopenharmony_ci
12217fd14ceSopenharmony_ci    /* error code for database , 0x00006000 ~ 0x00006FFF */
12317fd14ceSopenharmony_ci    HC_ERR_DB = 0x00006001,                                               // 24577
12417fd14ceSopenharmony_ci    HC_ERR_BEYOND_LIMIT = 0x00006002,                                     // 24578
12517fd14ceSopenharmony_ci    HC_ERR_SAVE_DB_FAILED = 0x00006003,                                   // 24579
12617fd14ceSopenharmony_ci    HC_ERR_ROLE_NOT_EXIST = 0x00006004,                                   // 24580
12717fd14ceSopenharmony_ci    HC_ERR_MANAGER_NOT_EXIST = 0x00006005,                                // 24581
12817fd14ceSopenharmony_ci    HC_ERR_GROUP_DUPLICATE = 0x00006006,                                  // 24582
12917fd14ceSopenharmony_ci    HC_ERR_GROUP_NOT_EXIST = 0x00006007,                                  // 24583
13017fd14ceSopenharmony_ci    HC_ERR_DEVICE_NOT_EXIST = 0x00006008,                                 // 24584
13117fd14ceSopenharmony_ci    HC_ERR_DEVICE_DUPLICATE = 0x00006009,                                 // 24585
13217fd14ceSopenharmony_ci    HC_ERR_LOST_DATA = 0x0000600A,                                        // 24586
13317fd14ceSopenharmony_ci    HC_ERR_OS_ACCOUNT_NOT_UNLOCKED = 0x0000600B,                          // 24587
13417fd14ceSopenharmony_ci
13517fd14ceSopenharmony_ci    /* error code for broadcast , 0x00007000 ~ 0x00007FFF */
13617fd14ceSopenharmony_ci    HC_ERR_LISTENER_NOT_EXIST = 0x00007001,                               // 28673
13717fd14ceSopenharmony_ci
13817fd14ceSopenharmony_ci    /* error code for channel , 0x00008000 ~ 0x00008FFF */
13917fd14ceSopenharmony_ci    HC_ERR_CHANNEL_NOT_EXIST = 0x00008001,                                // 32769
14017fd14ceSopenharmony_ci    HC_ERR_SOFT_BUS = 0x00008002,                                         // 32770
14117fd14ceSopenharmony_ci
14217fd14ceSopenharmony_ci    /* error code used on account-related authenticator */
14317fd14ceSopenharmony_ci    HC_ERR_GET_PK_INFO = 0x00009001,                                      // 36865
14417fd14ceSopenharmony_ci    HC_ERR_ACCOUNT_TASK_IS_FULL = 0x00009002,                             // 36866
14517fd14ceSopenharmony_ci    HC_ERR_ACCOUNT_ECDH_FAIL = 0x00009003,                                // 36867
14617fd14ceSopenharmony_ci    HC_ERR_ACCOUNT_VERIFY_PK_SIGN = 0x00009004,                           // 36868
14717fd14ceSopenharmony_ci    HC_ERR_AUTH_STATUS = 0x00009005,                                      // 36869
14817fd14ceSopenharmony_ci    HC_ERR_AUTH_INTERNAL = 0x00009006,                                    // 36870
14917fd14ceSopenharmony_ci    HC_ERR_ADD_ACCOUNT_TASK = 0x00009007,                                 // 36871
15017fd14ceSopenharmony_ci    HC_ERR_CLIENT_CONFIRM_PROTOCOL = 0x00009008,                          // 36872
15117fd14ceSopenharmony_ci    HC_ERR_SERVER_CONFIRM_PROTOCOL = 0x00009009,                          // 36873
15217fd14ceSopenharmony_ci
15317fd14ceSopenharmony_ci    /* error code used on DAS service */
15417fd14ceSopenharmony_ci    INVALID_PARAMETERS = 0xF0000001,                                      // -268435455
15517fd14ceSopenharmony_ci    EXCEED_AUTHORITY = 0xF0000002,                                        // -268435454
15617fd14ceSopenharmony_ci    TIMEOUT = 0xF0000003,                                                 // -268435453
15717fd14ceSopenharmony_ci    NOT_REGISTERED = 0xF0000004,                                          // -268435452
15817fd14ceSopenharmony_ci    NOT_TRUST_PEER = 0xF0000005,                                          // -268435451
15917fd14ceSopenharmony_ci    NOT_TRUST_CONTROLLER = 0xF0000006,                                    // -268435450
16017fd14ceSopenharmony_ci    NOT_TRUST_ACCESSORY = 0xF0000007,                                     // -268435449
16117fd14ceSopenharmony_ci    OVER_MAX_TRUST_NUM = 0xF0000008,                                      // -268435448
16217fd14ceSopenharmony_ci    CONNECTION_INTERRUPTED = 0xF0000009,                                  // -268435447
16317fd14ceSopenharmony_ci    UNSUPPORTED_VERSION = 0xF000000A,                                     // -268435446
16417fd14ceSopenharmony_ci    BAD_PAYLOAD = 0xF000000B,                                             // -268435445
16517fd14ceSopenharmony_ci    ALGORITHM_UNSUPPORTED = 0xF000000C,                                   // -268435444
16617fd14ceSopenharmony_ci    PROOF_MISMATCH = 0xF000000D,                                          // -268435443
16717fd14ceSopenharmony_ci};
16817fd14ceSopenharmony_ci
16917fd14ceSopenharmony_ci#endif
170