• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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 CODE_SIGN_ERR_CODE_H
17 #define CODE_SIGN_ERR_CODE_H
18 
19 enum CommonErrCode {
20     CS_SUCCESS = 0,
21     CS_ERR_MEMORY = -0x1,
22     CS_ERR_NO_PERMISSION = -0x2,
23     CS_ERR_NO_SIGNATURE = -0x3,
24     CS_ERR_INVALID_SIGNATURE = -0x4
25 };
26 
27 enum FileOperationErrCode {
28     CS_ERR_FILE_INVALID = -0x100,
29     CS_ERR_FILE_PATH = -0x101,
30     CS_ERR_FILE_OPEN = -0x102,
31     CS_ERR_FILE_READ = -0x103,
32     CS_ERR_EXTRACT_FILES = -0x104
33 };
34 
35 enum SignErrCode {
36     CS_ERR_PARAM_INVALID = -0x200,
37     CS_ERR_HUKS_OBTAIN_CERT = -0x201,
38     CS_ERR_HUKS_SIGN = -0x202,
39     CS_ERR_HUKS_INIT_KEY = -0x203,
40     CS_ERR_COMPUTE_DIGEST = -0x204,
41     CS_ERR_NO_OWNER_ID = -0x205,
42     CS_ERR_INIT_LOCAL_CERT = -0x206,
43     CS_ERR_VERIFY_CERT = -0x207
44 };
45 
46 enum OpenSSLErrCode {
47     CS_ERR_OPENSSL_LOAD_CERT = -0x210,
48     CS_ERR_OPENSSL_CREATE_PKCS7_DATA = -0x211,
49     CS_ERR_OPENSSL_PKCS7 = -0x212,
50     CS_ERR_OPENSSL_OID = -0x213,
51     CS_ERR_OPENSSL_BIO = -0x214,
52 };
53 
54 enum VerifyErrCode {
55     CS_ERR_ENABLE = -0x300,
56     CS_ERR_FSVREITY_NOT_SUPPORTED = -0x301,
57     CS_ERR_FSVERITY_NOT_ENABLED = -0x302,
58     CS_ERR_INVALID_OWNER_ID = -0x303,
59     CS_CODE_SIGN_NOT_EXISTS = -0x304,
60     CS_ERR_PROFILE = -0x305,
61     CS_ERR_ENABLE_TIMEOUT = -0x306
62 };
63 
64 enum IPCErrCode {
65     CS_ERR_IPC_MSG_INVALID = -0x500,
66     CS_ERR_IPC_WRITE_DATA = -0x501,
67     CS_ERR_IPC_READ_DATA = -0x502,
68     CS_ERR_REMOTE_CONNECTION = -0x503,
69     CS_ERR_SA_GET_SAMGR = -0x504,
70     CS_ERR_SA_GET_PROXY = -0x505,
71     CS_ERR_SA_LOAD_FAILED = -0x506,
72     CS_ERR_SA_LOAD_TIMEOUT = -0x507
73 };
74 
75 enum SignBlockErrCode {
76     CS_SUCCESS_END = 1,
77     CS_ERR_BLOCK_MAGIC = -0x600,
78     CS_ERR_BLOCK_VERSION = -0x601,
79     CS_ERR_BLOCK_SEG_NUM = -0x602,
80     CS_ERR_BLOCK_SIZE = -0x603,
81     CS_ERR_SEGMENT_FSVERITY_TYPE = -0x604,
82     CS_ERR_SEGMENT_HAP_TYPE = -0x605,
83     CS_ERR_SEGMENT_SO_TYPE = -0x606,
84     CS_ERR_SEGMENT_FSVERITY_OFFSET = -0x607,
85     CS_ERR_SEGMENT_HAP_OFFSET = -0x608,
86     CS_ERR_SEGMENT_SO_OFFSET = -0x609,
87     CS_ERR_FSVERITY_MAGIC = -0x610,
88     CS_ERR_FSVERITY_VERSION = -0x611,
89     CS_ERR_FSVERITY_BLOCK_SIZE = 0x612,
90     CS_ERR_HAP_MAGIC = -0x613,
91     CS_ERR_HAP_EXTERNSION = -0x614,
92     CS_ERR_SO_MAGIC = -0x615,
93     CS_ERR_SO_SECTION_NUM = -0x616,
94     CS_ERR_SO_FILE_OFFSET = -0x617,
95     CS_ERR_SO_FILE_SIZE = -0x618,
96     CS_ERR_SO_SIGN_OFFSET = -0x619,
97     CS_ERR_SO_SIGN_SIZE = -0x620,
98     CS_ERR_SIGN_ADDR_ALIGN = -0x621,
99     CS_ERR_SIGN_EXTENSION_OFFSET_ALIGN = -0x622,
100 };
101 #endif
102