From 30d2b6ca625d15f4d3867a08a5e12c8efbaa5910 Mon Sep 17 00:00:00 2001 From: yeyuning Date: Thu, 21 Sep 2023 17:01:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9fuzz=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E7=94=9F=E6=88=90=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeyuning Change-Id: Ib4b044d868e7b0b43326c49b9e1234e35d20164e --- code_signature.gni | 35 +++-- .../signlocalcodestub_fuzzer/BUILD.gn | 148 +++++++++--------- 2 files changed, 90 insertions(+), 93 deletions(-) diff --git a/code_signature.gni b/code_signature.gni index e7f1593..b1f26e5 100644 --- a/code_signature.gni +++ b/code_signature.gni @@ -1,18 +1,19 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - -code_signature_root_dir = "//base/security/code_signature" -fsverity_utils_dir = "//third_party/fsverity-utils" -openssl_dir = "//third_party/openssl" -rust_openssl_dir = "//third_party/rust/crates/rust-openssl" -googletest_dir = "//third_party/googletest" \ No newline at end of file + +fuzz_module_output_path = "code_signature/code_signature" +code_signature_root_dir = "//base/security/code_signature" +fsverity_utils_dir = "//third_party/fsverity-utils" +openssl_dir = "//third_party/openssl" +rust_openssl_dir = "//third_party/rust/crates/rust-openssl" +googletest_dir = "//third_party/googletest" diff --git a/test/fuzztest/local_code_sign_stub/signlocalcodestub_fuzzer/BUILD.gn b/test/fuzztest/local_code_sign_stub/signlocalcodestub_fuzzer/BUILD.gn index fb69cc8..27bc07a 100644 --- a/test/fuzztest/local_code_sign_stub/signlocalcodestub_fuzzer/BUILD.gn +++ b/test/fuzztest/local_code_sign_stub/signlocalcodestub_fuzzer/BUILD.gn @@ -1,77 +1,73 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - -import("//build/config/features.gni") -import("//build/test.gni") -import("../../../../code_signature.gni") - -module_output_path = "code_signature/local_code_sign_stub" - -ohos_fuzztest("SignLocalCodeStubFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "." - - sources = [ "signlocalcodestub_fuzzer.cpp" ] - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - deps = [ - "${code_signature_root_dir}/interfaces/innerkits/local_code_sign:liblocal_code_sign_sdk", - ] - - include_dirs = [ - "${code_signature_root_dir}/interfaces/innerkits/local_code_sign/include", - "${code_signature_root_dir}/services/local_code_sign/include", - ] - external_deps = [ - "access_token:libtoken_setproc", - "access_token:libnativetoken", - ] - - sources += [ - "${code_signature_root_dir}/services/local_code_sign/src/local_code_sign_service.cpp", - "${code_signature_root_dir}/services/local_code_sign/src/local_code_sign_stub.cpp", - "${code_signature_root_dir}/services/local_code_sign/src/local_sign_key.cpp", - "${code_signature_root_dir}/services/local_code_sign/src/permission_utils.cpp", - "${code_signature_root_dir}/utils/src/file_helper.cpp", - "${code_signature_root_dir}/utils/src/cert_utils.cpp", - ] - - include_dirs += [ - "${code_signature_root_dir}/interfaces/innerkits/local_code_sign/include", - "${code_signature_root_dir}/utils/include", - ] - public_configs = [ "${code_signature_root_dir}:common_public_config" ] - configs = [ "${code_signature_root_dir}:common_utils_config" ] - deps += [ - "${code_signature_root_dir}/utils:fsverity_sign_src_set", - "${openssl_dir}:libcrypto_shared", - "${fsverity_utils_dir}:libfsverity_utils", - ] - external_deps += [ - "access_token:libaccesstoken_sdk", - "access_token:libtokenid_sdk", - "c_utils:utils", - "eventhandler:libeventhandler", - "hisysevent:libhisysevent", - "hitrace:hitrace_meter", - "hilog:libhilog", - "huks:libhukssdk", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - ] -} + +import("//build/config/features.gni") +import("//build/test.gni") +import("../../../../code_signature.gni") + +ohos_fuzztest("SignLocalCodeStubFuzzTest") { + module_out_path = "${fuzz_module_output_path}" + fuzz_config_file = "." + + sources = [ "signlocalcodestub_fuzzer.cpp" ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + deps = [ "${code_signature_root_dir}/interfaces/innerkits/local_code_sign:liblocal_code_sign_sdk" ] + + include_dirs = [ + "${code_signature_root_dir}/interfaces/innerkits/local_code_sign/include", + "${code_signature_root_dir}/services/local_code_sign/include", + ] + external_deps = [ + "access_token:libnativetoken", + "access_token:libtoken_setproc", + ] + + sources += [ + "${code_signature_root_dir}/services/local_code_sign/src/local_code_sign_service.cpp", + "${code_signature_root_dir}/services/local_code_sign/src/local_code_sign_stub.cpp", + "${code_signature_root_dir}/services/local_code_sign/src/local_sign_key.cpp", + "${code_signature_root_dir}/services/local_code_sign/src/permission_utils.cpp", + "${code_signature_root_dir}/utils/src/cert_utils.cpp", + "${code_signature_root_dir}/utils/src/file_helper.cpp", + ] + + include_dirs += [ + "${code_signature_root_dir}/interfaces/innerkits/local_code_sign/include", + "${code_signature_root_dir}/utils/include", + ] + public_configs = [ "${code_signature_root_dir}:common_public_config" ] + configs = [ "${code_signature_root_dir}:common_utils_config" ] + deps += [ + "${code_signature_root_dir}/utils:fsverity_sign_src_set", + "${fsverity_utils_dir}:libfsverity_utils", + "${openssl_dir}:libcrypto_shared", + ] + external_deps += [ + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "c_utils:utils", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "huks:libhukssdk", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] +} -- Gitee