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 DEVICE_SECURITY_DEFINES_H 17 #define DEVICE_SECURITY_DEFINES_H 18 19 #include <stdint.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #define DEVICE_ID_MAX_LEN 64 26 27 typedef struct DeviceIdentify { 28 uint32_t length; 29 uint8_t identity[DEVICE_ID_MAX_LEN]; 30 } DeviceIdentify; 31 32 typedef struct RequestOption { 33 uint64_t challenge; 34 uint32_t timeout; 35 uint32_t extra; 36 } RequestOption; 37 38 #define DEFAULT_OPTION NULL 39 40 enum { 41 SUCCESS = 0, 42 ERR_INVALID_PARA = 1, 43 ERR_INVALID_LEN_PARA = 2, 44 ERR_NO_MEMORY = 3, 45 ERR_MEMORY_ERR = 4, 46 ERR_NO_CHALLENGE = 5, 47 ERR_NO_CRED = 6, 48 ERR_SA_BUSY = 7, 49 ERR_TIMEOUT = 8, 50 ERR_NOEXIST_REQUEST = 9, 51 ERR_INVALID_VERSION = 10, 52 ERR_OEM_ERR = 11, 53 ERR_HUKS_ERR = 12, 54 ERR_CHALLENGE_ERR = 13, 55 ERR_NOT_ONLINE = 14, 56 ERR_INIT_SELF_ERR = 15, 57 ERR_JSON_ERR = 16, 58 ERR_IPC_ERR = 17, 59 ERR_IPC_REGISTER_ERR = 18, 60 ERR_IPC_REMOTE_OBJ_ERR = 19, 61 ERR_IPC_PROXY_ERR = 20, 62 ERR_IPC_RET_PARCEL_ERR = 21, 63 ERR_PROXY_REMOTE_ERR = 22, 64 ERR_MSG_NEIGHBOR_FULL = 23, 65 ERR_MSG_FULL = 24, 66 ERR_MSG_ADD_NEIGHBOR = 25, 67 ERR_MSG_NOT_INIT = 26, 68 ERR_MSG_CREATE_WORKQUEUE = 27, 69 ERR_NEED_COMPATIBLE = 28, 70 ERR_REG_CALLBACK = 29, 71 ERR_PERMISSION_DENIAL = 30, 72 ERR_REQUEST_CODE_ERR = 31, 73 ERR_VERIFY_MODE_CRED_ERR = 32, 74 ERR_VERIFY_SIGNED_MODE_CRED_ERR = 33, 75 ERR_VERIFY_MODE_HUKS_ERR = 34, 76 ERR_PROFILE_CONNECT_ERR = 35, 77 ERR_MSG_OPEN_SESSION = 36, 78 ERR_QUERY_WAITING = 37, 79 ERR_NOEXIST_DEVICE = 38, 80 ERR_NOEXIST_COMMON_PK_INFO = 39, 81 ERR_ECC_VERIFY_ERR = 40, 82 ERR_GET_CLOUD_CRED_INFO = 41, 83 ERR_CALL_EXTERNAL_FUNC = 42, 84 ERR_PARSE_NONCE = 43, 85 ERR_ROOT_PUBKEY_NOT_RIGHT = 44, 86 ERR_PARSE_CLOUD_CRED_DATA = 45, 87 ERR_PARSE_PUBKEY_CHAIN = 46, 88 ERR_CHECK_CRED_INFO = 47, 89 ERR_ATTEST_NOT_READY = 48, 90 ERR_CLOUD_CRED_NOT_EXIST = 49, 91 ERR_DEFAULT = 0xFFFF 92 }; 93 94 #ifdef __cplusplus 95 } 96 #endif 97 98 #endif // DEVICE_SECURITY_DEFINES_H 99