18e920a95Sopenharmony_ci/*
28e920a95Sopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
38e920a95Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48e920a95Sopenharmony_ci * you may not use this file except in compliance with the License.
58e920a95Sopenharmony_ci * You may obtain a copy of the License at
68e920a95Sopenharmony_ci *
78e920a95Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88e920a95Sopenharmony_ci *
98e920a95Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108e920a95Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118e920a95Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128e920a95Sopenharmony_ci * See the License for the specific language governing permissions and
138e920a95Sopenharmony_ci * limitations under the License.
148e920a95Sopenharmony_ci */
158e920a95Sopenharmony_ci
168e920a95Sopenharmony_ci#ifndef CODE_SIGN_ERR_CODE_H
178e920a95Sopenharmony_ci#define CODE_SIGN_ERR_CODE_H
188e920a95Sopenharmony_ci
198e920a95Sopenharmony_cienum CommonErrCode {
208e920a95Sopenharmony_ci    CS_SUCCESS = 0,
218e920a95Sopenharmony_ci    CS_ERR_MEMORY = -0x1,
228e920a95Sopenharmony_ci    CS_ERR_NO_PERMISSION = -0x2,
238e920a95Sopenharmony_ci    CS_ERR_NO_SIGNATURE = -0x3,
248e920a95Sopenharmony_ci    CS_ERR_INVALID_SIGNATURE = -0x4
258e920a95Sopenharmony_ci};
268e920a95Sopenharmony_ci
278e920a95Sopenharmony_cienum FileOperationErrCode {
288e920a95Sopenharmony_ci    CS_ERR_FILE_INVALID = -0x100,
298e920a95Sopenharmony_ci    CS_ERR_FILE_PATH = -0x101,
308e920a95Sopenharmony_ci    CS_ERR_FILE_OPEN = -0x102,
318e920a95Sopenharmony_ci    CS_ERR_FILE_READ = -0x103,
328e920a95Sopenharmony_ci    CS_ERR_EXTRACT_FILES = -0x104
338e920a95Sopenharmony_ci};
348e920a95Sopenharmony_ci
358e920a95Sopenharmony_cienum SignErrCode {
368e920a95Sopenharmony_ci    CS_ERR_PARAM_INVALID = -0x200,
378e920a95Sopenharmony_ci    CS_ERR_HUKS_OBTAIN_CERT = -0x201,
388e920a95Sopenharmony_ci    CS_ERR_HUKS_SIGN = -0x202,
398e920a95Sopenharmony_ci    CS_ERR_HUKS_INIT_KEY = -0x203,
408e920a95Sopenharmony_ci    CS_ERR_COMPUTE_DIGEST = -0x204,
418e920a95Sopenharmony_ci    CS_ERR_NO_OWNER_ID = -0x205,
428e920a95Sopenharmony_ci    CS_ERR_INIT_LOCAL_CERT = -0x206,
438e920a95Sopenharmony_ci    CS_ERR_VERIFY_CERT = -0x207
448e920a95Sopenharmony_ci};
458e920a95Sopenharmony_ci
468e920a95Sopenharmony_cienum OpenSSLErrCode {
478e920a95Sopenharmony_ci    CS_ERR_OPENSSL_LOAD_CERT = -0x210,
488e920a95Sopenharmony_ci    CS_ERR_OPENSSL_CREATE_PKCS7_DATA = -0x211,
498e920a95Sopenharmony_ci    CS_ERR_OPENSSL_PKCS7 = -0x212,
508e920a95Sopenharmony_ci    CS_ERR_OPENSSL_OID = -0x213,
518e920a95Sopenharmony_ci    CS_ERR_OPENSSL_BIO = -0x214,
528e920a95Sopenharmony_ci};
538e920a95Sopenharmony_ci
548e920a95Sopenharmony_cienum VerifyErrCode {
558e920a95Sopenharmony_ci    CS_ERR_ENABLE = -0x300,
568e920a95Sopenharmony_ci    CS_ERR_FSVREITY_NOT_SUPPORTED = -0x301,
578e920a95Sopenharmony_ci    CS_ERR_FSVERITY_NOT_ENABLED = -0x302,
588e920a95Sopenharmony_ci    CS_ERR_INVALID_OWNER_ID = -0x303,
598e920a95Sopenharmony_ci    CS_CODE_SIGN_NOT_EXISTS = -0x304,
608e920a95Sopenharmony_ci    CS_ERR_PROFILE = -0x305,
618e920a95Sopenharmony_ci    CS_ERR_ENABLE_TIMEOUT = -0x306,
628e920a95Sopenharmony_ci    CS_ERR_FSVREITY_NOT_ENABLED = -0x307,
638e920a95Sopenharmony_ci};
648e920a95Sopenharmony_ci
658e920a95Sopenharmony_cienum IPCErrCode {
668e920a95Sopenharmony_ci    CS_ERR_IPC_MSG_INVALID = -0x500,
678e920a95Sopenharmony_ci    CS_ERR_IPC_WRITE_DATA = -0x501,
688e920a95Sopenharmony_ci    CS_ERR_IPC_READ_DATA = -0x502,
698e920a95Sopenharmony_ci    CS_ERR_REMOTE_CONNECTION = -0x503,
708e920a95Sopenharmony_ci    CS_ERR_SA_GET_SAMGR = -0x504,
718e920a95Sopenharmony_ci    CS_ERR_SA_GET_PROXY = -0x505,
728e920a95Sopenharmony_ci    CS_ERR_SA_LOAD_FAILED = -0x506,
738e920a95Sopenharmony_ci    CS_ERR_SA_LOAD_TIMEOUT = -0x507
748e920a95Sopenharmony_ci};
758e920a95Sopenharmony_ci
768e920a95Sopenharmony_cienum SignBlockErrCode {
778e920a95Sopenharmony_ci    CS_SUCCESS_END = 1,
788e920a95Sopenharmony_ci    CS_ERR_BLOCK_MAGIC = -0x600,
798e920a95Sopenharmony_ci    CS_ERR_BLOCK_VERSION = -0x601,
808e920a95Sopenharmony_ci    CS_ERR_BLOCK_SEG_NUM = -0x602,
818e920a95Sopenharmony_ci    CS_ERR_BLOCK_SIZE = -0x603,
828e920a95Sopenharmony_ci    CS_ERR_SEGMENT_FSVERITY_TYPE = -0x604,
838e920a95Sopenharmony_ci    CS_ERR_SEGMENT_HAP_TYPE = -0x605,
848e920a95Sopenharmony_ci    CS_ERR_SEGMENT_SO_TYPE = -0x606,
858e920a95Sopenharmony_ci    CS_ERR_SEGMENT_FSVERITY_OFFSET = -0x607,
868e920a95Sopenharmony_ci    CS_ERR_SEGMENT_HAP_OFFSET = -0x608,
878e920a95Sopenharmony_ci    CS_ERR_SEGMENT_SO_OFFSET = -0x609,
888e920a95Sopenharmony_ci    CS_ERR_FSVERITY_MAGIC = -0x610,
898e920a95Sopenharmony_ci    CS_ERR_FSVERITY_VERSION = -0x611,
908e920a95Sopenharmony_ci    CS_ERR_FSVERITY_BLOCK_SIZE = 0x612,
918e920a95Sopenharmony_ci    CS_ERR_HAP_MAGIC = -0x613,
928e920a95Sopenharmony_ci    CS_ERR_HAP_EXTERNSION = -0x614,
938e920a95Sopenharmony_ci    CS_ERR_SO_MAGIC = -0x615,
948e920a95Sopenharmony_ci    CS_ERR_SO_SECTION_NUM = -0x616,
958e920a95Sopenharmony_ci    CS_ERR_SO_FILE_OFFSET = -0x617,
968e920a95Sopenharmony_ci    CS_ERR_SO_FILE_SIZE = -0x618,
978e920a95Sopenharmony_ci    CS_ERR_SO_SIGN_OFFSET = -0x619,
988e920a95Sopenharmony_ci    CS_ERR_SO_SIGN_SIZE = -0x620,
998e920a95Sopenharmony_ci    CS_ERR_SIGN_ADDR_ALIGN = -0x621,
1008e920a95Sopenharmony_ci    CS_ERR_INVALID_EXTENSION_OFFSET = -0x622,
1018e920a95Sopenharmony_ci    CS_ERR_INVALID_PAGE_INFO_EXTENSION = -0x623,
1028e920a95Sopenharmony_ci    CS_ERR_EXTENSION_SIGN_SIZE = -0x624,
1038e920a95Sopenharmony_ci};
1048e920a95Sopenharmony_ci
1058e920a95Sopenharmony_cienum JitCodeSignErrCode {
1068e920a95Sopenharmony_ci    CS_ERR_NO_SIGNER = -0x700,
1078e920a95Sopenharmony_ci    CS_ERR_PATCH_INVALID = -0x701,
1088e920a95Sopenharmony_ci    CS_ERR_JIT_SIGN_SIZE = -0x702,
1098e920a95Sopenharmony_ci    CS_ERR_TMP_BUFFER = -0x703,
1108e920a95Sopenharmony_ci    CS_ERR_VALIDATE_CODE = -0x704,
1118e920a95Sopenharmony_ci    CS_ERR_JITFORT_IN = -0x705,
1128e920a95Sopenharmony_ci    CS_ERR_JITFORT_OUT = -0x706,
1138e920a95Sopenharmony_ci    CS_ERR_SIGN_OFFSET = -0x707,
1148e920a95Sopenharmony_ci    CS_ERR_INVALID_DATA = -0x708,
1158e920a95Sopenharmony_ci    CS_ERR_JIT_MEMORY = -0x709,
1168e920a95Sopenharmony_ci    CS_ERR_UNSUPPORT = -0x7ff,
1178e920a95Sopenharmony_ci};
1188e920a95Sopenharmony_ci#endif
119