From 7be72516609ff4eb824190ac72d85459f0d6886e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8A=E5=AE=98=E6=99=AF=E5=A8=81?= Date: Thu, 7 Nov 2024 15:02:20 +0800 Subject: [PATCH] =?UTF-8?q?SASDK=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 上官景威 --- bundle.json | 5 +- cert_manager.gni | 1 + .../main/common/BUILD.gn | 16 +- .../main/common/include/cm_log.h | 9 - .../main/os_dependency/BUILD.gn | 38 +--- .../cert_manager_standard/main/BUILD.gn | 18 +- interfaces/kits/cj/BUILD.gn | 18 +- interfaces/kits/napi/BUILD.gn | 35 +-- services/cert_manager_standard/BUILD.gn | 12 - .../cert_manager_engine/main/core/BUILD.gn | 21 +- .../cert_manager_engine/main/rdb/BUILD.gn | 16 +- .../main/hisysevent_wrapper/BUILD.gn | 22 +- .../main/os_dependency/BUILD.gn | 28 +-- .../main/os_dependency/idl/BUILD.gn | 27 +-- .../main/security_guard_report/BUILD.gn | 20 +- test/BUILD.gn | 16 +- test/fuzz_test/cmabort_fuzzer/BUILD.gn | 23 +- .../cmabort_fuzzer/cmabort_fuzzer.cpp | 3 +- test/fuzz_test/cmappcert_fuzzer/BUILD.gn | 29 +-- .../cmappcert_fuzzer/cmappcert_fuzzer.cpp | 7 +- test/fuzz_test/cmfinish_fuzzer/BUILD.gn | 23 +- .../cmfinish_fuzzer/cmfinish_fuzzer.cpp | 3 +- test/fuzz_test/cmgetappcert_fuzzer/BUILD.gn | 24 +- .../cmgetappcert_fuzzer.cpp | 3 +- .../cmgetappcertlist_fuzzer/BUILD.gn | 24 +- .../cmgetappcertlist_fuzzer.cpp | 3 +- .../cmgetauthorizedapplist_fuzzer/BUILD.gn | 24 +- .../cmgetauthorizedapplist_fuzzer.cpp | 3 +- test/fuzz_test/cmgetcertinfo_fuzzer/BUILD.gn | 24 +- .../cmgetcertinfo_fuzzer.cpp | 3 +- test/fuzz_test/cmgetcertlist_fuzzer/BUILD.gn | 24 +- .../cmgetcertlist_fuzzer.cpp | 3 +- .../cmgetusercertinfo_fuzzer/BUILD.gn | 24 +- .../cmgetusercertinfo_fuzzer.cpp | 3 +- .../cmgetusercertlist_fuzzer/BUILD.gn | 24 +- .../cmgetusercertlist_fuzzer.cpp | 3 +- .../cmgrantappcertificate_fuzzer/BUILD.gn | 24 +- .../cmgrantappcertificate_fuzzer.cpp | 3 +- test/fuzz_test/cminit_fuzzer/BUILD.gn | 23 +- .../fuzz_test/cminit_fuzzer/cminit_fuzzer.cpp | 3 +- .../cminstallappcert_fuzzer/BUILD.gn | 24 +- .../cminstallappcert_fuzzer.cpp | 3 +- .../cminstallusertrustedcert_fuzzer/BUILD.gn | 24 +- .../cminstallusertrustedcert_fuzzer.cpp | 3 +- .../cmipcserviceabort_fuzzer/BUILD.gn | 28 +-- .../cmipcserviceabort_fuzzer.cpp | 3 +- .../cmipcservicefinish_fuzzer/BUILD.gn | 28 +-- .../cmipcservicefinish_fuzzer.cpp | 3 +- .../cmipcservicegetappcert_fuzzer/BUILD.gn | 28 +-- .../cmipcservicegetappcert_fuzzer.cpp | 3 +- .../BUILD.gn | 27 +-- .../cmipcservicegetappcertlist_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- ...mipcservicegetauthorizedapplist_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcservicegetcertificateinfo_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcservicegetcertificatelist_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcservicegetusercertinfo_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcservicegetusercertlist_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- ...cmipcservicegrantappcertificate_fuzzer.cpp | 3 +- .../cmipcserviceinit_fuzzer/BUILD.gn | 28 +-- .../cmipcserviceinit_fuzzer.cpp | 3 +- .../BUILD.gn | 27 +-- .../cmipcserviceinstallappcert_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcserviceinstallusercert_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcserviceisauthorizedapp_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcserviceremovegrantedapp_fuzzer.cpp | 3 +- .../cmipcservicesetcertstatus_fuzzer/BUILD.gn | 28 +-- .../cmipcservicesetcertstatus_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcservicesetusercertstatus_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- ...cmipcserviceuninstallallappcert_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- ...mipcserviceuninstallallusercert_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcserviceuninstallappcert_fuzzer.cpp | 3 +- .../BUILD.gn | 28 +-- .../cmipcserviceuninstallusercert_fuzzer.cpp | 3 +- .../cmipcserviceupdate_fuzzer/BUILD.gn | 28 +-- .../cmipcserviceupdate_fuzzer.cpp | 3 +- .../cmisauthorizedapp_fuzzer/BUILD.gn | 24 +- .../cmisauthorizedapp_fuzzer.cpp | 3 +- .../cmonremoterequest_fuzzer/BUILD.gn | 29 +-- .../cmonremoterequest_fuzzer.cpp | 3 +- .../cmremovegrantedapp_fuzzer/BUILD.gn | 24 +- .../cmremovegrantedapp_fuzzer.cpp | 3 +- test/fuzz_test/cmsendrequest_fuzzer/BUILD.gn | 26 +-- .../cmsendrequest_fuzzer.cpp | 3 +- .../fuzz_test/cmsetcertstatus_fuzzer/BUILD.gn | 24 +- .../cmsetcertstatus_fuzzer.cpp | 3 +- .../cmsetusercertstatus_fuzzer/BUILD.gn | 24 +- .../cmsetusercertstatus_fuzzer.cpp | 3 +- .../cmsystemtrustedstore_fuzzer/BUILD.gn | 32 +-- .../cmsystemtrustedstore_fuzzer.cpp | 3 +- .../cmuninstallappcert_fuzzer/BUILD.gn | 24 +- .../cmuninstallappcert_fuzzer.cpp | 3 +- .../BUILD.gn | 23 +- .../cmuninstallusertrustedcert_fuzzer.cpp | 3 +- test/fuzz_test/cmupdate_fuzzer/BUILD.gn | 23 +- .../cmupdate_fuzzer/cmupdate_fuzzer.cpp | 3 +- .../cmusertrustedstore_fuzzer/BUILD.gn | 32 +-- .../cmusertrustedstore_fuzzer.cpp | 5 +- test/fuzz_test/fuzz_test_common/BUILD.gn | 22 +- .../include/cm_cert_data_rsa.h | 211 ++++++++++++++++++ .../include/cm_cert_data_user.h | 88 ++++++++ .../include/cm_fuzz_test_common.h | 2 + .../src/cm_fuzz_test_common.cpp | 39 ++++ test/unittest/common_permission_test/BUILD.gn | 11 +- test/unittest/inner_permission_test/BUILD.gn | 11 +- test/unittest/module_test/BUILD.gn | 11 +- test/unittest/multi_thread_test/BUILD.gn | 11 +- 119 files changed, 856 insertions(+), 1236 deletions(-) create mode 100644 test/fuzz_test/fuzz_test_common/include/cm_cert_data_rsa.h create mode 100644 test/fuzz_test/fuzz_test_common/include/cm_cert_data_user.h diff --git a/bundle.json b/bundle.json index df29991..38c19be 100644 --- a/bundle.json +++ b/bundle.json @@ -16,7 +16,7 @@ "component": { "name": "certificate_manager", "subsystem": "security", - "syscap": [ "SystemCapability.Security.CertificateManager" ], + "syscap": [ "SystemCapability.Security.CertificateManagerDialog, SystemCapability.Security.CertificateManager" ], "features": [ "certificate_manager_deps_huks_enabled", "certificate_manager_feature_ca_enabled", @@ -74,7 +74,8 @@ "name": "//base/security/certificate_manager/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", "header": { "header_files": [ - "cert_manager_api.h" + "cert_manager_api.h", + "cm_type.h" ], "header_base": "//base/security/certificate_manager/interfaces/innerkits/cert_manager_standard/main/include" } diff --git a/cert_manager.gni b/cert_manager.gni index 3ea04e4..b4c913a 100644 --- a/cert_manager.gni +++ b/cert_manager.gni @@ -13,6 +13,7 @@ use_crypto_lib = "openssl" non_rwlock_support = false +cert_manager_root_dir = "//base/security/certificate_manager" declare_args() { # depend on the definition of huks security level in base/security/huks/build/config.gni diff --git a/frameworks/cert_manager_standard/main/common/BUILD.gn b/frameworks/cert_manager_standard/main/common/BUILD.gn index 3ab84be..bcafd62 100644 --- a/frameworks/cert_manager_standard/main/common/BUILD.gn +++ b/frameworks/cert_manager_standard/main/common/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") config("cert_manager_config") { @@ -29,16 +30,11 @@ ohos_static_library("libcert_manager_common_standard_static") { integer_overflow = true ubsan = true } - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - ] + public_configs = [ ":cert_manager_config" ] # Share include files for other gn when deps. - include_dirs = - [ "../../../../interfaces/innerkits/cert_manager_standard/main/include" ] - + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] sources = [ "src/cm_advsecmode_check.c", "src/cm_param.c", @@ -53,10 +49,6 @@ ohos_static_library("libcert_manager_common_standard_static") { "init:libbegetutil", "openssl:libcrypto_shared", ] - cflags = [ - "-DHILOG_ENABLE", - "-Wall", - "-Werror", - ] + complete_static_lib = true } diff --git a/frameworks/cert_manager_standard/main/common/include/cm_log.h b/frameworks/cert_manager_standard/main/common/include/cm_log.h index a1df0da..0b591ef 100644 --- a/frameworks/cert_manager_standard/main/common/include/cm_log.h +++ b/frameworks/cert_manager_standard/main/common/include/cm_log.h @@ -22,12 +22,10 @@ extern "C" { #endif -#ifdef _CM_LOG_ENABLE_ #undef LOG_TAG #define LOG_TAG "CertManager" #undef LOG_DOMAIN #define LOG_DOMAIN 0xD002F09 /* CertManager's domain id */ -#endif enum CmLogLevel { CM_LOG_LEVEL_I, @@ -36,19 +34,12 @@ enum CmLogLevel { CM_LOG_LEVEL_D, }; -#ifdef _CM_LOG_ENABLE_ void CmLog(uint32_t logLevel, const char *funcName, uint32_t lineNo, const char *format, ...); #define CM_LOG_I(...) CmLog(CM_LOG_LEVEL_I, __func__, __LINE__, __VA_ARGS__) #define CM_LOG_W(...) CmLog(CM_LOG_LEVEL_W, __func__, __LINE__, __VA_ARGS__) #define CM_LOG_E(...) CmLog(CM_LOG_LEVEL_E, __func__, __LINE__, __VA_ARGS__) #define CM_LOG_D(...) CmLog(CM_LOG_LEVEL_D, __func__, __LINE__, __VA_ARGS__) -#else -#define CM_LOG_I(...) -#define CM_LOG_W(...) -#define CM_LOG_E(...) -#define CM_LOG_D(...) -#endif #ifdef __cplusplus } diff --git a/frameworks/cert_manager_standard/main/os_dependency/BUILD.gn b/frameworks/cert_manager_standard/main/os_dependency/BUILD.gn index 75b2cce..ffb8c41 100644 --- a/frameworks/cert_manager_standard/main/os_dependency/BUILD.gn +++ b/frameworks/cert_manager_standard/main/os_dependency/BUILD.gn @@ -11,16 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") -config("cert_manager_log_mem_config") { - include_dirs = [ "../common/include" ] -} - ohos_static_library("libcert_manager_log_mem_static") { subsystem_name = "security" part_name = "certificate_manager" - public_configs = [ ":cert_manager_log_mem_config" ] branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -30,26 +26,19 @@ ohos_static_library("libcert_manager_log_mem_static") { integer_overflow = true ubsan = true } - include_dirs = - [ "../../../../interfaces/innerkits/cert_manager_standard/main/include" ] - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - ] + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] + sources = [ "./log/cm_log.c", "./posix/cm_mem.c", ] + deps = [ "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static" ] external_deps = [ "c_utils:utils", "hilog:libhilog", ] - cflags = [ - "-DHILOG_ENABLE", - "-Wall", - "-Werror", - ] + complete_static_lib = true } @@ -70,18 +59,14 @@ ohos_static_library("libcert_manager_ipc_client_static") { integer_overflow = true ubsan = true } - include_dirs = - [ "../../../../interfaces/innerkits/cert_manager_standard/main/include" ] - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - ] + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] + sources = [ "./cm_ipc/src/cm_ipc_client.c", "./cm_ipc/src/cm_ipc_client_serialization.c", "./cm_ipc/src/cm_request.cpp", ] - deps = [ ":libcert_manager_log_mem_static" ] + deps = [ "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static" ] external_deps = [ "c_utils:utils", "hilog:libhilog", @@ -89,11 +74,6 @@ ohos_static_library("libcert_manager_ipc_client_static") { "openssl:libcrypto_shared", "samgr:samgr_proxy", ] - cflags_cc = [ - "-DHILOG_ENABLE", - "-Wall", - "-Werror", - ] - cflags = cflags_cc + complete_static_lib = true } diff --git a/interfaces/innerkits/cert_manager_standard/main/BUILD.gn b/interfaces/innerkits/cert_manager_standard/main/BUILD.gn index 0bb0511..ca8831c 100644 --- a/interfaces/innerkits/cert_manager_standard/main/BUILD.gn +++ b/interfaces/innerkits/cert_manager_standard/main/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") config("cert_manager_config") { @@ -29,26 +30,13 @@ if (os_level == "standard") { ubsan = true } subsystem_name = "security" - innerapi_tags = [ - "platformsdk", - "chipsetsdk", - ] + innerapi_tags = [ "sasdk" ] part_name = "certificate_manager" public_configs = [ ":cert_manager_config" ] - defines = [ - "L2_STANDARD", - "_HARDWARE_ROOT_KEY_", - "_CM_LOG_ENABLE_", - ] sources = [ "src/cert_manager_api.c" ] - cflags = [ - "-DHILOG_ENABLE", - "-Wall", - "-Werror", - ] - deps = [ "../../../../frameworks/cert_manager_standard/main:cert_manager_standard_frameworks" ] + deps = [ "${cert_manager_root_dir}/frameworks/cert_manager_standard/main:cert_manager_standard_frameworks" ] external_deps = [ "bounds_checking_function:libsec_shared", diff --git a/interfaces/kits/cj/BUILD.gn b/interfaces/kits/cj/BUILD.gn index e584858..4504648 100644 --- a/interfaces/kits/cj/BUILD.gn +++ b/interfaces/kits/cj/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") ohos_shared_library("cj_cert_manager_ffi") { @@ -23,24 +24,15 @@ ohos_shared_library("cj_cert_manager_ffi") { integer_overflow = true ubsan = true } - defines = [ - "L2_STANDARD", - "_HARDWARE_ROOT_KEY_", - "_CM_LOG_ENABLE_", - ] - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "include", - ] + include_dirs = [ "include" ] sources = [ "src/cj_cert_manager_ffi.c" ] - cflags_cc = [ - "-Wall", - "-Werror", + deps = [ + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - deps = [ "../../innerkits/cert_manager_standard/main:cert_manager_sdk" ] innerapi_tags = [ "platformsdk" ] subsystem_name = "security" diff --git a/interfaces/kits/napi/BUILD.gn b/interfaces/kits/napi/BUILD.gn index 52e4862..4515ec1 100644 --- a/interfaces/kits/napi/BUILD.gn +++ b/interfaces/kits/napi/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") ohos_shared_library("certmanager") { @@ -23,16 +24,8 @@ ohos_shared_library("certmanager") { integer_overflow = true ubsan = true } - defines = [ - "L2_STANDARD", - "_HARDWARE_ROOT_KEY_", - "_CM_LOG_ENABLE_", - ] - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "include", - ] + include_dirs = [ "include" ] sources = [ "src/cm_napi.cpp", @@ -58,11 +51,10 @@ ohos_shared_library("certmanager") { "c_utils:utils", "napi:ace_napi", ] - cflags_cc = [ - "-Wall", - "-Werror", + deps = [ + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - deps = [ "../../innerkits/cert_manager_standard/main:cert_manager_sdk" ] relative_install_dir = "module/security" subsystem_name = "security" @@ -79,16 +71,8 @@ ohos_shared_library("certmanagerdialog") { integer_overflow = true ubsan = true } - defines = [ - "L2_STANDARD", - "_HARDWARE_ROOT_KEY_", - "_CM_LOG_ENABLE_", - ] - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "include/dialog", - ] + include_dirs = [ "include/dialog" ] sources = [ "src/dialog/cm_napi_dialog.cpp", @@ -112,11 +96,10 @@ ohos_shared_library("certmanagerdialog") { "napi:ace_napi", "samgr:samgr_proxy", ] - cflags_cc = [ - "-Wall", - "-Werror", + deps = [ + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - deps = [ "../../innerkits/cert_manager_standard/main:cert_manager_sdk" ] relative_install_dir = "module/security" subsystem_name = "security" diff --git a/services/cert_manager_standard/BUILD.gn b/services/cert_manager_standard/BUILD.gn index f5f8f9b..95b2b08 100644 --- a/services/cert_manager_standard/BUILD.gn +++ b/services/cert_manager_standard/BUILD.gn @@ -40,21 +40,9 @@ ohos_shared_library("cert_manager_service") { } subsystem_name = "security" part_name = "certificate_manager" - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - ] - - if (certificate_manager_feature_ca_enabled == "false") { - defines += [ "CERTIFICATE_MANAGER_FEATURE_CA_DISABLED" ] - } - if (certificate_manager_feature_credential_enabled == "false") { - defines += [ "CERTIFICATE_MANAGER_FEATURE_CREDENTIAL_DISABLED" ] - } deps = [ ":cert_manager_service.rc", - "cert_manager_engine/main/core:cert_manager_engine_core_standard", "cert_manager_engine/main/rdb:libcert_manager_rdb_static", "cert_manager_service/main/os_dependency:libcert_manager_service_os_dependency_standard_static", ] diff --git a/services/cert_manager_standard/cert_manager_engine/main/core/BUILD.gn b/services/cert_manager_standard/cert_manager_engine/main/core/BUILD.gn index 4483755..3378e78 100644 --- a/services/cert_manager_standard/cert_manager_engine/main/core/BUILD.gn +++ b/services/cert_manager_standard/cert_manager_engine/main/core/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") config("cert_manager_engine_core_config") { @@ -30,19 +31,7 @@ ohos_static_library("cert_manager_engine_core_standard") { ubsan = true } - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - "OPENSSL_SUPPRESS_DEPRECATED", - ] - include_dirs = [ - "../rdb/include", - "../../../../../interfaces/innerkits/cert_manager_standard/main/include", - ] - cflags = [ - "-Wall", - "-Werror", - ] + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] sources = [ "src/cert_manager.c", "src/cert_manager_app_cert_process.c", @@ -68,8 +57,8 @@ ohos_static_library("cert_manager_engine_core_standard") { ] deps = [ - "../../../../../frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", - "../../../../../frameworks/cert_manager_standard/main/os_dependency:libcert_manager_log_mem_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_engine/main/rdb:libcert_manager_rdb_static", ] external_deps = [ "access_token:libaccesstoken_sdk", @@ -79,4 +68,6 @@ ohos_static_library("cert_manager_engine_core_standard") { "ipc:ipc_core", "openssl:libcrypto_shared", ] + + complete_static_lib = true } diff --git a/services/cert_manager_standard/cert_manager_engine/main/rdb/BUILD.gn b/services/cert_manager_standard/cert_manager_engine/main/rdb/BUILD.gn index 197beb8..16b2186 100644 --- a/services/cert_manager_standard/cert_manager_engine/main/rdb/BUILD.gn +++ b/services/cert_manager_standard/cert_manager_engine/main/rdb/BUILD.gn @@ -9,8 +9,9 @@ # 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. +# limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") config("cert_manager_config") { @@ -31,10 +32,7 @@ ohos_static_library("libcert_manager_rdb_static") { ubsan = true } - include_dirs = [ - "../../../../../frameworks/cert_manager_standard/main/common/include", - "../../../../../interfaces/innerkits/cert_manager_standard/main/include", - ] + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] sources = [ "src/cm_cert_property_rdb.cpp", @@ -42,18 +40,12 @@ ohos_static_library("libcert_manager_rdb_static") { "src/cm_rdb_open_callback.cpp", ] + deps = [ "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static" ] external_deps = [ "c_utils:utils", "hilog:libhilog", "relational_store:native_rdb", ] - defines = [ "_CM_LOG_ENABLE_" ] - - cflags_cc = [ - "-Wall", - "-Werror", - ] - cflags = cflags_cc complete_static_lib = true } diff --git a/services/cert_manager_standard/cert_manager_service/main/hisysevent_wrapper/BUILD.gn b/services/cert_manager_standard/cert_manager_service/main/hisysevent_wrapper/BUILD.gn index 8b4771a..cd003f7 100644 --- a/services/cert_manager_standard/cert_manager_service/main/hisysevent_wrapper/BUILD.gn +++ b/services/cert_manager_standard/cert_manager_service/main/hisysevent_wrapper/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") config("cert_manager_config") { @@ -30,26 +31,19 @@ ohos_static_library("libcert_manager_hisysevent_wrapper_static") { integer_overflow = true ubsan = true } - include_dirs = [ - "../../../../../frameworks/cert_manager_standard/main/common/include", - "../../../../../frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include", - "../../../../../services/cert_manager_standard/cert_manager_engine/main/core/include", - "../../../../../interfaces/innerkits/cert_manager_standard/main/include", - ] + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] sources = [ "src/cm_report_wrapper.c", "src/hisysevent_wrapper.cpp", ] - cflags = [ - "-Wall", - "-Werror", - ] - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", + deps = [ + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/os_dependency:libcert_manager_ipc_client_static", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_engine/main/core:cert_manager_engine_core_standard", ] external_deps = [ - "bounds_checking_function:libsec_static", + "bounds_checking_function:libsec_shared", "hisysevent:libhisysevent", ] + complete_static_lib = true } diff --git a/services/cert_manager_standard/cert_manager_service/main/os_dependency/BUILD.gn b/services/cert_manager_standard/cert_manager_service/main/os_dependency/BUILD.gn index cea010b..360953b 100644 --- a/services/cert_manager_standard/cert_manager_service/main/os_dependency/BUILD.gn +++ b/services/cert_manager_standard/cert_manager_service/main/os_dependency/BUILD.gn @@ -11,11 +11,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") +config("cert_manager_config") { + include_dirs = [ "sa" ] +} ohos_static_library("libcert_manager_service_os_dependency_standard_static") { subsystem_name = "security" part_name = "certificate_manager" + public_configs = [ ":cert_manager_config" ] branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -25,20 +30,12 @@ ohos_static_library("libcert_manager_service_os_dependency_standard_static") { integer_overflow = true ubsan = true } - include_dirs = [ - "../../../cert_manager_engine/main/core/include", - "../../../cert_manager_engine/main/rdb/include", - "../../../../../interfaces/innerkits/cert_manager_standard/main/include", - ] - - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - ] + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] sources = [ "sa/cm_sa.cpp" ] deps = [ - "../../../../../frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", - "../../../../../frameworks/cert_manager_standard/main/os_dependency:libcert_manager_log_mem_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_engine/main/core:cert_manager_engine_core_standard", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_engine/main/rdb:libcert_manager_rdb_static", "idl:libcm_service_idl_standard_static", ] @@ -53,7 +50,6 @@ ohos_static_library("libcert_manager_service_os_dependency_standard_static") { if (support_jsapi) { sources += [ "sa/cm_event_observer.cpp" ] - defines += [ "SUPPORT_COMMON_EVENT" ] external_deps += [ "ability_base:want", "bundle_framework:appexecfwk_base", @@ -61,11 +57,5 @@ ohos_static_library("libcert_manager_service_os_dependency_standard_static") { "os_account:os_account_innerkits", ] } - - cflags_cc = [ - "-Wall", - "-Werror", - ] - cflags = cflags_cc complete_static_lib = true } diff --git a/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/BUILD.gn b/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/BUILD.gn index 11fc83e..6760350 100644 --- a/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/BUILD.gn +++ b/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") config("cert_manager_config") { @@ -30,25 +31,19 @@ ohos_static_library("libcm_service_idl_standard_static") { integer_overflow = true ubsan = true } - include_dirs = [ - "../../../../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../../cert_manager_engine/main/core/include", - ] - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - ] + include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ] sources = [ "cm_ipc/cm_ipc_service.c", "cm_ipc/cm_ipc_service_serialization.c", "cm_ipc/cm_response.cpp", ] deps = [ - "../../../../../../frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", - "../../../../../../frameworks/cert_manager_standard/main/os_dependency:libcert_manager_log_mem_static", - "../../hisysevent_wrapper:libcert_manager_hisysevent_wrapper_static", - "../../security_guard_report:libcert_manager_sg_report_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_engine/main/core:cert_manager_engine_core_standard", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/hisysevent_wrapper:libcert_manager_hisysevent_wrapper_static", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/security_guard_report:libcert_manager_sg_report_static", ] + external_deps = [ "ability_base:want", "c_utils:utils", @@ -63,14 +58,6 @@ ohos_static_library("libcm_service_idl_standard_static") { "access_token:libaccesstoken_sdk", "os_account:os_account_innerkits", ] - defines += [] } - - cflags_cc = [ - "-DHILOG_ENABLE", - "-Wall", - "-Werror", - ] - cflags = cflags_cc complete_static_lib = true } diff --git a/services/cert_manager_standard/cert_manager_service/main/security_guard_report/BUILD.gn b/services/cert_manager_standard/cert_manager_service/main/security_guard_report/BUILD.gn index 3bdd81c..a02f80a 100644 --- a/services/cert_manager_standard/cert_manager_service/main/security_guard_report/BUILD.gn +++ b/services/cert_manager_standard/cert_manager_service/main/security_guard_report/BUILD.gn @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") -import("../../../../../cert_manager.gni") config("cert_manager_config") { include_dirs = [ "include" ] @@ -31,29 +31,23 @@ ohos_static_library("libcert_manager_sg_report_static") { integer_overflow = true ubsan = true } - include_dirs = [ - "../../../../../frameworks/cert_manager_standard/main/common/include", - "../../../../../interfaces/innerkits/cert_manager_standard/main/include", + + deps = [ + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - deps = [ "../../../../../frameworks/cert_manager_standard/main/os_dependency:libcert_manager_log_mem_static" ] sources = [ "src/cm_security_guard_info.c", "src/cm_security_guard_report.cpp", ] - cflags = [ - "-Wall", - "-Werror", - ] - defines = [ "_CM_LOG_ENABLE_" ] external_deps = [ - "bounds_checking_function:libsec_static", + "bounds_checking_function:libsec_shared", "c_utils:utils", "ipc:ipc_single", ] if (support_security_guard) { - cflags += [ "-DSUPPORT_SECURITY_GUARD" ] - cflags_cc = [ "-DSUPPORT_SECURITY_GUARD" ] external_deps += [ "security_guard:libsg_collect_sdk" ] } + complete_static_lib = true } diff --git a/test/BUILD.gn b/test/BUILD.gn index 2971cb9..347e284 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/test.gni") -import("../cert_manager.gni") module_output_path = "cert_manager_standard/cert_manager_standard_test" @@ -37,11 +37,6 @@ ohos_unittest("cm_sdk_test") { ] include_dirs = [ "unittest/include" ] - cflags_cc = [ - "-Wall", - "-Werror", - ] - cflags = cflags_cc branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -53,8 +48,8 @@ ohos_unittest("cm_sdk_test") { } deps = [ - "../frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", - "../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] external_deps = [ "access_token:libaccesstoken_sdk", @@ -66,11 +61,6 @@ ohos_unittest("cm_sdk_test") { "openssl:libcrypto_shared", ] resource_config_file = "./resource/certificate_manager/ohos_test.xml" - - defines = [] - if (certificate_manager_deps_huks_enabled == "software") { - defines += [ "DEPS_HKS_UNTRUSTED_RUNNING_ENV" ] - } } group("unittest") { diff --git a/test/fuzz_test/cmabort_fuzzer/BUILD.gn b/test/fuzz_test/cmabort_fuzzer/BUILD.gn index 621cb1a..74562f8 100644 --- a/test/fuzz_test/cmabort_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmabort_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,13 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmAbortFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmabort_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmabort_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmabort_fuzzer.cpp", - ] + sources = [ "cmabort_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmabort_fuzzer/cmabort_fuzzer.cpp b/test/fuzz_test/cmabort_fuzzer/cmabort_fuzzer.cpp index 45cd417..867a3e1 100644 --- a/test/fuzz_test/cmabort_fuzzer/cmabort_fuzzer.cpp +++ b/test/fuzz_test/cmabort_fuzzer/cmabort_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -37,7 +36,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmAbort(&abHandle); CmFree(myData); diff --git a/test/fuzz_test/cmappcert_fuzzer/BUILD.gn b/test/fuzz_test/cmappcert_fuzzer/BUILD.gn index c543c8f..be9b978 100644 --- a/test/fuzz_test/cmappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,16 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmappcert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmappcert_fuzzer.cpp", - ] + sources = [ "cmappcert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/os_dependency:libcert_manager_ipc_client_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmappcert_fuzzer/cmappcert_fuzzer.cpp b/test/fuzz_test/cmappcert_fuzzer/cmappcert_fuzzer.cpp index 7d92888..cab826b 100644 --- a/test/fuzz_test/cmappcert_fuzzer/cmappcert_fuzzer.cpp +++ b/test/fuzz_test/cmappcert_fuzzer/cmappcert_fuzzer.cpp @@ -16,15 +16,16 @@ #include "cmappcert_fuzzer.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" -#include "cm_cert_data_part1_rsa.h" +#include "cm_cert_data_rsa.h" #include "cm_ipc_client_serialization.h" #include "cm_ipc_service.h" #include "cm_param.h" #include "cert_manager_api.h" +#include "cm_type.h" using namespace CmFuzzTest; namespace OHOS { + constexpr uint32_t TEST_USERID = 100; constexpr uint32_t MIN_DATA_USE_TIME = 4; static bool InstallAppCert(uint8_t *tmpData, uint32_t *remainSize, uint32_t *offset, uint32_t store, struct CmBlob *keyUri) @@ -132,7 +133,7 @@ namespace OHOS { uint32_t remainSize = static_cast(size); uint32_t offset = 0; - CertmanagerTest::SetATPermission(); + SetATPermission(); uint32_t store; if (!GetUintFromBuffer(tmpData, &remainSize, &offset, &store)) { diff --git a/test/fuzz_test/cmfinish_fuzzer/BUILD.gn b/test/fuzz_test/cmfinish_fuzzer/BUILD.gn index 887fea7..6291ef6 100644 --- a/test/fuzz_test/cmfinish_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmfinish_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,13 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmFinishFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmfinish_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmfinish_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmfinish_fuzzer.cpp", - ] + sources = [ "cmfinish_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmfinish_fuzzer/cmfinish_fuzzer.cpp b/test/fuzz_test/cmfinish_fuzzer/cmfinish_fuzzer.cpp index 44e6575..85ceea3 100644 --- a/test/fuzz_test/cmfinish_fuzzer/cmfinish_fuzzer.cpp +++ b/test/fuzz_test/cmfinish_fuzzer/cmfinish_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -52,7 +51,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmFinish(&fiHandle, &inData, &outData); CmFree(myData); diff --git a/test/fuzz_test/cmgetappcert_fuzzer/BUILD.gn b/test/fuzz_test/cmgetappcert_fuzzer/BUILD.gn index c139702..29a7f01 100644 --- a/test/fuzz_test/cmgetappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgetappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGetAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgetappcert_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgetappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgetappcert_fuzzer.cpp", - ] + sources = [ "cmgetappcert_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp b/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp index 69cef83..96baf1b 100644 --- a/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp +++ b/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -58,7 +57,7 @@ namespace OHOS { } credCert.credData.data = const_cast(myData + offset); - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGetAppCert(&appCertUri, store, &credCert); CmFree(myData); diff --git a/test/fuzz_test/cmgetappcertlist_fuzzer/BUILD.gn b/test/fuzz_test/cmgetappcertlist_fuzzer/BUILD.gn index 3a480a1..04d65f4 100644 --- a/test/fuzz_test/cmgetappcertlist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgetappcertlist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGetAppCertListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgetappcertlist_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgetappcertlist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgetappcertlist_fuzzer.cpp", - ] + sources = [ "cmgetappcertlist_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp b/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp index 3f2420c..ae1b018 100644 --- a/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp +++ b/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -49,7 +48,7 @@ namespace OHOS { } credCertList.credentialAbstract = reinterpret_cast(myData + offset); - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGetAppCertList(credStore, &credCertList); CmFree(myData); diff --git a/test/fuzz_test/cmgetauthorizedapplist_fuzzer/BUILD.gn b/test/fuzz_test/cmgetauthorizedapplist_fuzzer/BUILD.gn index ad4eb9d..09b4e0a 100644 --- a/test/fuzz_test/cmgetauthorizedapplist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgetauthorizedapplist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGetAuthorizedAppListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgetauthorizedapplist_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgetauthorizedapplist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgetauthorizedapplist_fuzzer.cpp", - ] + sources = [ "cmgetauthorizedapplist_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgetauthorizedapplist_fuzzer/cmgetauthorizedapplist_fuzzer.cpp b/test/fuzz_test/cmgetauthorizedapplist_fuzzer/cmgetauthorizedapplist_fuzzer.cpp index 7389574..a2a4119 100644 --- a/test/fuzz_test/cmgetauthorizedapplist_fuzzer/cmgetauthorizedapplist_fuzzer.cpp +++ b/test/fuzz_test/cmgetauthorizedapplist_fuzzer/cmgetauthorizedapplist_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -49,7 +48,7 @@ namespace OHOS { } appUidList.appUid = reinterpret_cast(myData + offset); - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGetAuthorizedAppList(&authorUri, &appUidList); CmFree(myData); diff --git a/test/fuzz_test/cmgetcertinfo_fuzzer/BUILD.gn b/test/fuzz_test/cmgetcertinfo_fuzzer/BUILD.gn index 1eca440..d959161 100644 --- a/test/fuzz_test/cmgetcertinfo_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgetcertinfo_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGetCertInfoFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgetcertinfo_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgetcertinfo_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgetcertinfo_fuzzer.cpp", - ] + sources = [ "cmgetcertinfo_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgetcertinfo_fuzzer/cmgetcertinfo_fuzzer.cpp b/test/fuzz_test/cmgetcertinfo_fuzzer/cmgetcertinfo_fuzzer.cpp index 27b4d07..8dbee64 100644 --- a/test/fuzz_test/cmgetcertinfo_fuzzer/cmgetcertinfo_fuzzer.cpp +++ b/test/fuzz_test/cmgetcertinfo_fuzzer/cmgetcertinfo_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -49,7 +48,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGetCertInfo(&sysUri, store, &sysCertInfo); CmFree(myData); diff --git a/test/fuzz_test/cmgetcertlist_fuzzer/BUILD.gn b/test/fuzz_test/cmgetcertlist_fuzzer/BUILD.gn index 2ee2353..6560ac4 100644 --- a/test/fuzz_test/cmgetcertlist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgetcertlist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGetCertListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgetcertlist_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgetcertlist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgetcertlist_fuzzer.cpp", - ] + sources = [ "cmgetcertlist_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgetcertlist_fuzzer/cmgetcertlist_fuzzer.cpp b/test/fuzz_test/cmgetcertlist_fuzzer/cmgetcertlist_fuzzer.cpp index 58cc6bb..bdeb3fb 100644 --- a/test/fuzz_test/cmgetcertlist_fuzzer/cmgetcertlist_fuzzer.cpp +++ b/test/fuzz_test/cmgetcertlist_fuzzer/cmgetcertlist_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -43,7 +42,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGetCertList(sysStore, &sysCertList); CmFree(myData); diff --git a/test/fuzz_test/cmgetusercertinfo_fuzzer/BUILD.gn b/test/fuzz_test/cmgetusercertinfo_fuzzer/BUILD.gn index ef10dde..b1b05a9 100644 --- a/test/fuzz_test/cmgetusercertinfo_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgetusercertinfo_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGetUserCertInfoFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgetusercertinfo_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgetusercertinfo_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgetusercertinfo_fuzzer.cpp", - ] + sources = [ "cmgetusercertinfo_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgetusercertinfo_fuzzer/cmgetusercertinfo_fuzzer.cpp b/test/fuzz_test/cmgetusercertinfo_fuzzer/cmgetusercertinfo_fuzzer.cpp index e5ab2d5..6d8b304 100644 --- a/test/fuzz_test/cmgetusercertinfo_fuzzer/cmgetusercertinfo_fuzzer.cpp +++ b/test/fuzz_test/cmgetusercertinfo_fuzzer/cmgetusercertinfo_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -50,7 +49,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGetUserCertInfo(&userCertUri, store, &userCertInfo); CmFree(myData); diff --git a/test/fuzz_test/cmgetusercertlist_fuzzer/BUILD.gn b/test/fuzz_test/cmgetusercertlist_fuzzer/BUILD.gn index e9af46e..81bc7e0 100644 --- a/test/fuzz_test/cmgetusercertlist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgetusercertlist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGetUserCertListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgetusercertlist_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgetusercertlist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgetusercertlist_fuzzer.cpp", - ] + sources = [ "cmgetusercertlist_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp b/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp index 7b38d51..a015bf4 100644 --- a/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp +++ b/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -44,7 +43,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGetUserCertList(userStore, &userCertList); CmFree(myData); diff --git a/test/fuzz_test/cmgrantappcertificate_fuzzer/BUILD.gn b/test/fuzz_test/cmgrantappcertificate_fuzzer/BUILD.gn index c393ac3..79bdfd8 100644 --- a/test/fuzz_test/cmgrantappcertificate_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmgrantappcertificate_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmGrantAppCertificateFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmgrantappcertificate_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmgrantappcertificate_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmgrantappcertificate_fuzzer.cpp", - ] + sources = [ "cmgrantappcertificate_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp b/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp index fceeb59..e716e1b 100644 --- a/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp +++ b/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -50,7 +49,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmGrantAppCertificate(&keyUri, appUid, &authUri); CmFree(myData); diff --git a/test/fuzz_test/cminit_fuzzer/BUILD.gn b/test/fuzz_test/cminit_fuzzer/BUILD.gn index 2347e5a..9101626 100644 --- a/test/fuzz_test/cminit_fuzzer/BUILD.gn +++ b/test/fuzz_test/cminit_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,13 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmInitFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cminit_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cminit_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cminit_fuzzer.cpp", - ] + sources = [ "cminit_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cminit_fuzzer/cminit_fuzzer.cpp b/test/fuzz_test/cminit_fuzzer/cminit_fuzzer.cpp index d653e18..36e85ce 100644 --- a/test/fuzz_test/cminit_fuzzer/cminit_fuzzer.cpp +++ b/test/fuzz_test/cminit_fuzzer/cminit_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -55,7 +54,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmInit(&authUri, &spec, &handle); CmFree(myData); diff --git a/test/fuzz_test/cminstallappcert_fuzzer/BUILD.gn b/test/fuzz_test/cminstallappcert_fuzzer/BUILD.gn index 499f5cd..253c543 100644 --- a/test/fuzz_test/cminstallappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cminstallappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmInstallAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cminstallappcert_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cminstallappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cminstallappcert_fuzzer.cpp", - ] + sources = [ "cminstallappcert_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp b/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp index 09affe1..4903608 100644 --- a/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -64,7 +63,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmInstallAppCert(&appCert, &appCertPwd, &certAlias, store, &keyUri); CmFree(myData); diff --git a/test/fuzz_test/cminstallusertrustedcert_fuzzer/BUILD.gn b/test/fuzz_test/cminstallusertrustedcert_fuzzer/BUILD.gn index 6869baa..458ce3d 100644 --- a/test/fuzz_test/cminstallusertrustedcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cminstallusertrustedcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmInstallUserTrustedCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cminstallusertrustedcert_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cminstallusertrustedcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cminstallusertrustedcert_fuzzer.cpp", - ] + sources = [ "cminstallusertrustedcert_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cminstallusertrustedcert_fuzzer/cminstallusertrustedcert_fuzzer.cpp b/test/fuzz_test/cminstallusertrustedcert_fuzzer/cminstallusertrustedcert_fuzzer.cpp index 0ab3eb0..1198f27 100644 --- a/test/fuzz_test/cminstallusertrustedcert_fuzzer/cminstallusertrustedcert_fuzzer.cpp +++ b/test/fuzz_test/cminstallusertrustedcert_fuzzer/cminstallusertrustedcert_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -51,7 +50,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmInstallUserTrustedCert(&userCert, &certAlias, &certUri); CmFree(myData); diff --git a/test/fuzz_test/cmipcserviceabort_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceabort_fuzzer/BUILD.gn index 1379e0a..dc25c98 100644 --- a/test/fuzz_test/cmipcserviceabort_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceabort_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,16 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceAbortFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcserviceabort_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceabort_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceabort_fuzzer.cpp", - ] + sources = [ "cmipcserviceabort_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp b/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp index 23a4d68..23aa999 100644 --- a/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceabort_fuzzer/cmipcserviceabort_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_ABORT, false, CmIpcServiceAbort)) { return false; } diff --git a/test/fuzz_test/cmipcservicefinish_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicefinish_fuzzer/BUILD.gn index 0e4d8ce..ee3f5b0 100644 --- a/test/fuzz_test/cmipcservicefinish_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicefinish_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,16 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceFinishFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcservicefinish_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmipcservicefinish_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicefinish_fuzzer.cpp", - ] + sources = [ "cmipcservicefinish_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp b/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp index 4e6a996..85009c2 100644 --- a/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicefinish_fuzzer/cmipcservicefinish_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_FINISH, false, CmIpcServiceFinish)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetappcert_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegetappcert_fuzzer/BUILD.gn index 1c3b59e..afabac0 100644 --- a/test/fuzz_test/cmipcservicegetappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegetappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,16 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGetAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcservicegetappcert_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegetappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegetappcert_fuzzer.cpp", - ] + sources = [ "cmipcservicegetappcert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp b/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp index a63da8c..dcbc70b 100644 --- a/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_APP_CERTIFICATE, false, CmIpcServiceGetAppCert)) { return false; diff --git a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/BUILD.gn index 05892f6..1b508cd 100644 --- a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGetAppCertListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcservicegetappcertlist_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegetappcertlist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegetappcertlist_fuzzer.cpp", - ] + sources = [ "cmipcservicegetappcertlist_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp index 694297d..9fbbdbd 100644 --- a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_APP_CERTIFICATE_LIST, false, CmIpcServiceGetAppCertList)) { return false; diff --git a/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/BUILD.gn index 5ff93db..f257f88 100644 --- a/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGetAuthorizedAppListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegetauthorizedapplist_fuzzer.cpp", - ] + sources = [ "cmipcservicegetauthorizedapplist_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp index 19add54..a84f7fe 100644 --- a/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetauthorizedapplist_fuzzer/cmipcservicegetauthorizedapplist_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_AUTHED_LIST, false, CmIpcServiceGetAuthorizedAppList)) { return false; diff --git a/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/BUILD.gn index e650f41..c11986b 100644 --- a/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGetCertificateInfoFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegetcertificateinfo_fuzzer.cpp", - ] + sources = [ "cmipcservicegetcertificateinfo_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp b/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp index 233c655..9ba32af 100644 --- a/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetcertificateinfo_fuzzer/cmipcservicegetcertificateinfo_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_CERTIFICATE_INFO, false, CmIpcServiceGetCertificateInfo)) { return false; diff --git a/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/BUILD.gn index 1e6fcbe..f74b441 100644 --- a/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGetCertificateListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcservicegetcertificatelist_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegetcertificatelist_fuzzer.cpp", - ] + sources = [ "cmipcservicegetcertificatelist_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp index 1172313..d97b49b 100644 --- a/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetcertificatelist_fuzzer/cmipcservicegetcertificatelist_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_CERTIFICATE_LIST, false, CmIpcServiceGetCertificateList)) { return false; diff --git a/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/BUILD.gn index 80ab69b..c6274a1 100644 --- a/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGetUserCertInfoFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcservicegetusercertinfo_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegetusercertinfo_fuzzer.cpp", - ] + sources = [ "cmipcservicegetusercertinfo_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp b/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp index c1b68ec..d9e4d3b 100644 --- a/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetusercertinfo_fuzzer/cmipcservicegetusercertinfo_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_USER_CERTIFICATE_INFO, false, CmIpcServiceGetUserCertInfo)) { return false; diff --git a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/BUILD.gn index 4694b79..6d3ecb4 100644 --- a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGetUserCertListFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcservicegetusercertlist_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegetusercertlist_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegetusercertlist_fuzzer.cpp", - ] + sources = [ "cmipcservicegetusercertlist_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp index 39cd98e..182bd4b 100644 --- a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_USER_CERTIFICATE_LIST, false, CmIpcServiceGetUserCertList)) { return false; diff --git a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/BUILD.gn index e3b641d..1f46227 100644 --- a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceGrantAppCertificateFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcservicegrantappcertificate_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicegrantappcertificate_fuzzer.cpp", - ] + sources = [ "cmipcservicegrantappcertificate_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp index 1cbb366..ca3e658 100644 --- a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GRANT_APP_CERT, false, CmIpcServiceGrantAppCertificate)) { return false; diff --git a/test/fuzz_test/cmipcserviceinit_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceinit_fuzzer/BUILD.gn index adfae01..f897f80 100644 --- a/test/fuzz_test/cmipcserviceinit_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceinit_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,16 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceInitFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcserviceinit_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceinit_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceinit_fuzzer.cpp", - ] + sources = [ "cmipcserviceinit_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp b/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp index f2d71cd..6194d7a 100644 --- a/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceinit_fuzzer/cmipcserviceinit_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_INIT, false, CmIpcServiceInit)) { return false; } diff --git a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/BUILD.gn index fbb5ea9..4b80b7e 100644 --- a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceInstallAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcserviceinstallappcert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceinstallappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceinstallappcert_fuzzer.cpp", - ] + sources = [ "cmipcserviceinstallappcert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp index 507c3c8..81e063d 100644 --- a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_INSTALL_APP_CERTIFICATE, false, CmIpcServiceInstallAppCert)) { return false; diff --git a/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/BUILD.gn index 227cb0a..7477412 100644 --- a/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceInstallUserCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcserviceinstallusercert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceinstallusercert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceinstallusercert_fuzzer.cpp", - ] + sources = [ "cmipcserviceinstallusercert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp b/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp index 16f6067..116aacd 100644 --- a/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceinstallusercert_fuzzer/cmipcserviceinstallusercert_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_INSTALL_USER_CERTIFICATE, false, CmIpcServiceInstallUserCert)) { return false; diff --git a/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/BUILD.gn index 95c1a46..14de7a2 100644 --- a/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceIsAuthorizedAppFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceisauthorizedapp_fuzzer.cpp", - ] + sources = [ "cmipcserviceisauthorizedapp_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp b/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp index d9f4c23..c8c6732 100644 --- a/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceisauthorizedapp_fuzzer/cmipcserviceisauthorizedapp_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_CHECK_IS_AUTHED_APP, false, CmIpcServiceIsAuthorizedApp)) { return false; diff --git a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/BUILD.gn index 040cba6..f2385d0 100644 --- a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceRemoveGrantedAppFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceremovegrantedapp_fuzzer.cpp", - ] + sources = [ "cmipcserviceremovegrantedapp_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp index 3504031..7ed5bba 100644 --- a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_REMOVE_GRANT_APP, false, CmIpcServiceRemoveGrantedApp)) { return false; diff --git a/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/BUILD.gn index 3c15213..416824f 100644 --- a/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,16 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceSetCertStatusFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcservicesetcertstatus_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmipcservicesetcertstatus_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicesetcertstatus_fuzzer.cpp", - ] + sources = [ "cmipcservicesetcertstatus_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp b/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp index 436b3b8..26c2b54 100644 --- a/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicesetcertstatus_fuzzer/cmipcservicesetcertstatus_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_SET_CERTIFICATE_STATUS, false, CmIpcServiceSetCertStatus)) { return false; diff --git a/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/BUILD.gn b/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/BUILD.gn index 754a542..4e2142c 100644 --- a/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceSetUserCertStatusFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcservicesetusercertstatus_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcservicesetusercertstatus_fuzzer.cpp", - ] + sources = [ "cmipcservicesetusercertstatus_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp b/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp index 0215e1b..ca4e318 100644 --- a/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicesetusercertstatus_fuzzer/cmipcservicesetusercertstatus_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_SET_USER_CERTIFICATE_STATUS, false, CmIpcServiceSetUserCertStatus)) { return false; diff --git a/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/BUILD.gn index 4649726..2b7fb49 100644 --- a/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceUninstallAllAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceuninstallallappcert_fuzzer.cpp", - ] + sources = [ "cmipcserviceuninstallallappcert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp index 8f1cd8e..99802a5 100644 --- a/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallallappcert_fuzzer/cmipcserviceuninstallallappcert_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_APP_CERTIFICATE, false, CmIpcServiceUninstallAllAppCert)) { return false; diff --git a/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/BUILD.gn index aa3c1c1..72bbe41 100644 --- a/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceUninstallAllUserCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceuninstallallusercert_fuzzer.cpp", - ] + sources = [ "cmipcserviceuninstallallusercert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp index 7d848a8..8ee5260 100644 --- a/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallallusercert_fuzzer/cmipcserviceuninstallallusercert_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_ALL_USER_CERTIFICATE, false, CmIpcServiceUninstallAllUserCert)) { return false; diff --git a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/BUILD.gn index ca57b48..6a52b1e 100644 --- a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceUninstallAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcserviceuninstallappcert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceuninstallappcert_fuzzer.cpp", - ] + sources = [ "cmipcserviceuninstallappcert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp index 2ed14dd..7392c9a 100644 --- a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_APP_CERTIFICATE, false, CmIpcServiceUninstallAppCert)) { return false; diff --git a/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/BUILD.gn index 991f301..84afa3c 100644 --- a/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,28 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceUninstallUserCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = - "../../../test/fuzz_test/cmipcserviceuninstallusercert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceuninstallusercert_fuzzer.cpp", - ] + sources = [ "cmipcserviceuninstallusercert_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp index e6894c4..7da8988 100644 --- a/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallusercert_fuzzer/cmipcserviceuninstallusercert_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_USER_CERTIFICATE, false, CmIpcServiceUninstallUserCert)) { return false; diff --git a/test/fuzz_test/cmipcserviceupdate_fuzzer/BUILD.gn b/test/fuzz_test/cmipcserviceupdate_fuzzer/BUILD.gn index 7f3f75d..8c1af9e 100644 --- a/test/fuzz_test/cmipcserviceupdate_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmipcserviceupdate_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,16 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIpcServiceUpdateFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmipcserviceupdate_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmipcserviceupdate_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmipcserviceupdate_fuzzer.cpp", - ] + sources = [ "cmipcserviceupdate_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp b/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp index 8839132..971ee9b 100644 --- a/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceupdate_fuzzer/cmipcserviceupdate_fuzzer.cpp @@ -17,13 +17,12 @@ #include "cm_fuzz_test_common.h" #include "cm_ipc_service.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { - CertmanagerTest::SetATPermission(); + SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UPDATE, false, CmIpcServiceUpdate)) { return false; } diff --git a/test/fuzz_test/cmisauthorizedapp_fuzzer/BUILD.gn b/test/fuzz_test/cmisauthorizedapp_fuzzer/BUILD.gn index 8d9e56e..7d29953 100644 --- a/test/fuzz_test/cmisauthorizedapp_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmisauthorizedapp_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmIsAuthorizedAppFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmisauthorizedapp_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmisauthorizedapp_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmisauthorizedapp_fuzzer.cpp", - ] + sources = [ "cmisauthorizedapp_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmisauthorizedapp_fuzzer/cmisauthorizedapp_fuzzer.cpp b/test/fuzz_test/cmisauthorizedapp_fuzzer/cmisauthorizedapp_fuzzer.cpp index c40cd54..6c6e422 100644 --- a/test/fuzz_test/cmisauthorizedapp_fuzzer/cmisauthorizedapp_fuzzer.cpp +++ b/test/fuzz_test/cmisauthorizedapp_fuzzer/cmisauthorizedapp_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -38,7 +37,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmIsAuthorizedApp(&authAppUri); CmFree(myData); diff --git a/test/fuzz_test/cmonremoterequest_fuzzer/BUILD.gn b/test/fuzz_test/cmonremoterequest_fuzzer/BUILD.gn index 4c483f9..92c8e3c 100755 --- a/test/fuzz_test/cmonremoterequest_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmonremoterequest_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,27 +20,17 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmOnRemoteRequestFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmonremoterequest_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmonremoterequest_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/sa", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmonremoterequest_fuzzer.cpp", - ] + sources = [ "cmonremoterequest_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency:libcert_manager_service_os_dependency_standard_static", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmonremoterequest_fuzzer/cmonremoterequest_fuzzer.cpp b/test/fuzz_test/cmonremoterequest_fuzzer/cmonremoterequest_fuzzer.cpp index 083d95c..d5699b7 100755 --- a/test/fuzz_test/cmonremoterequest_fuzzer/cmonremoterequest_fuzzer.cpp +++ b/test/fuzz_test/cmonremoterequest_fuzzer/cmonremoterequest_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cm_fuzz_test_common.h" #include "cm_sa.h" -#include "cm_test_common.h" #include "message_option.h" #include "message_parcel.h" @@ -67,7 +66,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - CertmanagerTest::SetATPermission(); + SetATPermission(); SystemAbilityOnDemandReason reason; (void)myService.OnStart(reason); (void)myService.OnRemoteRequest(code, messageData, reply, option); diff --git a/test/fuzz_test/cmremovegrantedapp_fuzzer/BUILD.gn b/test/fuzz_test/cmremovegrantedapp_fuzzer/BUILD.gn index 37a5baa..e772580 100644 --- a/test/fuzz_test/cmremovegrantedapp_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmremovegrantedapp_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -20,25 +21,14 @@ module_output_path = "certificate_manager/certificate_manager" ohos_fuzztest("CmRemoveGrantedAppFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmremovegrantedapp_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmremovegrantedapp_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmremovegrantedapp_fuzzer.cpp", - ] + sources = [ "cmremovegrantedapp_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp b/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp index bcf1d8b..5fe5a71 100644 --- a/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp +++ b/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -44,7 +43,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmRemoveGrantedApp(&grantKeyUri, appUid); CmFree(myData); diff --git a/test/fuzz_test/cmsendrequest_fuzzer/BUILD.gn b/test/fuzz_test/cmsendrequest_fuzzer/BUILD.gn index c3cbc32..a341807 100644 --- a/test/fuzz_test/cmsendrequest_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmsendrequest_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,26 +20,15 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmSendRequestFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmsendrequest_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmsendrequest_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include/", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmsendrequest_fuzzer.cpp", - ] + sources = [ "cmsendrequest_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/os_dependency:libcert_manager_ipc_client_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp b/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp index af35186..0d427cf 100644 --- a/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp +++ b/test/fuzz_test/cmsendrequest_fuzzer/cmsendrequest_fuzzer.cpp @@ -18,7 +18,6 @@ #include "cm_fuzz_test_common.h" #include "cm_param.h" #include "cm_request.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -56,7 +55,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)SendRequest(type, &inBlob, &outBlob); CmFree(myData); diff --git a/test/fuzz_test/cmsetcertstatus_fuzzer/BUILD.gn b/test/fuzz_test/cmsetcertstatus_fuzzer/BUILD.gn index 4d2c36e..9b4e274 100644 --- a/test/fuzz_test/cmsetcertstatus_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmsetcertstatus_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmSetCertStatusFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmsetcertstatus_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmsetcertstatus_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmsetcertstatus_fuzzer.cpp", - ] + sources = [ "cmsetcertstatus_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmsetcertstatus_fuzzer/cmsetcertstatus_fuzzer.cpp b/test/fuzz_test/cmsetcertstatus_fuzzer/cmsetcertstatus_fuzzer.cpp index 2089560..c473980 100644 --- a/test/fuzz_test/cmsetcertstatus_fuzzer/cmsetcertstatus_fuzzer.cpp +++ b/test/fuzz_test/cmsetcertstatus_fuzzer/cmsetcertstatus_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -51,7 +50,7 @@ namespace OHOS { bool status; (void)memcpy_s(&status, sizeof(bool), myData + offset, sizeof(bool)); - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmSetCertStatus(&sysCertUri, store, status); CmFree(myData); return true; diff --git a/test/fuzz_test/cmsetusercertstatus_fuzzer/BUILD.gn b/test/fuzz_test/cmsetusercertstatus_fuzzer/BUILD.gn index 5903102..3c0088e 100644 --- a/test/fuzz_test/cmsetusercertstatus_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmsetusercertstatus_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmSetUserCertStatusFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmsetusercertstatus_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmsetusercertstatus_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmsetusercertstatus_fuzzer.cpp", - ] + sources = [ "cmsetusercertstatus_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmsetusercertstatus_fuzzer/cmsetusercertstatus_fuzzer.cpp b/test/fuzz_test/cmsetusercertstatus_fuzzer/cmsetusercertstatus_fuzzer.cpp index e281dc7..e3abd20 100644 --- a/test/fuzz_test/cmsetusercertstatus_fuzzer/cmsetusercertstatus_fuzzer.cpp +++ b/test/fuzz_test/cmsetusercertstatus_fuzzer/cmsetusercertstatus_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -51,7 +50,7 @@ namespace OHOS { bool status; (void)memcpy_s(&status, sizeof(bool), myData + offset, sizeof(bool)); - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmSetUserCertStatus(&setUserUri, userStore, status); CmFree(myData); diff --git a/test/fuzz_test/cmsystemtrustedstore_fuzzer/BUILD.gn b/test/fuzz_test/cmsystemtrustedstore_fuzzer/BUILD.gn index 0393c2a..c747bd6 100644 --- a/test/fuzz_test/cmsystemtrustedstore_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmsystemtrustedstore_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,29 +20,18 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmSystemTrustedStoreFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmsystemtrustedstore_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmsystemtrustedstore_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../services/cert_manager_standard/cert_manager_engine/main/core/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmsystemtrustedstore_fuzzer.cpp", - ] + sources = [ "cmsystemtrustedstore_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/os_dependency:libcert_manager_ipc_client_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_engine/main/core:cert_manager_engine_core_standard", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmsystemtrustedstore_fuzzer/cmsystemtrustedstore_fuzzer.cpp b/test/fuzz_test/cmsystemtrustedstore_fuzzer/cmsystemtrustedstore_fuzzer.cpp index 900e07b..5954ad6 100644 --- a/test/fuzz_test/cmsystemtrustedstore_fuzzer/cmsystemtrustedstore_fuzzer.cpp +++ b/test/fuzz_test/cmsystemtrustedstore_fuzzer/cmsystemtrustedstore_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cm_fuzz_test_common.h" #include "cert_manager_api.h" -#include "cm_test_common.h" #include "cm_ipc_client_serialization.h" #include "cm_ipc_service.h" #include "cm_param.h" @@ -137,7 +136,7 @@ namespace OHOS { uint32_t remainSize = static_cast(size); uint32_t offset = 0; - CertmanagerTest::SetATPermission(); + SetATPermission(); bool ret = false; uint8_t keyUriData[] = "1d3472b9.0"; diff --git a/test/fuzz_test/cmuninstallappcert_fuzzer/BUILD.gn b/test/fuzz_test/cmuninstallappcert_fuzzer/BUILD.gn index 0ebf1a0..5566b66 100644 --- a/test/fuzz_test/cmuninstallappcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmuninstallappcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,14 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmUninstallAppCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmuninstallappcert_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmuninstallappcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmuninstallappcert_fuzzer.cpp", - ] + sources = [ "cmuninstallappcert_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp b/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp index 5467aad..aecdd9c 100644 --- a/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -44,7 +43,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmUninstallAppCert(&rmKeyUri, store); CmFree(myData); diff --git a/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/BUILD.gn b/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/BUILD.gn index b54b682..a140027 100644 --- a/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,13 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmUninstallUserTrustedCertFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmuninstallusertrustedcert_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmuninstallusertrustedcert_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmuninstallusertrustedcert_fuzzer.cpp", - ] + sources = [ "cmuninstallusertrustedcert_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/cmuninstallusertrustedcert_fuzzer.cpp b/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/cmuninstallusertrustedcert_fuzzer.cpp index be583d8..5b05598 100644 --- a/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/cmuninstallusertrustedcert_fuzzer.cpp +++ b/test/fuzz_test/cmuninstallusertrustedcert_fuzzer/cmuninstallusertrustedcert_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -37,7 +36,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmUninstallUserTrustedCert(&rmUserUri); CmFree(myData); return true; diff --git a/test/fuzz_test/cmupdate_fuzzer/BUILD.gn b/test/fuzz_test/cmupdate_fuzzer/BUILD.gn index 58af3ed..2e6fa41 100644 --- a/test/fuzz_test/cmupdate_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmupdate_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,25 +20,13 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmUpdateFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmupdate_fuzzer" + fuzz_config_file = "${cert_manager_root_dir}/test/fuzz_test/cmupdate_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmupdate_fuzzer.cpp", - ] + sources = [ "cmupdate_fuzzer.cpp" ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmupdate_fuzzer/cmupdate_fuzzer.cpp b/test/fuzz_test/cmupdate_fuzzer/cmupdate_fuzzer.cpp index 8ccdb12..34a5c07 100644 --- a/test/fuzz_test/cmupdate_fuzzer/cmupdate_fuzzer.cpp +++ b/test/fuzz_test/cmupdate_fuzzer/cmupdate_fuzzer.cpp @@ -17,7 +17,6 @@ #include "cert_manager_api.h" #include "cm_fuzz_test_common.h" -#include "cm_test_common.h" using namespace CmFuzzTest; namespace OHOS { @@ -46,7 +45,7 @@ namespace OHOS { return false; } - CertmanagerTest::SetATPermission(); + SetATPermission(); (void)CmUpdate(&upHandle, &inData); CmFree(myData); diff --git a/test/fuzz_test/cmusertrustedstore_fuzzer/BUILD.gn b/test/fuzz_test/cmusertrustedstore_fuzzer/BUILD.gn index 543075c..b9faeb0 100644 --- a/test/fuzz_test/cmusertrustedstore_fuzzer/BUILD.gn +++ b/test/fuzz_test/cmusertrustedstore_fuzzer/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/config/features.gni") import("//build/test.gni") @@ -19,29 +20,18 @@ module_output_path = "certificate_manager/certificate_manager" ##############################fuzztest########################################## ohos_fuzztest("CmUserTrustedStoreFuzzTest") { module_out_path = module_output_path - fuzz_config_file = "../../../test/fuzz_test/cmusertrustedstore_fuzzer" + fuzz_config_file = + "${cert_manager_root_dir}/test/fuzz_test/cmusertrustedstore_fuzzer" - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - "../../../services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc", - "../../../services/cert_manager_standard/cert_manager_engine/main/core/include", - "../../../test/unittest/include", - ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ - "../../../test/unittest/src/cm_test_common.cpp", - "cmusertrustedstore_fuzzer.cpp", - ] + sources = [ "cmusertrustedstore_fuzzer.cpp" ] deps = [ - "../../../services/cert_manager_standard:cert_manager_service", - "../../../test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/os_dependency:libcert_manager_ipc_client_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/services/cert_manager_standard:cert_manager_service", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_engine/main/core:cert_manager_engine_core_standard", + "${cert_manager_root_dir}/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl:libcm_service_idl_standard_static", + "${cert_manager_root_dir}/test/fuzz_test/fuzz_test_common:libcert_manager_fuzz_test_common_static", ] external_deps = [ "access_token:libaccesstoken_sdk", diff --git a/test/fuzz_test/cmusertrustedstore_fuzzer/cmusertrustedstore_fuzzer.cpp b/test/fuzz_test/cmusertrustedstore_fuzzer/cmusertrustedstore_fuzzer.cpp index a4a2d97..5cbb136 100644 --- a/test/fuzz_test/cmusertrustedstore_fuzzer/cmusertrustedstore_fuzzer.cpp +++ b/test/fuzz_test/cmusertrustedstore_fuzzer/cmusertrustedstore_fuzzer.cpp @@ -17,15 +17,16 @@ #include "cm_fuzz_test_common.h" #include "cert_manager_api.h" -#include "cm_test_common.h" #include "cm_cert_data_user.h" #include "cm_ipc_client_serialization.h" #include "cm_ipc_service.h" #include "cm_param.h" #include "cert_manager_status.h" +#include "cm_type.h" using namespace CmFuzzTest; namespace OHOS { + constexpr uint32_t TEST_USERID = 100; constexpr uint32_t MIN_DATA_USE_TIME = 10; static bool InstallUserCert(uint8_t *tmpData, uint32_t *remainSize, uint32_t *offset, struct CmBlob *keyUri) { @@ -201,7 +202,7 @@ namespace OHOS { uint32_t remainSize = static_cast(size); uint32_t offset = 0; - CertmanagerTest::SetATPermission(); + SetATPermission(); bool ret = false; uint8_t keyUriData[] = "1d3472b9.0"; diff --git a/test/fuzz_test/fuzz_test_common/BUILD.gn b/test/fuzz_test/fuzz_test_common/BUILD.gn index c506481..dd12464 100644 --- a/test/fuzz_test/fuzz_test_common/BUILD.gn +++ b/test/fuzz_test/fuzz_test_common/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/ohos.gni") config("cert_manager_config") { @@ -21,24 +22,17 @@ ohos_static_library("libcert_manager_fuzz_test_common_static") { subsystem_name = "security" part_name = "certificate_manager" public_configs = [ ":cert_manager_config" ] - include_dirs = [ - "../../../frameworks/cert_manager_standard/main/common/include", - "../../../frameworks/cert_manager_standard/main/os_dependency/cm_ipc/include", - "../../../interfaces/innerkits/cert_manager_standard/main/include", - ] + sources = [ "src/cm_fuzz_test_common.cpp" ] - cflags_cc = [ - "-Wall", - "-Werror", - ] - defines = [ - "L2_STANDARD", - "_CM_LOG_ENABLE_", - ] deps = [ - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/common:libcert_manager_common_standard_static", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main/os_dependency:libcert_manager_ipc_client_static", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] external_deps = [ + "access_token:libaccesstoken_sdk", + "access_token:libnativetoken", + "access_token:libtoken_setproc", "c_utils:utils", "ipc:ipc_core", ] diff --git a/test/fuzz_test/fuzz_test_common/include/cm_cert_data_rsa.h b/test/fuzz_test/fuzz_test_common/include/cm_cert_data_rsa.h new file mode 100644 index 0000000..660ecd6 --- /dev/null +++ b/test/fuzz_test/fuzz_test_common/include/cm_cert_data_rsa.h @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2022 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. + */ + +#ifndef CM_CERT_DATA_RSA_H +#define CM_CERT_DATA_RSA_H + +static const uint8_t g_certPwd[] = "123456"; +static const uint8_t g_rsa2048P12CertInfo[] = { + 0x30, 0x82, 0x0b, 0xc1, 0x02, 0x01, 0x03, 0x30, 0x82, 0x0b, 0x87, 0x06, 0x09, 0x2a, 0x86, 0x48, + 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x82, 0x0b, 0x78, 0x04, 0x82, 0x0b, 0x74, 0x30, 0x82, + 0x0b, 0x70, 0x30, 0x82, 0x06, 0x27, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, + 0x06, 0xa0, 0x82, 0x06, 0x18, 0x30, 0x82, 0x06, 0x14, 0x02, 0x01, 0x00, 0x30, 0x82, 0x06, 0x0d, + 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0x30, 0x1c, 0x06, 0x0a, 0x2a, + 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x01, 0x03, 0x30, 0x0e, 0x04, 0x08, 0x1a, 0x8f, 0xc1, + 0xd1, 0xda, 0x6c, 0xd1, 0xa9, 0x02, 0x02, 0x08, 0x00, 0x80, 0x82, 0x05, 0xe0, 0xd0, 0x2f, 0x2d, + 0x52, 0x09, 0x86, 0x55, 0x53, 0xf0, 0x49, 0x8f, 0x00, 0xa1, 0x4d, 0x21, 0xc8, 0xb4, 0xad, 0x27, + 0x12, 0x44, 0xab, 0x4d, 0x10, 0x14, 0xe3, 0x3c, 0x9a, 0x05, 0x77, 0x51, 0x90, 0x4a, 0x3a, 0x8a, + 0x09, 0xa9, 0x4b, 0x36, 0x50, 0x60, 0x22, 0x4b, 0x77, 0x12, 0x5c, 0x2f, 0x60, 0xd3, 0xd9, 0x30, + 0x94, 0x4d, 0x9e, 0x81, 0xc3, 0xe9, 0x9d, 0xd9, 0x47, 0xb3, 0x54, 0xa2, 0x9a, 0x8f, 0xe7, 0x58, + 0x95, 0xd7, 0x48, 0x87, 0xc4, 0x40, 0xad, 0x9a, 0x42, 0x1d, 0x36, 0xb7, 0x48, 0xbc, 0x70, 0x8c, + 0x84, 0xcb, 0x3c, 0x02, 0x25, 0x9f, 0xfe, 0x2c, 0x4a, 0x76, 0xb1, 0x27, 0x94, 0x8f, 0xb0, 0x07, + 0xf0, 0xc0, 0x00, 0x3a, 0x69, 0x16, 0xe1, 0x63, 0x0c, 0xe5, 0x92, 0xc2, 0x7d, 0x99, 0xd9, 0x11, + 0x40, 0xd8, 0x64, 0xab, 0x13, 0xda, 0x73, 0x7b, 0x12, 0x53, 0xb1, 0x0b, 0x0c, 0x67, 0x81, 0xe1, + 0xf5, 0x59, 0x3a, 0xc7, 0xe0, 0xe9, 0xda, 0x12, 0xc7, 0x2b, 0xab, 0x3d, 0xbc, 0x10, 0x3d, 0x1a, + 0x88, 0xc7, 0x1d, 0x31, 0x5f, 0x39, 0x63, 0x51, 0x8b, 0x11, 0x99, 0x05, 0xf9, 0x40, 0x42, 0x27, + 0xad, 0x75, 0x6f, 0xe2, 0x2d, 0x66, 0x28, 0x97, 0x7c, 0x6f, 0xf4, 0xfc, 0x95, 0xaa, 0x67, 0x81, + 0xd8, 0x15, 0x3c, 0xf4, 0x7b, 0x97, 0x08, 0x7b, 0x1b, 0x8c, 0xd3, 0x45, 0x8b, 0x96, 0x54, 0x2c, + 0xb1, 0x00, 0x87, 0x59, 0x5c, 0x94, 0x78, 0x29, 0xa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d, + 0x24, 0xe4, 0x06, 0x52, 0x03, 0xda, 0x8e, 0x68, 0x6d, 0x74, 0xfd, 0xda, 0x9b, 0xca, 0x8e, 0x52, + 0x71, 0x9c, 0x14, 0x05, 0x10, 0x61, 0x63, 0xa4, 0x53, 0x72, 0x4a, 0xda, 0x15, 0xf8, 0x0a, 0x56, + 0x89, 0x00, 0xdd, 0x87, 0xf5, 0xdd, 0x69, 0xd6, 0x6c, 0x89, 0x15, 0x1a, 0x1f, 0x48, 0xd6, 0x2c, + 0x1e, 0x4f, 0x23, 0x06, 0x6e, 0x34, 0x0d, 0x4e, 0xe3, 0x17, 0x40, 0x22, 0x7a, 0x68, 0x37, 0xad, + 0x05, 0xdb, 0x99, 0xde, 0x1a, 0x47, 0x2f, 0xb1, 0x9e, 0x7e, 0xdb, 0xad, 0x69, 0x06, 0x25, 0xd5, + 0xd9, 0x8e, 0xaf, 0xe2, 0xaa, 0x5a, 0x9a, 0x79, 0xd6, 0xeb, 0x02, 0x10, 0xf8, 0x72, 0x78, 0x4e, + 0x51, 0x2a, 0x53, 0x55, 0xb9, 0xd3, 0x7c, 0x31, 0x42, 0xff, 0x59, 0x39, 0x92, 0xd6, 0xec, 0x46, + 0x2d, 0x4f, 0xea, 0xf1, 0x0e, 0x83, 0x57, 0x55, 0x7b, 0xf1, 0x43, 0x47, 0x82, 0x10, 0x0d, 0x72, + 0xa2, 0x40, 0x2e, 0xf7, 0x2d, 0xcb, 0x80, 0x5b, 0x8a, 0x02, 0x5b, 0x71, 0xd9, 0xa5, 0x55, 0xea, + 0x41, 0x3f, 0x15, 0x9b, 0xee, 0x92, 0x4a, 0x3e, 0x87, 0x2e, 0xc3, 0xba, 0x71, 0x81, 0x57, 0xb9, + 0x7e, 0xb3, 0xd7, 0x52, 0x05, 0x91, 0x57, 0x87, 0x16, 0x48, 0x36, 0xdb, 0x4b, 0x45, 0x32, 0xaf, + 0x22, 0xc0, 0x3b, 0xc8, 0x90, 0xce, 0x53, 0xf3, 0x85,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82, 0xb3, 0x1a, 0xe8, 0xd7, 0x93, 0xff, 0x19, 0xd1, 0x74, 0xd2, + 0x29, 0xe1, 0x97, 0x60, 0x09, 0x48, 0xef, 0xc9, 0x61, 0xae, 0x3b, 0x4f, 0xd4, 0x30, 0x82, 0x05, + 0x41, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x82, 0x05, 0x32, + 0x04, 0x82, 0x05, 0x2e, 0x30, 0x82, 0x05, 0x2a, 0x30, 0x82, 0x05, 0x26, 0x06, 0x0b, 0x2a, 0x86, + 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x0a, 0x01, 0x02, 0xa0, 0x82, 0x04, 0xee, 0x30, 0x82, 0x04, + 0xea, 0x30, 0x1c, 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x01, 0x03, 0x30, + 0x0e, 0x04, 0x08, 0x2b, 0xef, 0x2d, 0x9b, 0x33, 0xf6, 0x82, 0x62, 0x02, 0x02, 0x08, 0x00, 0x04, + 0x82, 0x04, 0xc8, 0x59, 0x60, 0xea, 0x6e, 0x23, 0x9e, 0x82, 0x1c, 0x0a, 0x8e, 0xbd, 0x09, 0x94, + 0x98, 0x5e, 0x1a, 0x1b, 0x4a, 0xfe, 0x86, 0x2d, 0xf4, 0x54, 0xaa, 0x17, 0xba, 0xf1, 0xf1, 0x58, + 0x12, 0xa2, 0x81, 0x1c, 0x29, 0xe7, 0x94, 0x78, 0xbc, 0x68, 0x07, 0x8f, 0xdb, 0x3f, 0xab, 0xa7, + 0xa7, 0x73, 0x6d, 0xea, 0x25, 0x6f, 0x97, 0xc8, 0xba, 0x73, 0xcc, 0x1e, 0xa0, 0x73, 0x18, 0x14, + 0xe8, 0xae, 0xe0, 0x5d, 0x3c, 0x9b, 0x9e, 0xad, 0xf4, 0x46, 0xeb, 0xa4, 0x73, 0xe2, 0xb5, 0x16, + 0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0xba, 0x11, 0xf3, 0x91, 0xc0, 0x5b, 0x9d, 0x93, 0xfd, + 0x94, 0x89, 0xb6, 0xea, 0x90, 0x15, 0xe5, 0xf0, 0xe8, 0xd8, 0x31, 0x2c, 0xe0, 0x92, 0x6a, 0xb7, + 0xe3, 0x43, 0x51, 0xfc, 0xa0, 0x20, 0x2b, 0x5c, 0xbb, 0xf0, 0x22, 0x2b, 0xa5, 0x00, 0x40, 0xe9, + 0x0d, 0x64, 0xf0, 0xe7, 0xca, 0x29, 0x85, 0xfc, 0x89, 0x38, 0x03, 0xaa, 0x0c, 0xad, 0x71, 0xe6, + 0xc9, 0xde, 0x42, 0x5e, 0x97, 0x74, 0x35, 0x6a, 0x88, 0x94, 0x99, 0xd5, 0xbd, 0x91, 0xa5, 0x92, + 0x35, 0x1d, 0xf4, 0x11, 0xf7, 0x7e, 0x47, 0x96, 0xe4, 0x2f, 0x85, 0x75, 0x3a, 0x16, 0x2a, 0x45, + 0x96, 0xd7, 0xb1, 0x8f, 0xd5, 0x64, 0x87, 0x5d, 0xd0, 0x44, 0x1e, 0xd6, 0x67, 0x0c, 0xc6, 0xdb, + 0xb4, 0x0a, 0xe4, 0x18, 0x0c, 0x12, 0x73, 0xb5, 0x4f, 0x44, 0xc8, 0xd6, 0x97, 0x8b, 0x99, 0x19, + 0x66, 0x55, 0x08, 0xcb, 0xa0, 0xca, 0x9e, 0x09, 0x0f, 0xe1, 0x8b, 0xd7, 0xa1, 0x12, 0x54, 0x46, + 0x2d, 0x09, 0x44, 0x27, 0x30, 0xcd, 0x02, 0xcc, 0x88, 0x8f, 0x69, 0x22, 0xed, 0x31, 0x25, 0x14, + 0x5f, 0x37, 0x5f, 0xce, 0x91, 0x95, 0x30, 0x07, 0x32, 0xaa, 0x2e, 0x55, 0x9a, 0xc4, 0x33, 0xab, + 0xd0, 0x55, 0x3d, 0x04, 0xe3, 0x84, 0x0c, 0xf1, 0xe4, 0xe6, 0x52, 0x39, 0x0e, 0x22, 0x8b, 0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0xa0, 0x71, 0xe4, 0x45, 0x12, 0x24, 0x1e, 0x0d, 0x06, 0x96, + 0x1e, 0x23, 0xa3, 0x39, 0xd8, 0xcc, 0x72, 0xd7, 0xac, 0x72, 0x5c, 0x8c, 0xdf, 0x6c, 0xb4, 0xc4, + 0x2b, 0xbc, 0x1c, 0xeb, 0xbe, 0x1b, 0xbb, 0xf3, 0xbc, 0x45, 0x34, 0xe9, 0x5a, 0x7f, 0x11, 0x61, + 0xd7, 0x61, 0x15, 0x18, 0x0e, 0xf8, 0x8b, 0x23, 0x97, 0xa7, 0x46, 0x31, 0x25, 0x30, 0x23, 0x06, + 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x15, 0x31, 0x16, 0x04, 0x14, 0x8b, 0x4e, + 0x13, 0x2a, 0xf1, 0x4d, 0xa3, 0xe9, 0x31, 0x5c, 0x6d, 0xce, 0x5a, 0x09, 0x93, 0x0a, 0xf4, 0x12, + 0x19, 0x7b, 0x30, 0x31, 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, + 0x00, 0x04, 0x14, 0x00, 0x3b, 0x70, 0x95, 0x68, 0xd3, 0xd8, 0x4f, 0x71, 0xd0, 0x7d, 0x41, 0x49, + 0x48, 0xef, 0x88, 0x6d, 0xe0, 0x9d, 0x53, 0x04, 0x08, 0x0e, 0x46, 0xa3, 0xb5, 0x73, 0x88, 0x7c, + 0x22, 0x02, 0x02, 0x08, 0x00 +}; +#endif /* CM_CERT_DATA_RSA_H */ \ No newline at end of file diff --git a/test/fuzz_test/fuzz_test_common/include/cm_cert_data_user.h b/test/fuzz_test/fuzz_test_common/include/cm_cert_data_user.h new file mode 100644 index 0000000..374a97d --- /dev/null +++ b/test/fuzz_test/fuzz_test_common/include/cm_cert_data_user.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2022 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. + */ + +#ifndef CM_CERT_DATA_USER_H +#define CM_CERT_DATA_USER_H +static const uint8_t g_certData01[] = { /* 40dc992e.0 */ + 0x30, 0x82, 0x04, 0x31, 0x30, 0x82, 0x03, 0x19, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x00, + 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, + 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x52, 0x31, + 0x44, 0x30, 0x42, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x3b, 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, + 0x69, 0x63, 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x69, 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, + 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x43, 0x65, 0x72, 0x74, 0x2e, 0x20, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x40, 0x30, 0x3e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x37, + 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, 0x69, 0x63, 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x69, + 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x49, + 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x52, 0x6f, 0x6f, 0x74, + 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x31, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x31, 0x32, 0x30, + 0x36, 0x31, 0x33, 0x34, 0x39, 0x35, 0x32, 0x5a, 0x17, 0x0d, 0x33, 0x31, 0x31, 0x32, 0x30, 0x31, + 0x31, 0x33, 0x34, 0x39, 0x35, 0x32, 0x5a, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, + 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x52, 0x31, 0x44, 0x30, 0x42, 0x06, 0x03, 0x55, 0x04, 0x0a, + 0x13, 0x3b, 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, 0x69, 0x63, 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, + 0x6d, 0x69, 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, + 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x43, 0x65, + 0x72, 0x74, 0x2e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x40, 0x30, + 0x3e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x37, 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, 0x69, 0x63, + 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x69, 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x52, 0x65, + 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x31, 0x30, + 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, + 0xa9, 0x53, 0x00, 0xe3, 0x2e, 0xa6, 0xf6, 0x8e, 0xfa, 0x60, 0xd8, 0x2d, 0x95, 0x3e, 0xf8, 0x2c, + 0x2a, 0x54, 0x4e, 0xcd, 0xb9, 0x84, 0x61, 0x94, 0x58, 0x4f, 0x8f, 0x3d, 0x8b, 0xe4, 0x43, 0xf3, + 0x75, 0x89, 0x8d, 0x51, 0xe4, 0xc3, 0x37, 0xd2, 0x8a, 0x88, 0x4d, 0x79, 0x1e, 0xb7, 0x12, 0xdd, + 0x43, 0x78, 0x4a, 0x8a, 0x92, 0xe6, 0xd7, 0x48, 0xd5, 0x0f, 0xa4, 0x3a, 0x29, 0x44, 0x35, 0xb8, + 0x07, 0xf6, 0x68, 0x1d, 0x55, 0xcd, 0x38, 0x51, 0xf0, 0x8c, 0x24, 0x31, 0x85, 0xaf, 0x83, 0xc9, + 0x7d, 0xe9, 0x77, 0xaf, 0xed, 0x1a, 0x7b, 0x9d, 0x17, 0xf9, 0xb3, 0x9d, 0x38, 0x50, 0x0f, 0xa6, + 0x5a, 0x79, 0x91, 0x80, 0xaf, 0x37, 0xae, 0xa6, 0xd3, 0x31, 0xfb, 0xb5, 0x26, 0x09, 0x9d, 0x3c, + 0x5a, 0xef, 0x51, 0xc5, 0x2b, 0xdf, 0x96, 0x5d, 0xeb, 0x32, 0x1e, 0x02, 0xda, 0x70, 0x49, 0xec, + 0x6e, 0x0c, 0xc8, 0x9a, 0x37, 0x8d, 0xf7, 0xf1, 0x36, 0x60, 0x4b, 0x26, 0x2c, 0x82, 0x9e, 0xd0, + 0x78, 0xf3, 0x0d, 0x0f, 0x63, 0xa4, 0x51, 0x30, 0xe1, 0xf9, 0x2b, 0x27, 0x12, 0x07, 0xd8, 0xea, + 0xbd, 0x18, 0x62, 0x98, 0xb0, 0x59, 0x37, 0x7d, 0xbe, 0xee, 0xf3, 0x20, 0x51, 0x42, 0x5a, 0x83, + 0xef, 0x93, 0xba, 0x69, 0x15, 0xf1, 0x62, 0x9d, 0x9f, 0x99, 0x39, 0x82, 0xa1, 0xb7, 0x74, 0x2e, + 0x8b, 0xd4, 0xc5, 0x0b, 0x7b, 0x2f, 0xf0, 0xc8, 0x0a, 0xda, 0x3d, 0x79, 0x0a, 0x9a, 0x93, 0x1c, + 0xa5, 0x28, 0x72, 0x73, 0x91, 0x43, 0x9a, 0xa7, 0xd1, 0x4d, 0x85, 0x84, 0xb9, 0xa9, 0x74, 0x8f, + 0x14, 0x40, 0xc7, 0xdc, 0xde, 0xac, 0x41, 0x64, 0x6c, 0xb4, 0x19, 0x9b, 0x02, 0x63, 0x6d, 0x24, + 0x64, 0x8f, 0x44, 0xb2, 0x25, 0xea, 0xce, 0x5d, 0x74, 0x0c, 0x63, 0x32, 0x5c, 0x8d, 0x87, 0xe5, + 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0x89, 0x30, 0x81, 0x86, 0x30, 0x0f, 0x06, 0x03, 0x55, + 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0b, 0x06, 0x03, + 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, + 0x04, 0x16, 0x04, 0x14, 0xa6, 0x91, 0x42, 0xfd, 0x13, 0x61, 0x4a, 0x23, 0x9e, 0x08, 0xa4, 0x29, + 0xe5, 0xd8, 0x13, 0x04, 0x23, 0xee, 0x41, 0x25, 0x30, 0x47, 0x06, 0x03, 0x55, 0x1d, 0x1e, 0x04, + 0x40, 0x30, 0x3e, 0xa0, 0x3c, 0x30, 0x05, 0x82, 0x03, 0x2e, 0x67, 0x72, 0x30, 0x05, 0x82, 0x03, + 0x2e, 0x65, 0x75, 0x30, 0x06, 0x82, 0x04, 0x2e, 0x65, 0x64, 0x75, 0x30, 0x06, 0x82, 0x04, 0x2e, + 0x6f, 0x72, 0x67, 0x30, 0x05, 0x81, 0x03, 0x2e, 0x67, 0x72, 0x30, 0x05, 0x81, 0x03, 0x2e, 0x65, + 0x75, 0x30, 0x06, 0x81, 0x04, 0x2e, 0x65, 0x64, 0x75, 0x30, 0x06, 0x81, 0x04, 0x2e, 0x6f, 0x72, + 0x67, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, + 0x03, 0x82, 0x01, 0x01, 0x00, 0x1f, 0xef, 0x79, 0x41, 0xe1, 0x7b, 0x6e, 0x3f, 0xb2, 0x8c, 0x86, + 0x37, 0x42, 0x4a, 0x4e, 0x1c, 0x37, 0x1e, 0x8d, 0x66, 0xba, 0x24, 0x81, 0xc9, 0x4f, 0x12, 0x0f, + 0x21, 0xc0, 0x03, 0x97, 0x86, 0x25, 0x6d, 0x5d, 0xd3, 0x22, 0x29, 0xa8, 0x6c, 0xa2, 0x0d, 0xa9, + 0xeb, 0x3d, 0x06, 0x5b, 0x99, 0x3a, 0xc7, 0xcc, 0xc3, 0x9a, 0x34, 0x7f, 0xab, 0x0e, 0xc8, 0x4e, + 0x1c, 0xe1, 0xfa, 0xe4, 0xdc, 0xcd, 0x0d, 0xbe, 0xbf, 0x24, 0xfe, 0x6c, 0xe7, 0x6b, 0xc2, 0x0d, + 0xc8, 0x06, 0x9e, 0x4e, 0x8d, 0x61, 0x28, 0xa6, 0x6a, 0xfd, 0xe5, 0xf6, 0x62, 0xea, 0x18, 0x3c, + 0x4e, 0xa0, 0x53, 0x9d, 0xb2, 0x3a, 0x9c, 0xeb, 0xa5, 0x9c, 0x91, 0x16, 0xb6, 0x4d, 0x82, 0xe0, + 0x0c, 0x05, 0x48, 0xa9, 0x6c, 0xf5, 0xcc, 0xf8, 0xcb, 0x9d, 0x49, 0xb4, 0xf0, 0x02, 0xa5, 0xfd, + 0x70, 0x03, 0xed, 0x8a, 0x21, 0xa5, 0xae, 0x13, 0x86, 0x49, 0xc3, 0x33, 0x73, 0xbe, 0x87, 0x3b, + 0x74, 0x8b, 0x17, 0x45, 0x26, 0x4c, 0x16, 0x91, 0x83, 0xfe, 0x67, 0x7d, 0xcd, 0x4d, 0x63, 0x67, + 0xfa, 0xf3, 0x03, 0x12, 0x96, 0x78, 0x06, 0x8d, 0xb1, 0x67, 0xed, 0x8e, 0x3f, 0xbe, 0x9f, 0x4f, + 0x02, 0xf5, 0xb3, 0x09, 0x2f, 0xf3, 0x4c, 0x87, 0xdf, 0x2a, 0xcb, 0x95, 0x7c, 0x01, 0xcc, 0xac, + 0x36, 0x7a, 0xbf, 0xa2, 0x73, 0x7a, 0xf7, 0x8f, 0xc1, 0xb5, 0x9a, 0xa1, 0x14, 0xb2, 0x8f, 0x33, + 0x9f, 0x0d, 0xef, 0x22, 0xdc, 0x66, 0x7b, 0x84, 0xbd, 0x45, 0x17, 0x06, 0x3d, 0x3c, 0xca, 0xb9, + 0x77, 0x34, 0x8f, 0xca, 0xea, 0xcf, 0x3f, 0x31, 0x3e, 0xe3, 0x88, 0xe3, 0x80, 0x49, 0x25, 0xc8, + 0x97, 0xb5, 0x9d, 0x9a, 0x99, 0x4d, 0xb0, 0x3c, 0xf8, 0x4a, 0x00, 0x9b, 0x64, 0xdd, 0x9f, 0x39, + 0x4b, 0xd1, 0x27, 0xd7, 0xb8 +}; +#endif /* CM_CERT_DATA_USER_H */ \ No newline at end of file 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 cc48ab7..ef1ec4b 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 @@ -23,6 +23,8 @@ #include "securec.h" namespace CmFuzzTest { +void SetATPermission(void); + constexpr uint32_t CERT_INFO_LEN = sizeof(uint32_t) + MAX_LEN_CERTIFICATE + sizeof(uint32_t) + MAX_LEN_CERT_ALIAS + sizeof(uint32_t); 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 e42902b..8034da6 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 @@ -17,10 +17,49 @@ #include "cm_ipc_client_serialization.h" #include "message_parcel.h" +#include "nativetoken_kit.h" +#include "token_setproc.h" +#include "accesstoken_kit.h" +#include namespace CmFuzzTest { +constexpr uint32_t SLEEP_TIME = 3; +constexpr int32_t PERMISSION_MAX = 4; +constexpr int32_t PERMISSION_INDEX0 = 0; +constexpr int32_t PERMISSION_INDEX1 = 1; +constexpr int32_t PERMISSION_INDEX2 = 2; +constexpr int32_t PERMISSION_INDEX3 = 3; constexpr uint32_t NUM_10 = 10; constexpr uint32_t NUM_9 = 9; +void SetATPermission(void) +{ + static bool firstRun = true; + const char **perms = new const char *[PERMISSION_MAX]; // 4 permissions + perms[PERMISSION_INDEX0] = "ohos.permission.ACCESS_CERT_MANAGER_INTERNAL"; // system_core + perms[PERMISSION_INDEX1] = "ohos.permission.ACCESS_CERT_MANAGER"; // normal + perms[PERMISSION_INDEX2] = "ohos.permission.ACCESS_USER_TRUSTED_CERT"; // system_core + perms[PERMISSION_INDEX3] = "ohos.permission.ACCESS_SYSTEM_APP_CERT"; // system_core + NativeTokenInfoParams infoInstance = { + .dcapsNum = 0, + .permsNum = PERMISSION_MAX, + .dcaps = nullptr, + .perms = perms, + .acls = nullptr, + .processName = "TestCertManager", + .aplStr = "system_core", + }; + + auto tokenId = GetAccessTokenId(&infoInstance); + SetSelfTokenID(tokenId); + OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo(); + if (firstRun) { + system("pidof accesstoken_ser | xargs kill -9"); + sleep(SLEEP_TIME); + firstRun = false; + } + delete[] perms; +} + bool GetUintFromBuffer(uint8_t *srcData, uint32_t *remSize, uint32_t *offset, uint32_t *outVal) { if (*remSize < sizeof(uint32_t)) { diff --git a/test/unittest/common_permission_test/BUILD.gn b/test/unittest/common_permission_test/BUILD.gn index cc3b530..1578e81 100644 --- a/test/unittest/common_permission_test/BUILD.gn +++ b/test/unittest/common_permission_test/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/test.gni") module_output_path = "cert_manager_standard/cert_manager_standard_test" @@ -23,11 +24,6 @@ ohos_unittest("cm_common_permission_test") { ] include_dirs = [ "../include" ] - cflags_cc = [ - "-Wall", - "-Werror", - ] - cflags = cflags_cc branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -39,10 +35,9 @@ ohos_unittest("cm_common_permission_test") { } deps = [ - "../../../frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - defines = [ "_CM_LOG_ENABLE_" ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", diff --git a/test/unittest/inner_permission_test/BUILD.gn b/test/unittest/inner_permission_test/BUILD.gn index 30b4c40..def6ff9 100644 --- a/test/unittest/inner_permission_test/BUILD.gn +++ b/test/unittest/inner_permission_test/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/test.gni") module_output_path = "cert_manager_standard/cert_manager_standard_test" @@ -23,11 +24,6 @@ ohos_unittest("cm_inner_permission_test") { ] include_dirs = [ "../include" ] - cflags_cc = [ - "-Wall", - "-Werror", - ] - cflags = cflags_cc branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -39,10 +35,9 @@ ohos_unittest("cm_inner_permission_test") { } deps = [ - "../../../frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - defines = [ "_CM_LOG_ENABLE_" ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", diff --git a/test/unittest/module_test/BUILD.gn b/test/unittest/module_test/BUILD.gn index a31043b..61f97a6 100644 --- a/test/unittest/module_test/BUILD.gn +++ b/test/unittest/module_test/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/test.gni") module_output_path = "cert_manager_standard/cert_manager_standard_test" @@ -27,11 +28,6 @@ ohos_unittest("cm_module_test") { "include", "../include", ] - cflags_cc = [ - "-Wall", - "-Werror", - ] - cflags = cflags_cc branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -43,10 +39,9 @@ ohos_unittest("cm_module_test") { } deps = [ - "../../../frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - defines = [ "_CM_LOG_ENABLE_" ] external_deps = [ "bounds_checking_function:libsec_static", "c_utils:utils", diff --git a/test/unittest/multi_thread_test/BUILD.gn b/test/unittest/multi_thread_test/BUILD.gn index 3251d76..74973a8 100644 --- a/test/unittest/multi_thread_test/BUILD.gn +++ b/test/unittest/multi_thread_test/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/security/certificate_manager/cert_manager.gni") import("//build/test.gni") module_output_path = "cert_manager_standard/cert_manager_standard_test" @@ -26,11 +27,6 @@ ohos_unittest("cm_multi_thread_test") { ] include_dirs = [ "../include" ] - cflags_cc = [ - "-Wall", - "-Werror", - ] - cflags = cflags_cc branch_protector_ret = "pac_ret" sanitize = { cfi = true @@ -42,10 +38,9 @@ ohos_unittest("cm_multi_thread_test") { } deps = [ - "../../../frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", - "../../../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", + "${cert_manager_root_dir}/frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", + "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", ] - defines = [ "_CM_LOG_ENABLE_" ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", -- Gitee