!98 安全控件符号隐藏编译调整

Merge pull request !98 from libing23/master
This commit is contained in:
openharmony_ci
2024-02-23 03:47:45 +00:00
committed by Gitee
40 changed files with 419 additions and 362 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -16,7 +16,6 @@ import("//build/ohos.gni")
group("security_component_build_module") {
if (is_standard_system) {
deps = [
"interfaces/inner_api/enhance_kits:libsecurity_component_enhance_sdk",
"interfaces/inner_api/security_component:libsecurity_component_sdk",
"services/security_component_service/sa:security_component_service",
"services/security_component_service/sa/sa_profile:security_component_sa_profile_standard",
@@ -29,6 +28,7 @@ group("security_component_build_module_test") {
deps = []
if (is_standard_system) {
deps += [
"frameworks/enhance_adapter/test:unittest",
"interfaces/inner_api/enhance_kits/test:unittest",
"interfaces/inner_api/security_component/test:unittest",
"services/security_component_service/sa/test:unittest",
-29
View File
@@ -57,35 +57,6 @@
"header_base": "//base/security/security_component_manager/interfaces/inner_api/security_component/include"
}
},
{
"name": "//base/security/security_component_manager/interfaces/inner_api/enhance_kits:libsecurity_component_enhance_sdk",
"header": {
"header_files": [
"sec_comp_enhance_kit.h"
],
"header_base": "//base/security/security_component_manager/interfaces/inner_api/enhance_kits/include"
}
},
{
"name": "//base/security/security_component_manager/frameworks:libsecurity_component_framework",
"header": {
"header_files": [
"location_button.h",
"paste_button.h",
"save_button.h"
],
"header_base": "//base/security/security_component_manager/interfaces/inner_api/security_component/include"
}
},
{
"name": "//base/security/security_component_manager/frameworks:libsecurity_component_enhance_adapter",
"header": {
"header_files": [
"sec_comp_enhance_adapter.h"
],
"header_base": "//base/security/security_component_manager/frameworks/enhance_adapter/include"
}
},
{
"name": "//base/security/security_component_manager/services/security_component_service/sa:security_component_service",
"header": {
+15 -11
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -15,17 +15,16 @@ import("//build/ohos.gni")
sec_comp_root_dir = ".."
config("libsecurity_component_framework_config") {
config("security_component_framework_src_set_config") {
include_dirs = [
"common/include",
"${sec_comp_root_dir}/interfaces/inner_api/security_component/include",
]
}
ohos_shared_library("libsecurity_component_framework") {
ohos_source_set("security_component_framework_src_set") {
subsystem_name = "security"
part_name = "security_component_manager"
output_name = "libsecurity_component_framework"
sanitize = {
cfi = true
cfi_cross_dso = true
@@ -49,17 +48,20 @@ ohos_shared_library("libsecurity_component_framework") {
]
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
public_configs = [ ":libsecurity_component_framework_config" ]
public_configs = [ ":security_component_framework_src_set_config" ]
external_deps = [
"c_utils:utils",
"hilog:libhilog",
]
cflags_cc = [ "-DHILOG_ENABLE" ]
cflags_cc = [
"-DHILOG_ENABLE",
"-fvisibility=hidden",
]
}
config("libsecurity_component_enhance_adapter_config") {
config("security_component_enhance_adapter_src_set_config") {
include_dirs = [
"common/include",
"enhance_adapter/include",
@@ -68,10 +70,9 @@ config("libsecurity_component_enhance_adapter_config") {
]
}
ohos_shared_library("libsecurity_component_enhance_adapter") {
ohos_source_set("security_component_enhance_adapter_src_set") {
subsystem_name = "security"
part_name = "security_component_manager"
output_name = "libsecurity_component_enhance_adapter"
sanitize = {
cfi = true
cfi_cross_dso = true
@@ -88,7 +89,7 @@ ohos_shared_library("libsecurity_component_enhance_adapter") {
sources = [ "enhance_adapter/src/sec_comp_enhance_adapter.cpp" ]
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
public_configs = [ ":libsecurity_component_enhance_adapter_config" ]
public_configs = [ ":security_component_enhance_adapter_src_set_config" ]
external_deps = [
"c_utils:utils",
@@ -96,7 +97,10 @@ ohos_shared_library("libsecurity_component_enhance_adapter") {
"ipc:ipc_single",
]
cflags_cc = [ "-DHILOG_ENABLE" ]
cflags_cc = [
"-DHILOG_ENABLE",
"-fvisibility=hidden",
]
if (current_cpu == "arm64") {
defines = [ "_ARM64_" ]
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -110,13 +110,13 @@ public:
static void AddSecurityComponentProcess(int32_t pid);
static SecCompInputEnhanceInterface* inputHandler;
static __attribute__((visibility("default"))) SecCompInputEnhanceInterface* inputHandler;
static bool isEnhanceInputHandlerInit;
static SecCompSrvEnhanceInterface* srvHandler;
static __attribute__((visibility("default"))) SecCompSrvEnhanceInterface* srvHandler;
static bool isEnhanceSrvHandlerInit;
static SecCompClientEnhanceInterface* clientHandler;
static __attribute__((visibility("default"))) SecCompClientEnhanceInterface* clientHandler;
static bool isEnhanceClientHandlerInit;
static std::mutex initMtx;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -30,9 +30,9 @@ static const std::string LIB_PATH = "/system/lib64/";
#else
static const std::string LIB_PATH = "/system/lib/";
#endif
static const std::string ENHANCE_INPUT_INTERFACE_LIB = LIB_PATH + "libsec_comp_input_enhance.z.so";
static const std::string ENHANCE_SRV_INTERFACE_LIB = LIB_PATH + "libsec_comp_service_enhance.z.so";
static const std::string ENHANCE_CLIENT_INTERFACE_LIB = LIB_PATH + "libsec_comp_client_enhance.z.so";
static const std::string ENHANCE_INPUT_INTERFACE_LIB = LIB_PATH + "libsecurity_component_client_enhance.z.so";
static const std::string ENHANCE_SRV_INTERFACE_LIB = LIB_PATH + "libsecurity_component_service_enhance.z.so";
static const std::string ENHANCE_CLIENT_INTERFACE_LIB = LIB_PATH + "libsecurity_component_client_enhance.z.so";
}
SecCompInputEnhanceInterface* SecCompEnhanceAdapter::inputHandler = nullptr;
+50
View File
@@ -0,0 +1,50 @@
# Copyright (c) 2024 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/test.gni")
sec_comp_root_dir = "../../.."
ohos_unittest("sec_comp_enhance_adapter_test") {
subsystem_name = "security"
part_name = "security_component_manager"
module_out_path = part_name + "/" + part_name
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
include_dirs = [ "unittest/src" ]
sources = [ "unittest/src/sec_comp_enhance_adapter_test.cpp" ]
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
cflags_cc = [ "-DHILOG_ENABLE" ]
deps = [ "${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_src_set" ]
external_deps = [
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_single",
]
if (current_cpu == "arm64") {
defines = [ "_ARM64_" ]
}
}
group("unittest") {
testonly = true
deps = [ ":sec_comp_enhance_adapter_test" ]
}
@@ -0,0 +1,103 @@
/*
* Copyright (c) 2024 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.
*/
#include "sec_comp_enhance_adapter_test.h"
#include <unistd.h>
#include "sec_comp_err.h"
#include "sec_comp_log.h"
#include "sec_comp_info.h"
using namespace testing::ext;
using namespace OHOS::Security::SecurityComponent;
namespace {
static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {
LOG_CORE, SECURITY_DOMAIN_SECURITY_COMPONENT, "SecCompEnhanceAdapterTest"};
static constexpr uint32_t SEC_COMP_ENHANCE_CFG_SIZE = 76;
static constexpr uint32_t MAX_HMAC_SIZE = 64;
} // namespace
void SecCompEnhanceAdapterTest::SetUpTestCase()
{
SC_LOG_INFO(LABEL, "SetUpTestCase.");
}
void SecCompEnhanceAdapterTest::TearDownTestCase()
{
SC_LOG_INFO(LABEL, "TearDownTestCase.");
}
void SecCompEnhanceAdapterTest::SetUp()
{
SC_LOG_INFO(LABEL, "SetUp ok.");
}
void SecCompEnhanceAdapterTest::TearDown()
{
SC_LOG_INFO(LABEL, "TearDown.");
}
/**
* @tc.name: EnhanceAdapter001
* @tc.desc: test enhance adapter fail
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(SecCompEnhanceAdapterTest, EnhanceAdapter001, TestSize.Level1)
{
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
EXPECT_EQ(SecCompEnhanceAdapter::EnableInputEnhance(), SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE);
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
EXPECT_EQ(SecCompEnhanceAdapter::DisableInputEnhance(), SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE);
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
uint8_t cfgData[SEC_COMP_ENHANCE_CFG_SIZE] = { 0 };
EXPECT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE,
SecCompEnhanceAdapter::SetEnhanceCfg(cfgData, SEC_COMP_ENHANCE_CFG_SIZE));
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
uint8_t originData[MAX_HMAC_SIZE] = { 0 };
uint32_t enHancedataLen = MAX_HMAC_SIZE;
EXPECT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE,
SecCompEnhanceAdapter::GetPointerEventEnhanceData(originData, MAX_HMAC_SIZE, nullptr, enHancedataLen));
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompClickEvent touchInfo;
ASSERT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE, SecCompEnhanceAdapter::CheckExtraInfo(touchInfo));
SecCompEnhanceAdapter::isEnhanceClientHandlerInit = false;
std::string componentInfo;
SecCompEnhanceAdapter::EnhanceDataPreprocess(1, componentInfo);
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
ASSERT_EQ(nullptr, SecCompEnhanceAdapter::GetEnhanceRemoteObject());
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
SecCompEnhanceAdapter::StartEnhanceService();
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
SecCompEnhanceAdapter::ExistEnhanceService();
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
SecCompEnhanceAdapter::NotifyProcessDied(0);
SecCompEnhanceAdapter::isEnhanceClientHandlerInit = false;
SecCompEnhanceAdapter::RegisterScIdEnhance(0);
SecCompEnhanceAdapter::isEnhanceClientHandlerInit = false;
SecCompEnhanceAdapter::UnregisterScIdEnhance(0);
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
SecCompEnhanceAdapter::AddSecurityComponentProcess(0);
SecCompEnhanceAdapter::isEnhanceSrvHandlerInit = false;
std::shared_ptr<SecCompBase> compInfo;
const nlohmann::json jsonComponent;
ASSERT_EQ(SC_OK, SecCompEnhanceAdapter::CheckComponentInfoEnhnace(0, compInfo, jsonComponent));
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2024 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 SECURITY_COMPONENT_ENHANCE_ADAPTER_TEST
#define SECURITY_COMPONENT_ENHANCE_ADAPTER_TEST
#include <gtest/gtest.h>
#include "sec_comp_enhance_adapter.h"
namespace OHOS {
namespace Security {
namespace SecurityComponent {
class SecCompEnhanceAdapterTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
} // namespace SecurityComponent
} // namespace Security
} // namespace OHOS
#endif // SECURITY_COMPONENT_ENHANCE_ADAPTER_TEST
+7 -7
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -24,10 +24,9 @@ config("sec_comp_enhance_config") {
]
}
ohos_shared_library("libsecurity_component_enhance_sdk") {
ohos_source_set("security_component_enhance_sdk_src_set") {
subsystem_name = "security"
part_name = "security_component_manager"
output_name = "libsecurity_component_enhance_sdk"
sanitize = {
cfi = true
cfi_cross_dso = true
@@ -44,9 +43,7 @@ ohos_shared_library("libsecurity_component_enhance_sdk") {
sources = [ "src/sec_comp_enhance_kit.cpp" ]
deps = [
"${sec_comp_root_dir}/frameworks:libsecurity_component_enhance_adapter",
]
deps = [ "${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_src_set" ]
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
@@ -56,5 +53,8 @@ ohos_shared_library("libsecurity_component_enhance_sdk") {
"ipc:ipc_single",
]
cflags_cc = [ "-DHILOG_ENABLE" ]
cflags_cc = [
"-DHILOG_ENABLE",
"-fvisibility=hidden",
]
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -20,7 +20,7 @@
namespace OHOS {
namespace Security {
namespace SecurityComponent {
struct SecCompEnhanceKit {
struct __attribute__((visibility("default"))) SecCompEnhanceKit {
static void InitClientEnhance();
static int32_t SetEnhanceCfg(uint8_t* cfg, uint32_t cfgLen);
static int32_t GetPointerEventEnhanceData(void* data, uint32_t dataLen,
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -15,7 +15,7 @@
#ifndef SECURITY_COMPONENT_ENHANCE_KIT_C_H
#define SECURITY_COMPONENT_ENHANCE_KIT_C_H
void InitSecCompClientEnhance(void);
__attribute__((visibility("default"))) void InitSecCompClientEnhance(void);
#endif // SECURITY_COMPONENT_ENHANCE_KIT_C_H
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -17,7 +17,7 @@
#include "sec_comp_enhance_adapter.h"
extern "C" void InitSecCompClientEnhance()
extern "C" __attribute__((visibility("default"))) void InitSecCompClientEnhance()
{
OHOS::Security::SecurityComponent::SecCompEnhanceKit::InitClientEnhance();
}
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -32,10 +32,7 @@ ohos_unittest("sec_comp_enhance_sdk_test") {
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
cflags_cc = [ "-DHILOG_ENABLE" ]
deps = [
"${sec_comp_root_dir}/frameworks:libsecurity_component_enhance_adapter",
"${sec_comp_root_dir}/interfaces/inner_api/enhance_kits:libsecurity_component_enhance_sdk",
]
deps = [ "${sec_comp_root_dir}/interfaces/inner_api/security_component:libsecurity_component_sdk" ]
external_deps = [
"c_utils:utils",
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -32,8 +32,8 @@ static const std::string LIB_PATH = "/system/lib64/";
#else
static const std::string LIB_PATH = "/system/lib/";
#endif
static const std::string ENHANCE_INPUT_INTERFACE_LIB = LIB_PATH + "libsec_comp_input_enhance.z.so";
static const std::string ENHANCE_SRV_INTERFACE_LIB = LIB_PATH + "libsec_comp_service_enhance.z.so";
static const std::string ENHANCE_INPUT_INTERFACE_LIB = LIB_PATH + "libsecurity_component_client_enhance.z.so";
static const std::string ENHANCE_SRV_INTERFACE_LIB = LIB_PATH + "libsecurity_component_service_enhance.z.so";
static constexpr uint32_t MAX_HMAC_SIZE = 64;
} // namespace
@@ -102,116 +102,3 @@ HWTEST_F(SecCompEnhanceTest, GetPoniterEventEnhanceData001, TestSize.Level1)
EXPECT_EQ(result, SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE);
}
}
/**
* @tc.name: EnableInputEnhance001
* @tc.desc: test UnmarshallEnhanceCfg
* @tc.type: FUNC
* @tc.require: AR000HO9IN
*/
HWTEST_F(SecCompEnhanceTest, EnableInputEnhance001, TestSize.Level1)
{
int32_t result = SecCompEnhanceAdapter::EnableInputEnhance();
if (g_srvEnhanceExist) {
EXPECT_EQ(result, SC_OK);
} else {
EXPECT_EQ(result, SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE);
}
}
/**
* @tc.name: DisableInputEnhance001
* @tc.desc: test DisableInputEnhance
* @tc.type: FUNC
* @tc.require: AR000HO9IN
*/
HWTEST_F(SecCompEnhanceTest, DisableInputEnhance001, TestSize.Level1)
{
int32_t result = SecCompEnhanceAdapter::DisableInputEnhance();
if (g_srvEnhanceExist) {
EXPECT_EQ(result, SC_OK);
} else {
EXPECT_EQ(result, SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE);
}
}
/**
* @tc.name: InitEnhanceHandler001
* @tc.desc: test InitEnhanceHandler
* @tc.type: FUNC
* @tc.require: AR000HO9IN
*/
HWTEST_F(SecCompEnhanceTest, InitEnhanceHandler001, TestSize.Level1)
{
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
uint8_t originData[16] = { 0 };
uint32_t dataLen = 16;
uint8_t* enhanceData = nullptr;
uint32_t enHancedataLen = MAX_HMAC_SIZE;
ASSERT_NE(SC_OK,
SecCompEnhanceAdapter::GetPointerEventEnhanceData(originData, dataLen, enhanceData, enHancedataLen));
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompClickEvent touchInfo;
ASSERT_NE(SC_OK, SecCompEnhanceAdapter::CheckExtraInfo(touchInfo));
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
std::string componentInfo;
int32_t scId = 1;
SecCompEnhanceAdapter::EnhanceDataPreprocess(scId, componentInfo);
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompEnhanceAdapter::RegisterScIdEnhance(scId);
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompEnhanceAdapter::DisableInputEnhance();
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompEnhanceAdapter::StartEnhanceService();
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompEnhanceAdapter::ExistEnhanceService();
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompEnhanceAdapter::NotifyProcessDied(scId);
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
std::shared_ptr<SecCompBase> compInfo;
const nlohmann::json jsonComponent;
SecCompEnhanceAdapter::CheckComponentInfoEnhnace(scId, compInfo, jsonComponent);
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = false;
SecCompEnhanceAdapter::GetEnhanceRemoteObject();
}
/**
* @tc.name: InitEnhanceHandler002
* @tc.desc: test InitEnhanceHandler
* @tc.type: FUNC
* @tc.require: AR000HO9IN
*/
HWTEST_F(SecCompEnhanceTest, InitEnhanceHandler002, TestSize.Level1)
{
SecCompEnhanceAdapter::isEnhanceInputHandlerInit = true;
uint8_t cfgData[SEC_COMP_ENHANCE_CFG_SIZE] = { 0 };
SecCompEnhanceAdapter::inputHandler = nullptr;
ASSERT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE,
SecCompEnhanceAdapter::SetEnhanceCfg(cfgData, SEC_COMP_ENHANCE_CFG_SIZE));
uint8_t originData[16] = { 0 };
uint32_t dataLen = 16;
uint8_t* enhanceData = nullptr;
uint32_t enHancedataLen = MAX_HMAC_SIZE;
ASSERT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE,
SecCompEnhanceAdapter::GetPointerEventEnhanceData(originData, dataLen, enhanceData, enHancedataLen));
SecCompClickEvent touchInfo;
SecCompEnhanceAdapter::srvHandler = nullptr;
ASSERT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE, SecCompEnhanceAdapter::CheckExtraInfo(touchInfo));
std::string componentInfo;
int32_t scId = 1;
SecCompEnhanceAdapter::clientHandler = nullptr;
ASSERT_TRUE(SecCompEnhanceAdapter::EnhanceDataPreprocess(componentInfo));
ASSERT_TRUE(SecCompEnhanceAdapter::EnhanceDataPreprocess(scId, componentInfo));
SecCompEnhanceAdapter::RegisterScIdEnhance(scId);
ASSERT_EQ(SecCompEnhanceAdapter::srvHandler, nullptr);
ASSERT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE, SecCompEnhanceAdapter::EnableInputEnhance());
ASSERT_EQ(SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE, SecCompEnhanceAdapter::DisableInputEnhance());
SecCompEnhanceAdapter::StartEnhanceService();
SecCompEnhanceAdapter::ExistEnhanceService();
SecCompEnhanceAdapter::NotifyProcessDied(scId);
std::shared_ptr<SecCompBase> compInfo;
const nlohmann::json jsonComponent;
ASSERT_EQ(SC_OK, SecCompEnhanceAdapter::CheckComponentInfoEnhnace(scId, compInfo, jsonComponent));
ASSERT_EQ(nullptr, SecCompEnhanceAdapter::GetEnhanceRemoteObject());
}
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -20,6 +20,8 @@ config("sec_comp_config") {
include_dirs = [
"include",
"${sec_comp_root_dir}/frameworks/common/include",
"${sec_comp_root_dir}/frameworks/enhance_adapter/include/",
"${sec_comp_root_dir}/interfaces/inner_api/enhance_kits/include",
"//third_party/json/include",
]
}
@@ -34,6 +36,8 @@ ohos_shared_library("libsecurity_component_sdk") {
include_dirs = [
"include",
"${sec_comp_root_dir}/frameworks/common/include",
"${sec_comp_root_dir}/frameworks/enhance_adapter/include/",
"${sec_comp_root_dir}/interfaces/inner_api/enhance_kits/include",
"${sec_comp_root_dir}/frameworks/security_component/include",
]
@@ -48,8 +52,9 @@ ohos_shared_library("libsecurity_component_sdk") {
]
deps = [
"${sec_comp_root_dir}/frameworks:libsecurity_component_enhance_adapter",
"${sec_comp_root_dir}/frameworks:libsecurity_component_framework",
"${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_src_set",
"${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
"${sec_comp_root_dir}/interfaces/inner_api/enhance_kits:security_component_enhance_sdk_src_set",
]
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
@@ -63,5 +68,8 @@ ohos_shared_library("libsecurity_component_sdk") {
"samgr:samgr_proxy",
]
cflags_cc = [ "-DHILOG_ENABLE" ]
cflags_cc = [
"-DHILOG_ENABLE",
"-fvisibility=hidden",
]
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -44,7 +44,7 @@ enum class LocationIcon : int32_t {
MAX_ICON_TYPE
};
class LocationButton : public SecCompBase {
class __attribute__((visibility("default"))) LocationButton : public SecCompBase {
public:
virtual bool IsTextIconTypeValid() override;
virtual bool IsCorrespondenceType() override;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -33,7 +33,7 @@ enum class PasteIcon : int32_t {
MAX_ICON_TYPE
};
class PasteButton : public SecCompBase {
class __attribute__((visibility("default"))) PasteButton : public SecCompBase {
public:
virtual bool IsTextIconTypeValid() override;
virtual bool IsCorrespondenceType() override;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -41,7 +41,7 @@ enum class SaveIcon : int32_t {
MAX_ICON_TYPE
};
class SaveButton : public SecCompBase {
class __attribute__((visibility("default"))) SaveButton : public SecCompBase {
public:
virtual bool IsTextIconTypeValid() override;
virtual bool IsCorrespondenceType() override;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -35,7 +35,7 @@ enum class SecCompBackground {
MAX_BG_TYPE
};
class JsonTagConstants final {
class __attribute__((visibility("default"))) JsonTagConstants final {
public:
static const std::string JSON_RECT;
static const std::string JSON_SC_TYPE;
@@ -74,7 +74,7 @@ public:
static const std::string JSON_WINDOW_ID;
};
class SecCompBase {
class __attribute__((visibility("default"))) SecCompBase {
public:
SecCompBase() = default;
virtual ~SecCompBase() = default;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -24,7 +24,7 @@
namespace OHOS {
namespace Security {
namespace SecurityComponent {
class SecCompKit {
class __attribute__((visibility("default"))) SecCompKit {
public:
static int32_t RegisterSecurityComponent(SecCompType type, std::string& componentInfo, int32_t& scId);
static int32_t UpdateSecurityComponent(int32_t scId, std::string& componentInfo);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -20,7 +20,7 @@
namespace OHOS {
namespace Security {
namespace SecurityComponent {
class SecCompUiRegister {
class __attribute__((visibility("default"))) SecCompUiRegister {
public:
SecCompUiRegister(std::vector<uintptr_t>& callerList, ISecCompProbe* probe);
virtual ~SecCompUiRegister() = default;
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -28,6 +28,13 @@ ohos_unittest("sec_comp_sdk_test") {
]
sources = [
"${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_caller_authorization.cpp",
"${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_client.cpp",
"${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_death_recipient.cpp",
"${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_kit.cpp",
"${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_load_callback.cpp",
"${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_proxy.cpp",
"${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_ui_register.cpp",
"unittest/src/location_button_test.cpp",
"unittest/src/paste_button_test.cpp",
"unittest/src/save_button_test.cpp",
@@ -42,8 +49,9 @@ ohos_unittest("sec_comp_sdk_test") {
}
deps = [
"${sec_comp_root_dir}/frameworks:libsecurity_component_framework",
"${sec_comp_root_dir}/interfaces/inner_api/security_component:libsecurity_component_sdk",
"${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_src_set",
"${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
"${sec_comp_root_dir}/interfaces/inner_api/enhance_kits:security_component_enhance_sdk_src_set",
]
external_deps = [
@@ -52,6 +60,7 @@ ohos_unittest("sec_comp_sdk_test") {
"hilog:libhilog",
"hisysevent:libhisysevent",
"ipc:ipc_core",
"samgr:samgr_proxy",
]
}
@@ -71,17 +80,16 @@ ohos_unittest("sec_comp_register_callback_test") {
"unittest/src/test_common.cpp",
]
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
cflags_cc = [ "-DHILOG_ENABLE" ]
cflags_cc = [
"-DHILOG_ENABLE",
"-O0",
]
if (security_component_enhance_enable) {
cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ]
}
deps = [
"${sec_comp_root_dir}/frameworks:libsecurity_component_enhance_adapter",
"${sec_comp_root_dir}/frameworks:libsecurity_component_framework",
"${sec_comp_root_dir}/interfaces/inner_api/security_component:libsecurity_component_sdk",
]
deps = [ "${sec_comp_root_dir}/interfaces/inner_api/security_component:libsecurity_component_sdk" ]
external_deps = [
"access_token:libaccesstoken_sdk",
@@ -90,6 +98,7 @@ ohos_unittest("sec_comp_register_callback_test") {
"hilog:libhilog",
"hisysevent:libhisysevent",
"ipc:ipc_core",
"samgr:samgr_proxy",
]
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -15,23 +15,22 @@
#include <gtest/gtest.h>
#include "i_sec_comp_probe.h"
#include "location_button.h"
#define private public
#include "sec_comp_caller_authorization.h"
#include "sec_comp_client.h"
#undef private
#include "sec_comp_enhance_adapter.h"
#include "sec_comp_enhance_kit.h"
#include "sec_comp_err.h"
#include "sec_comp_info.h"
#include "sec_comp_kit.h"
#include "sec_comp_log.h"
#include "sec_comp_tool.h"
#include "sec_comp_ui_register.h"
#include "system_ability_load_callback_stub.h"
#include "test_common.h"
#include "token_setproc.h"
using namespace testing::ext;
using namespace OHOS::Security::SecurityComponent;
using namespace OHOS::Security::AccessToken;
using namespace OHOS;
namespace {
static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {
@@ -51,12 +50,36 @@ public:
};
static MockUiSecCompProbe g_probe;
static __attribute__((noinline)) int32_t RegisterSecurityComponent(
SecCompType type, std::string& componentInfo, int32_t& scId)
{
SC_LOG_INFO(LABEL, "RegisterSecurityComponent enter");
return SecCompKit::RegisterSecurityComponent(type, componentInfo, scId);
}
static __attribute__((noinline)) int32_t ReportSecurityComponentClickEvent(
int32_t scId, std::string& componentInfo,
const SecCompClickEvent& clickInfo, sptr<IRemoteObject> callerToken)
{
SC_LOG_INFO(LABEL, "ReportSecurityComponentClickEvent enter");
return SecCompKit::ReportSecurityComponentClickEvent(scId, componentInfo, clickInfo, callerToken);
}
static __attribute__((noinline)) int32_t UpdateSecurityComponent(int32_t scId, std::string& componentInfo)
{
SC_LOG_INFO(LABEL, "UpdateSecurityComponent enter");
return SecCompKit::UpdateSecurityComponent(scId, componentInfo);
}
static void InitUiRegister()
{
std::vector<uintptr_t> callerList;
std::vector<uintptr_t> callerList = {
reinterpret_cast<uintptr_t>(RegisterSecurityComponent),
reinterpret_cast<uintptr_t>(ReportSecurityComponentClickEvent),
reinterpret_cast<uintptr_t>(UpdateSecurityComponent)
};
SecCompUiRegister registerCallback(callerList, &g_probe);
SecCompCallerAuthorization::GetInstance().kitCallerList_.clear();
SecCompCallerAuthorization::GetInstance().isInit_ = false;
}
} // namespace
@@ -96,32 +119,6 @@ void SecCompRegisterCallbackTest::TearDown()
SC_LOG_INFO(LABEL, "TearDown.");
}
/**
* @tc.name: RegisterWithoutPreprocess001
* @tc.desc: test register without preprocess
* @tc.type: FUNC
* @tc.require: AR000HO9JM
*/
HWTEST_F(SecCompRegisterCallbackTest, RegisterWithoutPreprocess001, TestSize.Level1)
{
nlohmann::json jsonRes;
TestCommon::BuildLocationComponentInfo(jsonRes);
std::string locationInfo = jsonRes.dump();
SecCompEnhanceAdapter::InitEnhanceHandler(SEC_COMP_ENHANCE_CLIENT_INTERFACE);
int32_t scId;
#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
ASSERT_EQ(SC_ENHANCE_ERROR_CHALLENGE_CHECK_FAIL,
SecCompClient::GetInstance().RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_EQ(-1, scId);
#else
ASSERT_EQ(SC_OK,
SecCompClient::GetInstance().RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_NE(-1, scId);
EXPECT_EQ(SC_OK, SecCompClient::GetInstance().UnregisterSecurityComponent(scId));
#endif
}
/**
* @tc.name: RegisterSecurityComponent001
* @tc.desc: test register security component success.
@@ -137,7 +134,7 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent001, TestSize.Lev
g_probe.mockRes = 0;
int32_t scId;
ASSERT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_EQ(SC_OK, RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_NE(-1, scId);
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
@@ -160,11 +157,11 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent002, TestSize.Lev
int32_t scId;
#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
ASSERT_EQ(SC_ENHANCE_ERROR_CALLBACK_OPER_FAIL,
SecCompKit::RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_EQ(-1, scId);
#else
ASSERT_EQ(SC_OK,
SecCompKit::RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_NE(-1, scId);
ASSERT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
#endif
@@ -185,7 +182,7 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent003, TestSize.Lev
g_probe.mockRes = 0;
int32_t scId;
ASSERT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_EQ(SC_OK, RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
}
@@ -203,7 +200,7 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent004, TestSize.Lev
std::string saveInfo = jsonRes.dump();
int32_t scId;
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -215,11 +212,11 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent004, TestSize.Lev
clickInfo.extraInfo.dataSize = TestCommon::MAX_HMAC_SIZE;
clickInfo.extraInfo.data = data;
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
EXPECT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
system("param set sec.comp.enhance 0");
}
@@ -238,7 +235,7 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent005, TestSize.Lev
std::string saveInfo = jsonRes.dump();
int32_t scId;
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -249,11 +246,11 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent005, TestSize.Lev
};
clickInfo.extraInfo.dataSize = TestCommon::MAX_HMAC_SIZE;
clickInfo.extraInfo.data = data;
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
EXPECT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
system("param set sec.comp.enhance 0");
}
@@ -271,7 +268,7 @@ HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent006, TestSize.Lev
std::string saveInfo = jsonRes.dump();
int32_t scId;
setuid(100);
EXPECT_EQ(SC_SERVICE_ERROR_VALUE_INVALID, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_SERVICE_ERROR_VALUE_INVALID, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
}
/**
@@ -288,7 +285,7 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportSecurityComponentClickEvent001, Test
std::string saveInfo = jsonRes.dump();
int32_t scId;
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -300,11 +297,11 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportSecurityComponentClickEvent001, Test
clickInfo.extraInfo.dataSize = TestCommon::MAX_HMAC_SIZE;
clickInfo.extraInfo.data = data;
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
ASSERT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
uint32_t selfTokenId = GetSelfTokenID();
ASSERT_FALSE(SecCompKit::VerifySavePermission(selfTokenId));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
@@ -326,7 +323,7 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportSecurityComponentClickEvent002, Test
int32_t scId;
ASSERT_EQ(0, SetSelfTokenID(TestCommon::HAP_TOKEN_ID));
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -339,11 +336,11 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportSecurityComponentClickEvent002, Test
clickInfo.extraInfo.data = data;
setuid(100);
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
ASSERT_EQ(SC_SERVICE_ERROR_VALUE_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
setuid(g_selfUid);
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
system("param set sec.comp.enhance 0");
@@ -363,7 +360,7 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportSecurityComponentClickEvent003, Test
int32_t scId;
ASSERT_EQ(0, SetSelfTokenID(TestCommon::HAP_TOKEN_ID));
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -372,11 +369,11 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportSecurityComponentClickEvent003, Test
.point.timestamp = static_cast<uint64_t>(
std::chrono::high_resolution_clock::now().time_since_epoch().count()) / TestCommon::TIME_CONVERSION_UNIT
};
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
ASSERT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
}
@@ -396,7 +393,7 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportClickWithoutHmac001, TestSize.Level1
g_probe.mockRes = 0;
int32_t scId;
ASSERT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_EQ(SC_OK, RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
ASSERT_NE(-1, scId);
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
@@ -408,11 +405,11 @@ HWTEST_F(SecCompRegisterCallbackTest, ReportClickWithoutHmac001, TestSize.Level1
};
clickInfo.extraInfo.dataSize = TestCommon::MAX_HMAC_SIZE;
clickInfo.extraInfo.data = data;
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
EXPECT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, locationInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, locationInfo, clickInfo, token));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
system("param set sec.comp.enhance 0");
}
@@ -432,7 +429,7 @@ HWTEST_F(SecCompRegisterCallbackTest, VerifySavePermission001, TestSize.Level1)
int32_t scId;
ASSERT_EQ(0, SetSelfTokenID(TestCommon::HAP_TOKEN_ID));
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -443,11 +440,11 @@ HWTEST_F(SecCompRegisterCallbackTest, VerifySavePermission001, TestSize.Level1)
};
clickInfo.extraInfo.dataSize = TestCommon::MAX_HMAC_SIZE;
clickInfo.extraInfo.data = data;
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
ASSERT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
setuid(100);
ASSERT_FALSE(SecCompKit::VerifySavePermission(TestCommon::HAP_TOKEN_ID));
// mediaLibraryTokenId_ != 0
@@ -471,7 +468,7 @@ HWTEST_F(SecCompRegisterCallbackTest, VerifySavePermission002, TestSize.Level1)
std::string saveInfo = jsonRes.dump();
int32_t scId;
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -482,11 +479,11 @@ HWTEST_F(SecCompRegisterCallbackTest, VerifySavePermission002, TestSize.Level1)
};
clickInfo.extraInfo.dataSize = TestCommon::MAX_HMAC_SIZE;
clickInfo.extraInfo.data = data;
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
ASSERT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ASSERT_FALSE(SecCompKit::VerifySavePermission(0));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
system("param set sec.comp.enhance 0");
@@ -506,7 +503,7 @@ HWTEST_F(SecCompRegisterCallbackTest, UnregisterSecurityComponent001, TestSize.L
std::string saveInfo = jsonRes.dump();
int32_t scId;
EXPECT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
EXPECT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
uint8_t data[TestCommon::MAX_HMAC_SIZE] = { 0 };
struct SecCompClickEvent clickInfo = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -517,11 +514,11 @@ HWTEST_F(SecCompRegisterCallbackTest, UnregisterSecurityComponent001, TestSize.L
};
clickInfo.extraInfo.dataSize = TestCommon::MAX_HMAC_SIZE;
clickInfo.extraInfo.data = data;
auto proxy = SecCompClient::GetInstance().GetProxy(true);
ASSERT_NE(proxy, nullptr);
auto token = proxy->AsObject();
sptr<SystemAbilityLoadCallbackStub> callback = new (std::nothrow) SystemAbilityLoadCallbackStub();
ASSERT_NE(callback, nullptr);
auto token = callback->AsObject();
EXPECT_EQ(SC_SERVICE_ERROR_CLICK_EVENT_INVALID,
SecCompKit::ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
ReportSecurityComponentClickEvent(scId, saveInfo, clickInfo, token));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
system("param set sec.comp.enhance 0");
}
@@ -538,9 +535,9 @@ HWTEST_F(SecCompRegisterCallbackTest, UpdateSecurityComponent001, TestSize.Level
TestCommon::BuildSaveComponentInfo(jsonRes);
std::string saveInfo = jsonRes.dump();
int32_t scId;
ASSERT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
ASSERT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
ASSERT_NE(-1, scId);
ASSERT_EQ(SC_OK, SecCompKit::UpdateSecurityComponent(scId, saveInfo));
ASSERT_EQ(SC_OK, UpdateSecurityComponent(scId, saveInfo));
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
}
@@ -558,10 +555,10 @@ HWTEST_F(SecCompRegisterCallbackTest, UpdateSecurityComponent002, TestSize.Level
int32_t scId;
ASSERT_EQ(0, SetSelfTokenID(TestCommon::HAP_TOKEN_ID));
ASSERT_EQ(SC_OK, SecCompKit::RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
ASSERT_EQ(SC_OK, RegisterSecurityComponent(SAVE_COMPONENT, saveInfo, scId));
ASSERT_NE(-1, scId);
setuid(100);
ASSERT_EQ(SC_SERVICE_ERROR_VALUE_INVALID, SecCompKit::UpdateSecurityComponent(scId, saveInfo));
ASSERT_EQ(SC_SERVICE_ERROR_VALUE_INVALID, UpdateSecurityComponent(scId, saveInfo));
setuid(g_selfUid);
EXPECT_EQ(SC_OK, SecCompKit::UnregisterSecurityComponent(scId));
}
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -32,7 +32,7 @@ ohos_prebuilt_etc("security_component_service.rc") {
part_name = "security_component_manager"
}
ohos_shared_library("security_component_service") {
ohos_source_set("security_component_service_src_set") {
subsystem_name = "security"
part_name = "security_component_manager"
sanitize = {
@@ -65,13 +65,16 @@ ohos_shared_library("security_component_service") {
"sa_main/window_info_helper.cpp",
]
cflags_cc = [ "-DHILOG_ENABLE" ]
cflags_cc = [
"-DHILOG_ENABLE",
"-fvisibility=hidden",
]
cflags = [ "-DHILOG_ENABLE" ]
deps = [
":security_component_service.rc",
"${sec_comp_root_dir}/frameworks:libsecurity_component_enhance_adapter",
"${sec_comp_root_dir}/frameworks:libsecurity_component_framework",
"${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_src_set",
"${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
]
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
@@ -97,3 +100,23 @@ ohos_shared_library("security_component_service") {
"window_manager:libwm",
]
}
ohos_shared_library("security_component_service") {
subsystem_name = "security"
part_name = "security_component_manager"
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
deps = [
":security_component_service.rc",
":security_component_service_src_set",
"${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_src_set",
"${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
]
public_configs = [ ":security_component_service_config" ]
}
@@ -23,7 +23,7 @@ namespace SecurityComponent {
namespace {
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SECURITY_DOMAIN_SECURITY_COMPONENT, "DelayExitTask"};
static const std::string DELAY_EXIT_TASK = "DelayExitTask";
static const int32_t DELAY_EXIT_MILLISECONDS = 10 * 60 * 1000; // 10m
static const int32_t DELAY_EXIT_MILLISECONDS = 120 * 1000; // 2m
}
DelayExitTask::DelayExitTask()
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,7 +23,7 @@
namespace OHOS {
namespace Security {
namespace SecurityComponent {
class DelayExitTask {
class __attribute__((visibility("default"))) DelayExitTask {
public:
static DelayExitTask& GetInstance();
virtual ~DelayExitTask() = default;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -35,7 +35,7 @@ T* ConstructComponent(const nlohmann::json& jsonComponent)
return componentPtr;
}
class SecCompInfoHelper {
class __attribute__((visibility("default"))) SecCompInfoHelper {
public:
static SecCompBase* ParseComponent(SecCompType type, const nlohmann::json& jsonComponent);
static int32_t GrantTempPermission(AccessToken::AccessTokenID tokenId,
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -30,7 +30,7 @@ namespace OHOS {
namespace Security {
namespace SecurityComponent {
enum class ServiceRunningState { STATE_NOT_START, STATE_RUNNING };
class SecCompService final : public SystemAbility, public SecCompStub {
class __attribute__((visibility("default"))) SecCompService final : public SystemAbility, public SecCompStub {
DECLARE_DELAYED_SINGLETON(SecCompService);
DECLEAR_SYSTEM_ABILITY(SecCompService);
@@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -66,8 +66,8 @@ ohos_unittest("sec_comp_service_test") {
}
deps = [
"${sec_comp_root_dir}/frameworks:libsecurity_component_enhance_adapter",
"${sec_comp_root_dir}/frameworks:libsecurity_component_framework",
"${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_src_set",
"${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
"//third_party/googletest:gmock_main",
]
@@ -135,7 +135,7 @@ ohos_unittest("sec_comp_service_mock_test") {
cflags_cc = [ "-DHILOG_ENABLE" ]
deps = [
"${sec_comp_root_dir}/frameworks:libsecurity_component_framework",
"${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
"//third_party/googletest:gmock_main",
]
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -134,11 +134,7 @@ HWTEST_F(SecCompEntityTest, CheckClickInfo001, TestSize.Level1)
entity_->componentInfo_->rect_.y_ = ServiceTestCommon::TEST_COORDINATE;
touch.point.timestamp = static_cast<uint64_t>(
std::chrono::high_resolution_clock::now().time_since_epoch().count()) / ServiceTestCommon::TIME_CONVERSION_UNIT;
#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
ASSERT_NE(entity_->CheckClickInfo(touch), SC_OK);
#else
ASSERT_EQ(entity_->CheckClickInfo(touch), SC_OK);
#endif
}
/**
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -324,14 +324,8 @@ HWTEST_F(SecCompManagerTest, RegisterSecurityComponent001, TestSize.Level1)
LocationButton buttonValid = BuildValidLocationComponent();
buttonValid.ToJson(jsonValid);
#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
// callback check failed
EXPECT_EQ(SC_ENHANCE_ERROR_CALLBACK_NOT_EXIST,
SecCompManager::GetInstance().RegisterSecurityComponent(LOCATION_COMPONENT, jsonValid, caller, scId));
#else
EXPECT_EQ(SC_OK,
SecCompManager::GetInstance().RegisterSecurityComponent(LOCATION_COMPONENT, jsonValid, caller, scId));
#endif
SecCompManager::GetInstance().malicious_.maliciousAppList_.clear();
}
@@ -370,13 +364,8 @@ HWTEST_F(SecCompManagerTest, UpdateSecurityComponent001, TestSize.Level1)
SecCompManager::GetInstance().UpdateSecurityComponent(ServiceTestCommon::TEST_SC_ID_1, jsonInvalid, caller));
// no enhance data
#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
EXPECT_NE(SC_OK,
SecCompManager::GetInstance().UpdateSecurityComponent(ServiceTestCommon::TEST_SC_ID_1, jsonValid, caller));
#else
EXPECT_EQ(SC_OK,
SecCompManager::GetInstance().UpdateSecurityComponent(ServiceTestCommon::TEST_SC_ID_1, jsonValid, caller));
#endif
SecCompManager::GetInstance().malicious_.maliciousAppList_.clear();
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@@ -260,13 +260,8 @@ HWTEST_F(SecCompServiceTest, ReportSecurityComponentClickEvent001, TestSize.Leve
};
secCompService_->appStateObserver_->AddProcessToForegroundSet(stateData);
#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
EXPECT_EQ(SC_ENHANCE_ERROR_CALLBACK_NOT_EXIST,
secCompService_->RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
#else
EXPECT_EQ(SC_OK,
secCompService_->RegisterSecurityComponent(LOCATION_COMPONENT, locationInfo, scId));
#endif
uint8_t data[16] = { 0 };
struct SecCompClickEvent touch = {
.type = ClickEventType::POINT_EVENT_TYPE,
@@ -278,18 +273,9 @@ HWTEST_F(SecCompServiceTest, ReportSecurityComponentClickEvent001, TestSize.Leve
.extraInfo.data = data,
.extraInfo.dataSize = 16,
};
#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
EXPECT_EQ(SC_ENHANCE_ERROR_IN_MALICIOUS_LIST,
secCompService_->ReportSecurityComponentClickEvent(scId, locationInfo, touch, nullptr));
// already in malicious list
EXPECT_EQ(SC_ENHANCE_ERROR_IN_MALICIOUS_LIST,
secCompService_->ReportSecurityComponentClickEvent(scId, locationInfo, touch, nullptr));
EXPECT_EQ(SC_SERVICE_ERROR_COMPONENT_NOT_EXIST, secCompService_->UnregisterSecurityComponent(scId));
#else
EXPECT_EQ(SC_OK,
secCompService_->ReportSecurityComponentClickEvent(scId, locationInfo, touch, nullptr));
EXPECT_EQ(SC_OK, secCompService_->UnregisterSecurityComponent(scId));
#endif
setuid(uid);
}
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -36,7 +36,7 @@ ohos_fuzztest("GetEnhanceRemoteObjectInnerFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "getenhanceremoteobjectInner_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service_src_set" ]
external_deps = [
"ability_runtime:app_manager",
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -36,7 +36,7 @@ ohos_fuzztest("GetPointerEventEnhanceDataFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "getpointereventenhancedata_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/interfaces/inner_api/enhance_kits:libsecurity_component_enhance_sdk" ]
deps = [ "${sec_comp_dir}/interfaces/inner_api/security_component:libsecurity_component_sdk" ]
external_deps = [
"ability_base:want",
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -36,7 +36,7 @@ ohos_fuzztest("RegisterSecurityComponentInnerFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "registersecuritycomponentInner_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service_src_set" ]
external_deps = [
"ability_runtime:app_manager",
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -36,7 +36,7 @@ ohos_fuzztest("ReportSecurityComponentClickEventInnerFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "reportsecuritycomponentclickeventInner_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service_src_set" ]
external_deps = [
"ability_runtime:app_manager",
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -37,7 +37,7 @@ ohos_fuzztest("SetEnhanceCfgFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "setenhancecfg_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/interfaces/inner_api/enhance_kits:libsecurity_component_enhance_sdk" ]
deps = [ "${sec_comp_dir}/interfaces/inner_api/security_component:libsecurity_component_sdk" ]
external_deps = [
"ability_base:want",
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -36,7 +36,7 @@ ohos_fuzztest("UnregisterSecurityComponentInnerFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "unregistersecuritycomponentInner_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service_src_set" ]
external_deps = [
"ability_runtime:app_manager",
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -36,7 +36,7 @@ ohos_fuzztest("UpdateSecurityComponentInnerFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "updatesecuritycomponentInner_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service_src_set" ]
external_deps = [
"ability_runtime:app_manager",
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 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
@@ -36,7 +36,7 @@ ohos_fuzztest("VerifySavePermissionInnerFuzzTest") {
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "verifysavepermissionInner_fuzzer.cpp" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service" ]
deps = [ "${sec_comp_dir}/services/security_component_service/sa:security_component_service_src_set" ]
external_deps = [
"ability_runtime:app_manager",