From 1fd69e10d7152bd1df357901cb75dfcb7deba2e0 Mon Sep 17 00:00:00 2001 From: zhao_zhen_zhou Date: Thu, 8 Jun 2023 14:28:29 +0800 Subject: [PATCH] =?UTF-8?q?SA=E6=A8=A1=E5=9D=97=E6=A0=87=E5=87=86=E5=8C=96?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhao_zhen_zhou --- CODEOWNERS | 18 +++++ ...de.h => cert_manager_ipc_interface_code.h} | 21 ++++- .../cm_ipc/include/cm_ipc_client.h | 4 +- .../os_dependency/cm_ipc/include/cm_request.h | 12 ++- .../os_dependency/cm_ipc/src/cm_ipc_client.c | 34 ++++---- .../os_dependency/cm_ipc/src/cm_request.cpp | 9 ++- .../main/os_dependency/sa/cm_sa.cpp | 56 ++++++------- .../main/os_dependency/sa/cm_sa.h | 79 ++++++++++++------- .../cmipcserviceabort_fuzzer.cpp | 3 +- .../cmipcservicefinish_fuzzer.cpp | 3 +- .../cmipcservicegetappcert_fuzzer.cpp | 4 +- .../cmipcservicegetappcertlist_fuzzer.cpp | 4 +- ...mipcservicegetauthorizedapplist_fuzzer.cpp | 4 +- .../cmipcservicegetcertificateinfo_fuzzer.cpp | 4 +- .../cmipcservicegetcertificatelist_fuzzer.cpp | 4 +- .../cmipcservicegetusercertinfo_fuzzer.cpp | 3 +- .../cmipcservicegetusercertlist_fuzzer.cpp | 3 +- ...cmipcservicegrantappcertificate_fuzzer.cpp | 4 +- .../cmipcserviceinit_fuzzer.cpp | 3 +- .../cmipcserviceinstallappcert_fuzzer.cpp | 4 +- .../cmipcserviceinstallusercert_fuzzer.cpp | 4 +- .../cmipcserviceisauthorizedapp_fuzzer.cpp | 4 +- .../cmipcserviceremovegrantedapp_fuzzer.cpp | 4 +- .../cmipcservicesetcertstatus_fuzzer.cpp | 4 +- .../cmipcservicesetusercertstatus_fuzzer.cpp | 3 +- ...cmipcserviceuninstallallappcert_fuzzer.cpp | 3 +- ...mipcserviceuninstallallusercert_fuzzer.cpp | 3 +- .../cmipcserviceuninstallappcert_fuzzer.cpp | 3 +- .../cmipcserviceuninstallusercert_fuzzer.cpp | 3 +- .../cmipcserviceupdate_fuzzer.cpp | 3 +- .../cmsendrequest_fuzzer.cpp | 15 ++-- .../include/cm_fuzz_test_common.h | 13 +-- .../src/cm_fuzz_test_common.cpp | 56 ++++++------- 33 files changed, 247 insertions(+), 147 deletions(-) create mode 100644 CODEOWNERS rename frameworks/cert_manager_standard/main/common/include/{cm_ipc_msg_code.h => cert_manager_ipc_interface_code.h} (77%) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..ef162ee --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + # any change to frameworks/cert_manager_standard/main/common/include/cert_manager_ipc_interface_code.h + # needs to be reviewed by @leonchan5 +frameworks/cert_manager_standard/main/common/include/cert_manager_ipc_interface_code.h @leonchan5 diff --git a/frameworks/cert_manager_standard/main/common/include/cm_ipc_msg_code.h b/frameworks/cert_manager_standard/main/common/include/cert_manager_ipc_interface_code.h similarity index 77% rename from frameworks/cert_manager_standard/main/common/include/cm_ipc_msg_code.h rename to frameworks/cert_manager_standard/main/common/include/cert_manager_ipc_interface_code.h index 7587efb..343c289 100644 --- a/frameworks/cert_manager_standard/main/common/include/cm_ipc_msg_code.h +++ b/frameworks/cert_manager_standard/main/common/include/cert_manager_ipc_interface_code.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,11 +17,21 @@ #define CM_IPC_MSG_CODE_H #ifdef __cplusplus +namespace OHOS { +namespace Security { +namespace CertManager { extern "C" { #endif -enum CmMessage { - CM_MSG_BASE = 0x3a400, +#ifdef __cplusplus +#define INTERFACECODETYPE enum class +#else +#define INTERFACECODETYPE enum +#endif + +/* SAID: 3512 */ +INTERFACECODETYPE CertManagerInterfaceCode { + CM_MSG_BASE = 0, CM_MSG_GEN_KEY = CM_MSG_BASE, CM_MSG_GET_CERTIFICATE_LIST, @@ -53,5 +63,8 @@ enum CmMessage { #ifdef __cplusplus } +} // namespace CertManager +} // namespace Security +} // namespace OHOS +#endif #endif -#endif \ No newline at end of file diff --git a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_ipc_client.h b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_ipc_client.h index 33d45bb..1b5a6a7 100755 --- a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_ipc_client.h +++ b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_ipc_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -37,7 +37,7 @@ int32_t CmClientInstallAppCert(const struct CmBlob *appCert, const struct CmBlob int32_t CmClientUninstallAppCert(const struct CmBlob *keyUri, const uint32_t store); -int32_t CmClientUninstallAllAppCert(enum CmMessage type); +int32_t CmClientUninstallAllAppCert(enum CertManagerInterfaceCode type); int32_t CmClientGetAppCertList(const uint32_t store, struct CredentialList *certificateList); diff --git a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_request.h b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_request.h index e0cc2cf..bfb944c 100644 --- a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_request.h +++ b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/cm_request.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,13 +16,19 @@ #ifndef CM_REQUEST_H #define CM_REQUEST_H -#include "cm_ipc_msg_code.h" +#include "cert_manager_ipc_interface_code.h" #include "cm_type_inner.h" #ifdef __cplusplus extern "C" { #endif +#ifdef __cplusplus +typedef OHOS::Security::CertManager::CertManagerInterfaceCode CMINTERFACECODE; +#else +typedef enum CertManagerInterfaceCode CMINTERFACECODE; +#endif + /* * SendRequest - Send the request message to target module by function call or ipc or other ways. * @type: the request message type. @@ -30,7 +36,7 @@ extern "C" { * @outBlob: the output serialized data blob, can be null. */ -int32_t SendRequest(enum CmMessage type, const struct CmBlob *inBlob, +int32_t SendRequest(CMINTERFACECODE type, const struct CmBlob *inBlob, struct CmBlob *outBlob); #ifdef __cplusplus diff --git a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_ipc_client.c b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_ipc_client.c index 277255f..5074582 100644 --- a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_ipc_client.c +++ b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_ipc_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -51,7 +51,7 @@ static int32_t GetCertListInitOutData(struct CmBlob *outListBlob) return CM_SUCCESS; } -static int32_t GetCertificateList(enum CmMessage type, const uint32_t store, +static int32_t GetCertificateList(enum CertManagerInterfaceCode type, const uint32_t store, struct CertList *certificateList) { int32_t ret; @@ -108,7 +108,7 @@ static int32_t GetCertInfoInitOutData(struct CmBlob *outInfoBlob) return CM_SUCCESS; } -static int32_t GetCertificateInfo(enum CmMessage type, const struct CmBlob *certUri, +static int32_t GetCertificateInfo(enum CertManagerInterfaceCode type, const struct CmBlob *certUri, const uint32_t store, struct CertInfo *certificateInfo) { int32_t ret = CM_SUCCESS; @@ -156,7 +156,7 @@ int32_t CmClientGetCertInfo(const struct CmBlob *certUri, const uint32_t store, return GetCertificateInfo(CM_MSG_GET_CERTIFICATE_INFO, certUri, store, certificateInfo); } -static int32_t SetCertificateStatus(enum CmMessage type, const struct CmBlob *certUri, +static int32_t SetCertificateStatus(enum CertManagerInterfaceCode type, const struct CmBlob *certUri, const uint32_t store, const uint32_t status) { int32_t ret = CM_SUCCESS; @@ -235,7 +235,8 @@ int32_t CmClientInstallAppCert(const struct CmBlob *appCert, const struct CmBlob return InstallAppCert(appCert, appCertPwd, certAlias, store, keyUri); } -static int32_t UninstallAppCert(enum CmMessage type, const struct CmBlob *keyUri, const uint32_t store) +static int32_t UninstallAppCert(enum CertManagerInterfaceCode type, const struct CmBlob *keyUri, + const uint32_t store) { int32_t ret; struct CmParamSet *sendParamSet = NULL; @@ -275,7 +276,7 @@ int32_t CmClientUninstallAppCert(const struct CmBlob *keyUri, const uint32_t sto return UninstallAppCert(CM_MSG_UNINSTALL_APP_CERTIFICATE, keyUri, store); } -int32_t CmClientUninstallAllAppCert(enum CmMessage type) +int32_t CmClientUninstallAllAppCert(enum CertManagerInterfaceCode type) { int32_t ret; char tempBuff[] = "uninstall all app cert"; @@ -379,7 +380,8 @@ static int32_t CmAppCertListUnpackFromService(const struct CmBlob *outData, return CM_SUCCESS; } -static int32_t GetAppCertList(enum CmMessage type, const uint32_t store, struct CredentialList *certificateList) +static int32_t GetAppCertList(enum CertManagerInterfaceCode type, const uint32_t store, + struct CredentialList *certificateList) { int32_t ret; struct CmBlob outBlob = { 0, NULL }; @@ -533,7 +535,7 @@ static int32_t CmAppCertInfoUnpackFromService(const struct CmBlob *outData, stru return CM_SUCCESS; } -static int32_t GetAppCert(enum CmMessage type, const struct CmBlob *certUri, const uint32_t store, +static int32_t GetAppCert(enum CertManagerInterfaceCode type, const struct CmBlob *certUri, const uint32_t store, struct Credential *certificate) { int32_t ret; @@ -586,7 +588,7 @@ int32_t CmClientGetAppCert(const struct CmBlob *keyUri, const uint32_t store, st return GetAppCert(CM_MSG_GET_APP_CERTIFICATE, keyUri, store, certificate); } -static int32_t ClientSerializationAndSend(enum CmMessage message, struct CmParam *params, +static int32_t ClientSerializationAndSend(enum CertManagerInterfaceCode message, struct CmParam *params, uint32_t paramCount, struct CmBlob *outBlob) { struct CmParamSet *sendParamSet = NULL; @@ -814,7 +816,7 @@ int32_t CmClientAbort(const struct CmBlob *handle) return ret; } -static int32_t GetUserCertList(enum CmMessage type, const uint32_t store, +static int32_t GetUserCertList(enum CertManagerInterfaceCode type, const uint32_t store, struct CertList *certificateList) { int32_t ret = CM_SUCCESS; @@ -861,7 +863,7 @@ int32_t CmClientGetUserCertList(const uint32_t store, struct CertList *certifica return GetUserCertList(CM_MSG_GET_USER_CERTIFICATE_LIST, store, certificateList); } -static int32_t GetUserCertInfo(enum CmMessage type, const struct CmBlob *certUri, +static int32_t GetUserCertInfo(enum CertManagerInterfaceCode type, const struct CmBlob *certUri, const uint32_t store, struct CertInfo *userCertInfo) { int32_t ret = CM_SUCCESS; @@ -909,7 +911,7 @@ int32_t CmClientGetUserCertInfo(const struct CmBlob *certUri, const uint32_t sto return GetUserCertInfo(CM_MSG_GET_USER_CERTIFICATE_INFO, certUri, store, certificateInfo); } -static int32_t SetUserCertStatus(enum CmMessage type, const struct CmBlob *certUri, +static int32_t SetUserCertStatus(enum CertManagerInterfaceCode type, const struct CmBlob *certUri, const uint32_t store, const uint32_t status) { int32_t ret = CM_SUCCESS; @@ -944,8 +946,8 @@ int32_t CmClientSetUserCertStatus(const struct CmBlob *certUri, const uint32_t s return SetUserCertStatus(CM_MSG_SET_USER_CERTIFICATE_STATUS, certUri, store, status); } -static int32_t InstallUserCert(enum CmMessage type, const struct CmBlob *userCert, const struct CmBlob *certAlias, - struct CmBlob *certUri) +static int32_t InstallUserCert(enum CertManagerInterfaceCode type, const struct CmBlob *userCert, + const struct CmBlob *certAlias, struct CmBlob *certUri) { int32_t ret = CM_SUCCESS; struct CmBlob parcelBlob = {0, NULL}; @@ -978,7 +980,7 @@ int32_t CmClientInstallUserTrustedCert(const struct CmBlob *userCert, const stru return InstallUserCert(CM_MSG_INSTALL_USER_CERTIFICATE, userCert, certAlias, certUri); } -static int32_t UninstallUserCert(enum CmMessage type, const struct CmBlob *certUri) +static int32_t UninstallUserCert(enum CertManagerInterfaceCode type, const struct CmBlob *certUri) { int32_t ret = CM_SUCCESS; struct CmBlob parcelBlob = {0, NULL}; @@ -1009,7 +1011,7 @@ int32_t CmClientUninstallUserTrustedCert(const struct CmBlob *certUri) return UninstallUserCert(CM_MSG_UNINSTALL_USER_CERTIFICATE, certUri); } -static int32_t UninstallAllUserCert(enum CmMessage type) +static int32_t UninstallAllUserCert(enum CertManagerInterfaceCode type) { int ret = CM_SUCCESS; uint8_t temp[4] = {0}; /* only use to construct parcelBlob */ diff --git a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_request.cpp b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_request.cpp index e0da403..3cf46f6 100644 --- a/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_request.cpp +++ b/frameworks/cert_manager_standard/main/os_dependency/cm_ipc/src/cm_request.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,6 +28,7 @@ using namespace std; using namespace OHOS; +using namespace OHOS::Security::CertManager; namespace { constexpr int SA_ID_KEYSTORE_SERVICE = 3512; @@ -98,7 +99,7 @@ static int32_t CmReadRequestReply(MessageParcel &reply, struct CmBlob *outBlob) return CM_SUCCESS; } -int32_t SendRequest(enum CmMessage type, const struct CmBlob *inBlob, +int32_t SendRequest(CertManagerInterfaceCode type, const struct CmBlob *inBlob, struct CmBlob *outBlob) { uint32_t i = 0; @@ -128,7 +129,7 @@ int32_t SendRequest(enum CmMessage type, const struct CmBlob *inBlob, data.WriteUint32(inBlob->size); data.WriteBuffer(inBlob->data, static_cast(inBlob->size)); - int error = cmProxy->SendRequest(type, data, reply, option); + int error = cmProxy->SendRequest(static_cast(type), data, reply, option); if (error != 0) { CM_LOG_E("SendRequest error:%d", error); return error; @@ -153,4 +154,4 @@ void OnDemandLoadCertManagerCallback::OnLoadSystemAbilityFail(int32_t systemAbil sptr OnDemandLoadCertManagerCallback::Promise(void) { return promise_.get_future().get(); -} \ No newline at end of file +} diff --git a/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp b/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp index aae9b60..9082af6 100644 --- a/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp +++ b/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -47,36 +47,36 @@ using CmIpcAppHandlerFuncProc = void (*)(const struct CmBlob *msg, struct CmBlob const CmContext *context); struct CmIpcPoint { - enum CmMessage msgId; + CertManagerInterfaceCode msgId; CmIpcAppHandlerFuncProc handler; }; static struct CmIpcPoint g_cmIpcHandler[] = { - { CM_MSG_INSTALL_APP_CERTIFICATE, CmIpcServiceInstallAppCert }, - { CM_MSG_UNINSTALL_APP_CERTIFICATE, CmIpcServiceUninstallAppCert }, - { CM_MSG_UNINSTALL_ALL_APP_CERTIFICATE, CmIpcServiceUninstallAllAppCert }, - { CM_MSG_GET_APP_CERTIFICATE_LIST, CmIpcServiceGetAppCertList }, - { CM_MSG_GET_APP_CERTIFICATE, CmIpcServiceGetAppCert }, - - { CM_MSG_GRANT_APP_CERT, CmIpcServiceGrantAppCertificate }, - { CM_MSG_GET_AUTHED_LIST, CmIpcServiceGetAuthorizedAppList }, - { CM_MSG_CHECK_IS_AUTHED_APP, CmIpcServiceIsAuthorizedApp }, - { CM_MSG_REMOVE_GRANT_APP, CmIpcServiceRemoveGrantedApp }, - { CM_MSG_INIT, CmIpcServiceInit }, - { CM_MSG_UPDATE, CmIpcServiceUpdate }, - { CM_MSG_FINISH, CmIpcServiceFinish }, - { CM_MSG_ABORT, CmIpcServiceAbort }, - - { CM_MSG_GET_USER_CERTIFICATE_LIST, CmIpcServiceGetUserCertList }, - { CM_MSG_GET_USER_CERTIFICATE_INFO, CmIpcServiceGetUserCertInfo }, - { CM_MSG_SET_USER_CERTIFICATE_STATUS, CmIpcServiceSetUserCertStatus }, - { CM_MSG_INSTALL_USER_CERTIFICATE, CmIpcServiceInstallUserCert }, - { CM_MSG_UNINSTALL_USER_CERTIFICATE, CmIpcServiceUninstallUserCert }, - { CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE, CmIpcServiceUninstallAllUserCert }, - - { CM_MSG_GET_CERTIFICATE_LIST, CmIpcServiceGetCertificateList }, - { CM_MSG_GET_CERTIFICATE_INFO, CmIpcServiceGetCertificateInfo }, - { CM_MSG_SET_CERTIFICATE_STATUS, CmIpcServiceSetCertStatus }, + { CertManagerInterfaceCode::CM_MSG_INSTALL_APP_CERTIFICATE, CmIpcServiceInstallAppCert }, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_APP_CERTIFICATE, CmIpcServiceUninstallAppCert }, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_ALL_APP_CERTIFICATE, CmIpcServiceUninstallAllAppCert }, + { CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE_LIST, CmIpcServiceGetAppCertList }, + { CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE, CmIpcServiceGetAppCert }, + + { CertManagerInterfaceCode::CM_MSG_GRANT_APP_CERT, CmIpcServiceGrantAppCertificate }, + { CertManagerInterfaceCode::CM_MSG_GET_AUTHED_LIST, CmIpcServiceGetAuthorizedAppList }, + { CertManagerInterfaceCode::CM_MSG_CHECK_IS_AUTHED_APP, CmIpcServiceIsAuthorizedApp }, + { CertManagerInterfaceCode::CM_MSG_REMOVE_GRANT_APP, CmIpcServiceRemoveGrantedApp }, + { CertManagerInterfaceCode::CM_MSG_INIT, CmIpcServiceInit }, + { CertManagerInterfaceCode::CM_MSG_UPDATE, CmIpcServiceUpdate }, + { CertManagerInterfaceCode::CM_MSG_FINISH, CmIpcServiceFinish }, + { CertManagerInterfaceCode::CM_MSG_ABORT, CmIpcServiceAbort }, + + { CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_LIST, CmIpcServiceGetUserCertList }, + { CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_INFO, CmIpcServiceGetUserCertInfo }, + { CertManagerInterfaceCode::CM_MSG_SET_USER_CERTIFICATE_STATUS, CmIpcServiceSetUserCertStatus }, + { CertManagerInterfaceCode::CM_MSG_INSTALL_USER_CERTIFICATE, CmIpcServiceInstallUserCert }, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_USER_CERTIFICATE, CmIpcServiceUninstallUserCert }, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE, CmIpcServiceUninstallAllUserCert }, + + { CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_LIST, CmIpcServiceGetCertificateList }, + { CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_INFO, CmIpcServiceGetCertificateInfo }, + { CertManagerInterfaceCode::CM_MSG_SET_CERTIFICATE_STATUS, CmIpcServiceSetCertStatus }, }; static void SubscribEvent() @@ -114,7 +114,7 @@ static int32_t ProcessMessage(uint32_t code, uint32_t outSize, const struct CmBl { uint32_t size = sizeof(g_cmIpcHandler) / sizeof(g_cmIpcHandler[0]); for (uint32_t i = 0; i < size; ++i) { - if (code != g_cmIpcHandler[i].msgId) { + if (code != static_cast(g_cmIpcHandler[i].msgId)) { continue; } struct CmBlob outData = { 0, nullptr }; diff --git a/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.h b/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.h index 99e13f3..efb0c7f 100644 --- a/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.h +++ b/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,7 +23,7 @@ #include "nocopyable.h" #include "system_ability.h" -#include "cm_ipc_msg_code.h" +#include "cert_manager_ipc_interface_code.h" namespace OHOS { namespace Security { @@ -44,34 +44,57 @@ class ICertManagerService : public IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"ohos.security.cm.service"); // message code - uint32_t MSG_CODE_BASE = CM_MSG_BASE; - - uint32_t MSG_CODE_GEN_KEY = CM_MSG_GEN_KEY; - uint32_t MSG_CODE_GET_CERTIFICATE_LIST = CM_MSG_GET_CERTIFICATE_LIST; - uint32_t MSG_CODE_GET_CERTIFICATE_INFO = CM_MSG_GET_CERTIFICATE_INFO; - uint32_t MSG_CODE_SET_CERTIFICATE_STATUS = CM_MSG_SET_CERTIFICATE_STATUS; - uint32_t MSG_CODE_INSTALL_APP_CERTIFICATE = CM_MSG_INSTALL_APP_CERTIFICATE; - uint32_t MSG_CODE_UNINSTALL_APP_CERTIFICATE = CM_MSG_UNINSTALL_APP_CERTIFICATE; - uint32_t MSG_CODE_UNINSTALL_ALL_APP_CERTIFICATE = CM_MSG_UNINSTALL_ALL_APP_CERTIFICATE; - uint32_t MSG_CODE_GET_APP_CERTIFICATE_LIST = CM_MSG_GET_APP_CERTIFICATE_LIST; - uint32_t MSG_CODE_GET_APP_CERTIFICATE = CM_MSG_GET_APP_CERTIFICATE; - uint32_t MSG_CODE_GRANT_APP_CERT = CM_MSG_GRANT_APP_CERT; - uint32_t MSG_CODE_GET_AUTHED_LIST = CM_MSG_GET_AUTHED_LIST; - uint32_t MSG_CODE_CHECK_IS_AUTHED_APP = CM_MSG_CHECK_IS_AUTHED_APP; - uint32_t MSG_CODE_REMOVE_GRANT_APP = CM_MSG_REMOVE_GRANT_APP; - uint32_t MSG_CODE_INIT = CM_MSG_INIT; - uint32_t MSG_CODE_UPDATE = CM_MSG_UPDATE; - uint32_t MSG_CODE_FINISH = CM_MSG_FINISH; - uint32_t MSG_CODE_ABORT = CM_MSG_ABORT; - uint32_t MSG_CODE_GET_USER_CERTIFICATE_LIST = CM_MSG_GET_USER_CERTIFICATE_LIST; - uint32_t MSG_CODE_GET_USER_CERTIFICATE_INFO = CM_MSG_GET_USER_CERTIFICATE_INFO; - uint32_t MSG_CODE_SET_USER_CERTIFICATE_STATUS = CM_MSG_SET_USER_CERTIFICATE_STATUS; - uint32_t MSG_CODE_INSTALL_USER_CERTIFICATE = CM_MSG_INSTALL_USER_CERTIFICATE; - uint32_t MSG_CODE_UNINSTALL_USER_CERTIFICATE = CM_MSG_UNINSTALL_USER_CERTIFICATE; - uint32_t MSG_CODE_UNINSTALL_ALL_USER_CERTIFICATE = CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE; + uint32_t MSG_CODE_BASE = static_cast(CertManagerInterfaceCode::CM_MSG_BASE); + + uint32_t MSG_CODE_GEN_KEY = static_cast( + CertManagerInterfaceCode::CM_MSG_GEN_KEY); + uint32_t MSG_CODE_GET_CERTIFICATE_LIST = static_cast( + CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_LIST); + uint32_t MSG_CODE_GET_CERTIFICATE_INFO = static_cast( + CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_INFO); + uint32_t MSG_CODE_SET_CERTIFICATE_STATUS = static_cast( + CertManagerInterfaceCode::CM_MSG_SET_CERTIFICATE_STATUS); + uint32_t MSG_CODE_INSTALL_APP_CERTIFICATE = static_cast( + CertManagerInterfaceCode::CM_MSG_INSTALL_APP_CERTIFICATE); + uint32_t MSG_CODE_UNINSTALL_APP_CERTIFICATE = static_cast( + CertManagerInterfaceCode::CM_MSG_UNINSTALL_APP_CERTIFICATE); + uint32_t MSG_CODE_UNINSTALL_ALL_APP_CERTIFICATE = static_cast( + CertManagerInterfaceCode::CM_MSG_UNINSTALL_ALL_APP_CERTIFICATE); + uint32_t MSG_CODE_GET_APP_CERTIFICATE_LIST = static_cast( + CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE_LIST); + uint32_t MSG_CODE_GET_APP_CERTIFICATE = static_cast( + CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE); + uint32_t MSG_CODE_GRANT_APP_CERT = static_cast( + CertManagerInterfaceCode::CM_MSG_GRANT_APP_CERT); + uint32_t MSG_CODE_GET_AUTHED_LIST = static_cast( + CertManagerInterfaceCode::CM_MSG_GET_AUTHED_LIST); + uint32_t MSG_CODE_CHECK_IS_AUTHED_APP = static_cast( + CertManagerInterfaceCode::CM_MSG_CHECK_IS_AUTHED_APP); + uint32_t MSG_CODE_REMOVE_GRANT_APP = static_cast( + CertManagerInterfaceCode::CM_MSG_REMOVE_GRANT_APP); + uint32_t MSG_CODE_INIT = static_cast( + CertManagerInterfaceCode::CM_MSG_INIT); + uint32_t MSG_CODE_UPDATE = static_cast( + CertManagerInterfaceCode::CM_MSG_UPDATE); + uint32_t MSG_CODE_FINISH = static_cast( + CertManagerInterfaceCode::CM_MSG_FINISH); + uint32_t MSG_CODE_ABORT = static_cast( + CertManagerInterfaceCode::CM_MSG_ABORT); + uint32_t MSG_CODE_GET_USER_CERTIFICATE_LIST = static_cast( + CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_LIST); + uint32_t MSG_CODE_GET_USER_CERTIFICATE_INFO = static_cast( + CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_INFO); + uint32_t MSG_CODE_SET_USER_CERTIFICATE_STATUS = static_cast( + CertManagerInterfaceCode::CM_MSG_SET_USER_CERTIFICATE_STATUS); + uint32_t MSG_CODE_INSTALL_USER_CERTIFICATE = static_cast( + CertManagerInterfaceCode::CM_MSG_INSTALL_USER_CERTIFICATE); + uint32_t MSG_CODE_UNINSTALL_USER_CERTIFICATE = static_cast( + CertManagerInterfaceCode::CM_MSG_UNINSTALL_USER_CERTIFICATE); + uint32_t MSG_CODE_UNINSTALL_ALL_USER_CERTIFICATE = static_cast( + CertManagerInterfaceCode::CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE); /* new cmd type must be added before CM_MSG_MAX */ - uint32_t MSG_CODE_MAX = CM_MSG_MAX; + uint32_t MSG_CODE_MAX = static_cast(CertManagerInterfaceCode::CM_MSG_MAX); }; class CertManagerService : public SystemAbility, public IRemoteStub { diff --git a/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp b/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp index 23a4d68..07326c9 100644 --- a/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_ABORT, false, CmIpcServiceAbort)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_ABORT, false, CmIpcServiceAbort)) { return false; } diff --git a/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp b/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp index 4e6a996..a4ad856 100644 --- a/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_FINISH, false, CmIpcServiceFinish)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_FINISH, false, CmIpcServiceFinish)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp b/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp index 5b4d3f9..9cf0d78 100644 --- a/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_APP_CERTIFICATE, false, CmIpcServiceGetAppCert)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE, + false, CmIpcServiceGetAppCert)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp index 747db39..559445e 100644 --- a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_APP_CERTIFICATE_LIST, false, CmIpcServiceGetAppCertList)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE_LIST, + false, CmIpcServiceGetAppCertList)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp index 9222eb5..7355cd4 100644 --- a/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_AUTHED_LIST, false, CmIpcServiceGetAuthorizedAppList)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GET_AUTHED_LIST, + false, CmIpcServiceGetAuthorizedAppList)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp b/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp index d675a2f..bf7dea1 100644 --- a/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_CERTIFICATE_INFO, false, CmIpcServiceGetCertificateInfo)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_INFO, + false, CmIpcServiceGetCertificateInfo)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp index 07d2658..e1c2024 100644 --- a/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_CERTIFICATE_LIST, false, CmIpcServiceGetCertificateList)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_LIST, + false, CmIpcServiceGetCertificateList)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp b/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp index c1b68ec..1c9a19c 100644 --- a/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_USER_CERTIFICATE_INFO, + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_INFO, false, CmIpcServiceGetUserCertInfo)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp index 39cd98e..fb0ea01 100644 --- a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_USER_CERTIFICATE_LIST, + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_LIST, false, CmIpcServiceGetUserCertList)) { return false; } diff --git a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp index d19b674..eaefca3 100644 --- a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GRANT_APP_CERT, false, CmIpcServiceGrantAppCertificate)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_GRANT_APP_CERT, + false, CmIpcServiceGrantAppCertificate)) { return false; } diff --git a/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp b/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp index f2d71cd..64bcf11 100644 --- a/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_INIT, false, CmIpcServiceInit)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_INIT, false, CmIpcServiceInit)) { return false; } diff --git a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp index 30d4244..8e71d0a 100644 --- a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_INSTALL_APP_CERTIFICATE, false, CmIpcServiceInstallAppCert)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_INSTALL_APP_CERTIFICATE, + false, CmIpcServiceInstallAppCert)) { return false; } diff --git a/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp b/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp index d6efc15..8c89e41 100644 --- a/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_INSTALL_USER_CERTIFICATE, false, CmIpcServiceInstallUserCert)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_INSTALL_USER_CERTIFICATE, + false, CmIpcServiceInstallUserCert)) { return false; } diff --git a/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp b/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp index d483495..b5c997e 100644 --- a/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_CHECK_IS_AUTHED_APP, false, CmIpcServiceIsAuthorizedApp)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_CHECK_IS_AUTHED_APP, + false, CmIpcServiceIsAuthorizedApp)) { return false; } diff --git a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp index 0d3f8e3..643f17a 100644 --- a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_REMOVE_GRANT_APP, false, CmIpcServiceRemoveGrantedApp)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_REMOVE_GRANT_APP, + false, CmIpcServiceRemoveGrantedApp)) { return false; } diff --git a/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp b/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp index b1be26a..a948b99 100644 --- a/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp @@ -20,11 +20,13 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_SET_CERTIFICATE_STATUS, false, CmIpcServiceSetCertStatus)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_SET_CERTIFICATE_STATUS, + false, CmIpcServiceSetCertStatus)) { return false; } diff --git a/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp b/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp index 0215e1b..3f2149c 100644 --- a/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_SET_USER_CERTIFICATE_STATUS, + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_SET_USER_CERTIFICATE_STATUS, false, CmIpcServiceSetUserCertStatus)) { return false; } diff --git a/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp index 8f1cd8e..452c29c 100644 --- a/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_APP_CERTIFICATE, + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_UNINSTALL_APP_CERTIFICATE, false, CmIpcServiceUninstallAllAppCert)) { return false; } diff --git a/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp index 7d848a8..c43d97a 100644 --- a/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE, + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE, false, CmIpcServiceUninstallAllUserCert)) { return false; } diff --git a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp index 2ed14dd..e9c9f91 100644 --- a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_APP_CERTIFICATE, + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_UNINSTALL_APP_CERTIFICATE, false, CmIpcServiceUninstallAppCert)) { return false; } diff --git a/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp index e6894c4..38d6bd0 100644 --- a/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_USER_CERTIFICATE, + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_UNINSTALL_USER_CERTIFICATE, false, CmIpcServiceUninstallUserCert)) { return false; } diff --git a/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp b/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp index 8839132..3dba16f 100644 --- a/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp @@ -20,11 +20,12 @@ #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { CertmanagerTest::SetATPermission(); - if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UPDATE, false, CmIpcServiceUpdate)) { + if (!IpcServiceApiFuzzerTest(data, size, CertManagerInterfaceCode::CM_MSG_UPDATE, false, CmIpcServiceUpdate)) { return false; } diff --git a/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp b/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp index 680cbc0..f888e65 100644 --- a/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp +++ b/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp @@ -15,17 +15,17 @@ #include "cmsendrequest_fuzzer.h" -#include "cm_ipc_msg_code.h" #include "cm_fuzz_test_common.h" #include "cm_param.h" #include "cm_request.h" #include "cm_test_common.h" using namespace CmFuzzTest; +using namespace OHOS::Security::CertManager; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - uint32_t minSize = sizeof(enum CmMessage) + sizeof(struct CmParamSet) + sizeof(struct CmBlob); + uint32_t minSize = sizeof(CertManagerInterfaceCode) + sizeof(struct CmParamSet) + sizeof(struct CmBlob); uint8_t *myData = nullptr; if (!CopyMyData(data, size, minSize, &myData)) { return false; @@ -34,11 +34,12 @@ namespace OHOS { uint32_t remainSize = static_cast(size); uint32_t offset = 0; - enum CmMessage type; - (void)memcpy_s(&type, sizeof(enum CmMessage), myData, sizeof(enum CmMessage)); - type = static_cast( - static_cast(type) % static_cast(CM_MSG_MAX - CM_MSG_BASE) + - static_cast(CM_MSG_BASE)); + CertManagerInterfaceCode type; + (void)memcpy_s(&type, sizeof(CertManagerInterfaceCode), myData, sizeof(CertManagerInterfaceCode)); + type = static_cast(static_cast(type) % + (static_cast(CertManagerInterfaceCode::CM_MSG_MAX) - + static_cast(CertManagerInterfaceCode::CM_MSG_BASE)) + + static_cast(CertManagerInterfaceCode::CM_MSG_BASE)); offset += sizeof(uint32_t); remainSize -= sizeof(uint32_t); diff --git a/test/fuzz_test/fuzz_test_common/include/cm_fuzz_test_common.h b/test/fuzz_test/fuzz_test_common/include/cm_fuzz_test_common.h index d32010d..7e4752e 100644 --- a/test/fuzz_test/fuzz_test_common/include/cm_fuzz_test_common.h +++ b/test/fuzz_test/fuzz_test_common/include/cm_fuzz_test_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,7 +16,7 @@ #ifndef CM_FUZZ_TEST_COMMON_H #define CM_FUZZ_TEST_COMMON_H -#include "cm_ipc_msg_code.h" +#include "cert_manager_ipc_interface_code.h" #include "cm_mem.h" #include "cm_param.h" #include "cm_type.h" @@ -33,10 +33,11 @@ bool GetCertInfoFromBuffer(uint8_t *srcData, uint32_t *remSize, uint32_t *offset bool CopyMyData(const uint8_t *data, const size_t size, const uint32_t minSize, uint8_t **myData); -bool ConstructParamSet(uint8_t *srcData, uint32_t *remainSize, uint32_t *offset, enum CmMessage code, - struct CmParamSet **paramSetOut); +bool ConstructParamSet(uint8_t *srcData, uint32_t *remainSize, uint32_t *offset, + OHOS::Security::CertManager::CertManagerInterfaceCode code, struct CmParamSet **paramSetOut); -bool IpcServiceApiFuzzerTest(const uint8_t *data, const size_t size, enum CmMessage code, bool isParamsetToBlob, - void (*ipcServiceApi)(const struct CmBlob *, struct CmBlob *, const struct CmContext *)); +bool IpcServiceApiFuzzerTest(const uint8_t *data, const size_t size, + OHOS::Security::CertManager::CertManagerInterfaceCode code, + bool isParamsetToBlob, void (*ipcServiceApi)(const struct CmBlob *, struct CmBlob *, const struct CmContext *)); } // namespace CmFuzzTest #endif /* CM_FUZZ_TEST_COMMON_H */ diff --git a/test/fuzz_test/fuzz_test_common/src/cm_fuzz_test_common.cpp b/test/fuzz_test/fuzz_test_common/src/cm_fuzz_test_common.cpp index 3e7e17d..26e0d40 100644 --- a/test/fuzz_test/fuzz_test_common/src/cm_fuzz_test_common.cpp +++ b/test/fuzz_test/fuzz_test_common/src/cm_fuzz_test_common.cpp @@ -18,6 +18,8 @@ #include "cm_ipc_client_serialization.h" #include "message_parcel.h" +using namespace OHOS::Security::CertManager; + namespace CmFuzzTest { bool GetUintFromBuffer(uint8_t *srcData, uint32_t *remSize, uint32_t *offset, uint32_t *outVal) { @@ -102,26 +104,26 @@ constexpr uint32_t PARAM_COUNT_THREE = 3; constexpr uint32_t PARAM_COUNT_FOUR = 4; struct CmFuzzerCodeParams { - enum CmMessage code; + CertManagerInterfaceCode code; uint32_t paramCnt; struct CmParam params[PARAM_COUNT_FOUR]; }; constexpr struct CmFuzzerCodeParams g_codeParams[] = { - { CM_MSG_GET_CERTIFICATE_LIST, + { CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_LIST, PARAM_COUNT_ONE, { { .tag = CM_TAG_PARAM0_UINT32, .uint32Param = 0 } } }, - { CM_MSG_GET_CERTIFICATE_INFO, + { CertManagerInterfaceCode::CM_MSG_GET_CERTIFICATE_INFO, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM0_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_SET_CERTIFICATE_STATUS, + { CertManagerInterfaceCode::CM_MSG_SET_CERTIFICATE_STATUS, PARAM_COUNT_THREE, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, @@ -129,7 +131,7 @@ constexpr struct CmFuzzerCodeParams g_codeParams[] = { { .tag = CM_TAG_PARAM1_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_INSTALL_APP_CERTIFICATE, + { CertManagerInterfaceCode::CM_MSG_INSTALL_APP_CERTIFICATE, PARAM_COUNT_FOUR, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, @@ -138,98 +140,98 @@ constexpr struct CmFuzzerCodeParams g_codeParams[] = { { .tag = CM_TAG_PARAM3_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_UNINSTALL_APP_CERTIFICATE, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_APP_CERTIFICATE, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM0_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_UNINSTALL_ALL_APP_CERTIFICATE, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_ALL_APP_CERTIFICATE, 0, { } }, - { CM_MSG_GET_APP_CERTIFICATE_LIST, + { CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE_LIST, PARAM_COUNT_ONE, { { .tag = CM_TAG_PARAM0_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_GET_APP_CERTIFICATE, + { CertManagerInterfaceCode::CM_MSG_GET_APP_CERTIFICATE, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM0_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_GRANT_APP_CERT, + { CertManagerInterfaceCode::CM_MSG_GRANT_APP_CERT, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM1_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_GET_AUTHED_LIST, + { CertManagerInterfaceCode::CM_MSG_GET_AUTHED_LIST, PARAM_COUNT_ONE, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_CHECK_IS_AUTHED_APP, + { CertManagerInterfaceCode::CM_MSG_CHECK_IS_AUTHED_APP, PARAM_COUNT_ONE, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_REMOVE_GRANT_APP, + { CertManagerInterfaceCode::CM_MSG_REMOVE_GRANT_APP, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM1_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_INIT, + { CertManagerInterfaceCode::CM_MSG_INIT, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM1_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_UPDATE, + { CertManagerInterfaceCode::CM_MSG_UPDATE, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM1_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_FINISH, + { CertManagerInterfaceCode::CM_MSG_FINISH, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM1_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_ABORT, + { CertManagerInterfaceCode::CM_MSG_ABORT, PARAM_COUNT_ONE, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_GET_USER_CERTIFICATE_LIST, + { CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_LIST, PARAM_COUNT_ONE, { { .tag = CM_TAG_PARAM0_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_GET_USER_CERTIFICATE_INFO, + { CertManagerInterfaceCode::CM_MSG_GET_USER_CERTIFICATE_INFO, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM0_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_SET_USER_CERTIFICATE_STATUS, + { CertManagerInterfaceCode::CM_MSG_SET_USER_CERTIFICATE_STATUS, PARAM_COUNT_THREE, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, @@ -237,28 +239,28 @@ constexpr struct CmFuzzerCodeParams g_codeParams[] = { { .tag = CM_TAG_PARAM1_UINT32, .uint32Param = 0 }, } }, - { CM_MSG_INSTALL_USER_CERTIFICATE, + { CertManagerInterfaceCode::CM_MSG_INSTALL_USER_CERTIFICATE, PARAM_COUNT_TWO, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, { .tag = CM_TAG_PARAM1_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_UNINSTALL_USER_CERTIFICATE, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_USER_CERTIFICATE, PARAM_COUNT_ONE, { { .tag = CM_TAG_PARAM0_BUFFER, .blob = { 0, nullptr } }, } }, - { CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE, + { CertManagerInterfaceCode::CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE, 0, { } }, }; -bool ConstructParamSet(uint8_t *srcData, uint32_t *remainSize, uint32_t *offset, enum CmMessage code, - struct CmParamSet **paramSetOut) +bool ConstructParamSet(uint8_t *srcData, uint32_t *remainSize, + uint32_t *offset, CertManagerInterfaceCode code, struct CmParamSet **paramSetOut) { struct CmParam params[PARAM_COUNT_FOUR] = {}; uint32_t paramCnt = 0; @@ -302,8 +304,8 @@ bool ConstructParamSet(uint8_t *srcData, uint32_t *remainSize, uint32_t *offset, return true; } -bool IpcServiceApiFuzzerTest(const uint8_t *data, const size_t size, enum CmMessage code, bool isParamsetToBlob, - void (*ipcServiceApi)(const struct CmBlob *, struct CmBlob *, const struct CmContext *)) +bool IpcServiceApiFuzzerTest(const uint8_t *data, const size_t size, CertManagerInterfaceCode code, + bool isParamsetToBlob, void (*ipcServiceApi)(const struct CmBlob *, struct CmBlob *, const struct CmContext *)) { uint32_t minSize = sizeof(struct CmBlob) + sizeof(struct CmBlob); uint8_t *myData = nullptr; -- Gitee