diff --git a/frameworks/privacy/include/sec_comp_enhance_data_parcel.h b/frameworks/accesstoken/include/sec_comp_enhance_data_parcel.h similarity index 100% rename from frameworks/privacy/include/sec_comp_enhance_data_parcel.h rename to frameworks/accesstoken/include/sec_comp_enhance_data_parcel.h diff --git a/frameworks/privacy/src/sec_comp_enhance_data_parcel.cpp b/frameworks/accesstoken/src/sec_comp_enhance_data_parcel.cpp similarity index 100% rename from frameworks/privacy/src/sec_comp_enhance_data_parcel.cpp rename to frameworks/accesstoken/src/sec_comp_enhance_data_parcel.cpp diff --git a/interfaces/innerkits/privacy/BUILD.gn b/interfaces/innerkits/privacy/BUILD.gn index 1b1c41ad0a5461d716ed2cd5b95eca43b8e9a2c3..a037ed863178f1660a7b60cc183c18de9cb08d7c 100644 --- a/interfaces/innerkits/privacy/BUILD.gn +++ b/interfaces/innerkits/privacy/BUILD.gn @@ -83,10 +83,6 @@ if (is_standard_system) { "-DDEBUG_API_PERFORMANCE", ] - if (security_component_enhance_enable == true) { - cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ] - } - if (build_variant == "user") { cflags_cc += [ "-DATM_BUILD_VARIANT_USER_ENABLE" ] } diff --git a/services/privacymanager/include/seccomp/privacy_sec_comp_enhance_agent.h b/services/accesstokenmanager/main/cpp/include/seccomp/sec_comp_enhance_agent.h similarity index 100% rename from services/privacymanager/include/seccomp/privacy_sec_comp_enhance_agent.h rename to services/accesstokenmanager/main/cpp/include/seccomp/sec_comp_enhance_agent.h diff --git a/services/accesstokenmanager/main/cpp/include/seccomp/sec_comp_enhance_agent.h.orig b/services/accesstokenmanager/main/cpp/include/seccomp/sec_comp_enhance_agent.h.orig new file mode 100644 index 0000000000000000000000000000000000000000..631a15b2ec0b297bcfb5c05934d56e8eca94aac2 --- /dev/null +++ b/services/accesstokenmanager/main/cpp/include/seccomp/sec_comp_enhance_agent.h.orig @@ -0,0 +1,74 @@ +/* + * 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 SEC_COMP_ENHANCE_AGENT_H +#define SEC_COMP_ENHANCE_AGENT_H + +#include +#include +#include "app_manager_death_callback.h" +#include "app_status_change_callback.h" +#include "nocopyable.h" +#include "sec_comp_enhance_data.h" + +namespace OHOS { +namespace Security { +namespace AccessToken { +class AppUsingSecCompStateObserver : public ApplicationStateObserverStub { +public: + AppUsingSecCompStateObserver() = default; + ~AppUsingSecCompStateObserver() = default; + + void OnProcessDied(const ProcessData &processData) override; + void OnAppCacheStateChanged(const AppStateData &appStateData) override; + DISALLOW_COPY_AND_MOVE(AppUsingSecCompStateObserver); +}; + +class SecCompAppManagerDeathCallback : public AppManagerDeathCallback { +public: + SecCompAppManagerDeathCallback() = default; + ~SecCompAppManagerDeathCallback() = default; + + void NotifyAppManagerDeath() override; + DISALLOW_COPY_AND_MOVE(SecCompAppManagerDeathCallback); +}; + +class SecCompEnhanceAgent final { +public: + static SecCompEnhanceAgent& GetInstance(); + virtual ~SecCompEnhanceAgent(); + + int32_t RegisterSecCompEnhance(const SecCompEnhanceData& enhanceData); + int32_t UpdateSecCompEnhance(int32_t pid, uint32_t seqNum); + int32_t GetSecCompEnhance(int32_t pid, SecCompEnhanceData& enhanceData); + int32_t GetSpecialSecCompEnhance(const std::string& bundleName, + std::vector& enhanceList); + void RemoveSecCompEnhance(int pid); + void OnAppMgrRemoteDiedHandle(); + +private: + SecCompEnhanceAgent(); + void InitAppObserver(); + DISALLOW_COPY_AND_MOVE(SecCompEnhanceAgent); + +private: + sptr observer_ = nullptr; + std::shared_ptr appManagerDeathCallback_ = nullptr; + std::mutex secCompEnhanceMutex_; + std::vector secCompEnhanceData_; +}; +} // namespace AccessToken +} // namespace Security +} // namespace OHOS +#endif // SEC_COMP_ENHANCE_AGENT_H diff --git a/services/privacymanager/src/seccomp/privacy_sec_comp_enhance_agent.cpp b/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp similarity index 100% rename from services/privacymanager/src/seccomp/privacy_sec_comp_enhance_agent.cpp rename to services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp diff --git a/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp.orig b/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp.orig new file mode 100644 index 0000000000000000000000000000000000000000..d63b336613ccddb974eef063a1f77d9635ea37ef --- /dev/null +++ b/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp.orig @@ -0,0 +1,192 @@ +/* + * 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_agent.h" + +#include "access_token.h" +#include "access_token_error.h" +#include "accesstoken_kit.h" +#include "accesstoken_log.h" +#include "accesstoken_info_manager.h" +#include "app_manager_access_client.h" +#include "ipc_skeleton.h" +#include "securec.h" + +namespace OHOS { +namespace Security { +namespace AccessToken { +namespace { +static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { + LOG_CORE, SECURITY_DOMAIN_PRIVACY, "PrivacySecCompEnhanceAgent" +}; +static const std::string SCENE_BOARD_PKG_NAME = "com.ohos.sceneboard"; +std::recursive_mutex g_instanceMutex; +} +void PrivacyAppUsingSecCompStateObserver::OnProcessDied(const ProcessData &processData) +{ + ACCESSTOKEN_LOG_INFO(LABEL, "OnProcessDied pid %{public}d", processData.pid); + PrivacySecCompEnhanceAgent::GetInstance().RemoveSecCompEnhance(processData.pid); +} + +void PrivacySecCompAppManagerDeathCallback::NotifyAppManagerDeath() +{ + ACCESSTOKEN_LOG_INFO(LABEL, "AppManagerDeath called"); + + PrivacySecCompEnhanceAgent::GetInstance().OnAppMgrRemoteDiedHandle(); +} + +PrivacySecCompEnhanceAgent& PrivacySecCompEnhanceAgent::GetInstance() +{ + static PrivacySecCompEnhanceAgent* instance = nullptr; + if (instance == nullptr) { + std::lock_guard lock(g_instanceMutex); + if (instance == nullptr) { + PrivacySecCompEnhanceAgent* tmp = new PrivacySecCompEnhanceAgent(); + instance = std::move(tmp); + } + } + return *instance; +} + +void PrivacySecCompEnhanceAgent::InitAppObserver() +{ + if (observer_ != nullptr) { + return; + } + observer_ = new (std::nothrow) PrivacyAppUsingSecCompStateObserver(); + if (observer_ == nullptr) { + ACCESSTOKEN_LOG_ERROR(LABEL, "New observer failed."); + return; + } + if (AppManagerAccessClient::GetInstance().RegisterApplicationStateObserver(observer_) != 0) { + ACCESSTOKEN_LOG_ERROR(LABEL, "Register observer failed."); + observer_ = nullptr; + return; + } + if (appManagerDeathCallback_ == nullptr) { + appManagerDeathCallback_ = std::make_shared(); + AppManagerAccessClient::GetInstance().RegisterDeathCallback(appManagerDeathCallback_); + } +} + +SecCompEnhanceAgent::SecCompEnhanceAgent() +{ + InitAppObserver(); +} + +SecCompEnhanceAgent::~SecCompEnhanceAgent() +{ + if (observer_ != nullptr) { + AppManagerAccessClient::GetInstance().UnregisterApplicationStateObserver(observer_); + observer_ = nullptr; + } +} + +void SecCompEnhanceAgent::OnAppMgrRemoteDiedHandle() +{ + ACCESSTOKEN_LOG_INFO(LABEL, "OnAppMgrRemoteDiedHandle."); + std::lock_guard lock(secCompEnhanceMutex_); + secCompEnhanceData_.clear(); + observer_ = nullptr; +} + +void SecCompEnhanceAgent::RemoveSecCompEnhance(int pid) +{ + std::lock_guard lock(secCompEnhanceMutex_); + for (auto iter = secCompEnhanceData_.begin(); iter != secCompEnhanceData_.end(); ++iter) { + if (iter->pid == pid) { + secCompEnhanceData_.erase(iter); + ACCESSTOKEN_LOG_INFO(LABEL, "Remove pid %{public}d data.", pid); + return; + } + } + ACCESSTOKEN_LOG_ERROR(LABEL, "Not found pid %{public}d data.", pid); + return; +} + +int32_t SecCompEnhanceAgent::RegisterSecCompEnhance(const SecCompEnhanceData& enhanceData) +{ + std::lock_guard lock(secCompEnhanceMutex_); + InitAppObserver(); + int pid = IPCSkeleton::GetCallingPid(); + if (std::any_of(secCompEnhanceData_.begin(), secCompEnhanceData_.end(), + [pid](const auto& e) { return e.pid == pid; })) { + ACCESSTOKEN_LOG_ERROR(LABEL, "Register sec comp enhance exist, pid %{public}d.", pid); + return ERR_CALLBACK_ALREADY_EXIST; + } + SecCompEnhanceData enhance; + enhance.callback = enhanceData.callback; + enhance.pid = pid; + enhance.token = IPCSkeleton::GetCallingTokenID(); + enhance.challenge = enhanceData.challenge; + enhance.sessionId = enhanceData.sessionId; + enhance.seqNum = enhanceData.seqNum; + enhance.isSceneBoard = false; + if (memcpy_s(enhance.key, AES_KEY_STORAGE_LEN, enhanceData.key, AES_KEY_STORAGE_LEN) != EOK) { + return PrivacyError::ERR_CALLBACK_ALREADY_EXIST; + } + HapTokenInfo info; + if (AccessTokenKit::GetHapTokenInfo(enhance.token, info) == AccessTokenKitRet::RET_SUCCESS) { + if (info.bundleName == SCENE_BOARD_PKG_NAME) { + enhance.isSceneBoard = true; + } + } + secCompEnhanceData_.emplace_back(enhance); + ACCESSTOKEN_LOG_INFO(LABEL, "Register sec comp enhance success, pid %{public}d, total %{public}u.", + pid, static_cast(secCompEnhanceData_.size())); + return RET_SUCCESS; +} + +int32_t PrivacySecCompEnhanceAgent::UpdateSecCompEnhance(int32_t pid, uint32_t seqNum) +{ + std::lock_guard lock(secCompEnhanceMutex_); + InitAppObserver(); + for (auto iter = secCompEnhanceData_.begin(); iter != secCompEnhanceData_.end(); ++iter) { + if (iter->pid == pid) { + iter->seqNum = seqNum; + ACCESSTOKEN_LOG_INFO(LABEL, "Update pid=%{public}d data successful.", pid); + return RET_SUCCESS; + } + } + return ERR_PARAM_INVALID; +} + +int32_t SecCompEnhanceAgent::GetSecCompEnhance(int32_t pid, SecCompEnhanceData& enhanceData) +{ + std::lock_guard lock(secCompEnhanceMutex_); + InitAppObserver(); + for (auto iter = secCompEnhanceData_.begin(); iter != secCompEnhanceData_.end(); ++iter) { + if (iter->pid == pid) { + enhanceData = *iter; + ACCESSTOKEN_LOG_INFO(LABEL, "Get pid %{public}d data.", pid); + return RET_SUCCESS; + } + } + return ERR_PARAM_INVALID; +} + +int32_t PrivacySecCompEnhanceAgent::GetSpecialSecCompEnhance(const std::string& bundleName, + std::vector& enhanceList) +{ + std::lock_guard lock(secCompEnhanceMutex_); + for (auto iter = secCompEnhanceData_.begin(); iter != secCompEnhanceData_.end(); iter++) { + if ((*iter).isSceneBoard) { + enhanceList.emplace_back(*iter); + } + } + return RET_SUCCESS; +} +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp.rej b/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp.rej new file mode 100644 index 0000000000000000000000000000000000000000..75572ef275bdffc049f7a6335e55f2752b6a06c0 --- /dev/null +++ b/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp.rej @@ -0,0 +1,103 @@ +--- services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_enhance_agent.cpp ++++ services/privacymanager/src/seccomp/privacy_sec_comp_enhance_agent.cpp +@@ -27,50 +26,42 @@ namespace Security { + namespace AccessToken { + namespace { + static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { +- LOG_CORE, SECURITY_DOMAIN_ACCESSTOKEN, "SecCompEnhanceAgent" ++ LOG_CORE, SECURITY_DOMAIN_PRIVACY, "PrivacySecCompEnhanceAgent" + }; + std::recursive_mutex g_instanceMutex; + } +-void AppUsingSecCompStateObserver::OnProcessDied(const ProcessData &processData) ++void PrivacyAppUsingSecCompStateObserver::OnProcessDied(const ProcessData &processData) + { + ACCESSTOKEN_LOG_INFO(LABEL, "OnProcessDied pid %{public}d", processData.pid); +- SecCompEnhanceAgent::GetInstance().RemoveSecCompEnhance(processData.pid); ++ PrivacySecCompEnhanceAgent::GetInstance().RemoveSecCompEnhance(processData.pid); + } + +-void AppUsingSecCompStateObserver::OnAppCacheStateChanged(const AppStateData &appStateData) +-{ +- uint32_t tokenID = appStateData.accessTokenId; +- ACCESSTOKEN_LOG_INFO(LABEL, "OnAppCacheStateChanged, id(%{public}u), id(%{public}d), state(%{public}d).", +- appStateData.accessTokenId, appStateData.pid, appStateData.state); +- SecCompEnhanceAgent::GetInstance().RemoveSecCompEnhance(appStateData.pid); +-} +- +-void SecCompAppManagerDeathCallback::NotifyAppManagerDeath() ++void PrivacySecCompAppManagerDeathCallback::NotifyAppManagerDeath() + { + ACCESSTOKEN_LOG_INFO(LABEL, "AppManagerDeath called"); + +- SecCompEnhanceAgent::GetInstance().OnAppMgrRemoteDiedHandle(); ++ PrivacySecCompEnhanceAgent::GetInstance().OnAppMgrRemoteDiedHandle(); + } + +-SecCompEnhanceAgent& SecCompEnhanceAgent::GetInstance() ++PrivacySecCompEnhanceAgent& PrivacySecCompEnhanceAgent::GetInstance() + { +- static SecCompEnhanceAgent* instance = nullptr; ++ static PrivacySecCompEnhanceAgent* instance = nullptr; + if (instance == nullptr) { + std::lock_guard lock(g_instanceMutex); + if (instance == nullptr) { +- SecCompEnhanceAgent* tmp = new SecCompEnhanceAgent(); ++ PrivacySecCompEnhanceAgent* tmp = new PrivacySecCompEnhanceAgent(); + instance = std::move(tmp); + } + } + return *instance; + } + +-void SecCompEnhanceAgent::InitAppObserver() ++void PrivacySecCompEnhanceAgent::InitAppObserver() + { + if (observer_ != nullptr) { + return; + } +- observer_ = new (std::nothrow) AppUsingSecCompStateObserver(); ++ observer_ = new (std::nothrow) PrivacyAppUsingSecCompStateObserver(); + if (observer_ == nullptr) { + ACCESSTOKEN_LOG_ERROR(LABEL, "New observer failed."); + return; +@@ -139,15 +130,15 @@ int32_t PrivacySecCompEnhanceAgent::RegisterSecCompEnhance(const SecCompEnhanceD + enhance.sessionId = enhanceData.sessionId; + enhance.seqNum = enhanceData.seqNum; + if (memcpy_s(enhance.key, AES_KEY_STORAGE_LEN, enhanceData.key, AES_KEY_STORAGE_LEN) != EOK) { +- return ERR_CALLBACK_ALREADY_EXIST; ++ return PrivacyError::ERR_CALLBACK_ALREADY_EXIST; + } + secCompEnhanceData_.emplace_back(enhance); +- ACCESSTOKEN_LOG_INFO(LABEL, "Register sec comp enhance success, id %{public}u, pid %{public}d, total %{public}u.", +- enhance.token, pid, static_cast(secCompEnhanceData_.size())); ++ ACCESSTOKEN_LOG_INFO(LABEL, "Register sec comp enhance success, pid %{public}d, total %{public}u.", ++ pid, static_cast(secCompEnhanceData_.size())); + return RET_SUCCESS; + } + +-int32_t SecCompEnhanceAgent::UpdateSecCompEnhance(int32_t pid, uint32_t seqNum) ++int32_t PrivacySecCompEnhanceAgent::UpdateSecCompEnhance(int32_t pid, uint32_t seqNum) + { + std::lock_guard lock(secCompEnhanceMutex_); + InitAppObserver(); +@@ -175,16 +166,14 @@ int32_t PrivacySecCompEnhanceAgent::GetSecCompEnhance(int32_t pid, SecCompEnhanc + return ERR_PARAM_INVALID; + } + +-int32_t SecCompEnhanceAgent::GetSpecialSecCompEnhance(const std::string& bundleName, ++int32_t PrivacySecCompEnhanceAgent::GetSpecialSecCompEnhance(const std::string& bundleName, + std::vector& enhanceList) + { + std::lock_guard lock(secCompEnhanceMutex_); + for (auto iter = secCompEnhanceData_.begin(); iter != secCompEnhanceData_.end(); iter++) { + HapTokenInfo info; +- std::shared_ptr infoPtr = +- AccessTokenInfoManager::GetInstance().GetHapTokenInfoInner(iter->token); +- if (infoPtr != nullptr) { +- if (bundleName == infoPtr->GetBundleName()) { ++ if (AccessTokenKit::GetHapTokenInfo(iter->token, info) == AccessTokenKitRet::RET_SUCCESS) { ++ if (bundleName == info.bundleName) { + enhanceList.emplace_back(*iter); + } + } diff --git a/services/privacymanager/src/service/privacy_manager_service.cpp b/services/privacymanager/src/service/privacy_manager_service.cpp index db8673840d07f20c4ac6398ae0277d40547d2f72..38b025fa7b65ed4b4a0230d4453836f6e48bdd0c 100644 --- a/services/privacymanager/src/service/privacy_manager_service.cpp +++ b/services/privacymanager/src/service/privacy_manager_service.cpp @@ -30,9 +30,6 @@ #include "ipc_skeleton.h" #include "permission_record_manager.h" #include "privacy_manager_proxy_death_param.h" -#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE -#include "privacy_sec_comp_enhance_agent.h" -#endif #include "system_ability_definition.h" #include "string_ex.h" @@ -231,45 +228,6 @@ int32_t PrivacyManagerService::RegisterPermActiveStatusCallback( IPCSkeleton::GetCallingTokenID(), permList, callback); } -#ifdef SECURITY_COMPONENT_ENHANCE_ENABLE -int32_t PrivacyManagerService::RegisterSecCompEnhance(const SecCompEnhanceDataParcel& enhanceParcel) -{ - ACCESSTOKEN_LOG_INFO(LABEL, "Pid: %{public}d", enhanceParcel.enhanceData.pid); - return PrivacySecCompEnhanceAgent::GetInstance().RegisterSecCompEnhance(enhanceParcel.enhanceData); -} - -int32_t PrivacyManagerService::UpdateSecCompEnhance(int32_t pid, uint32_t seqNum) -{ - return PrivacySecCompEnhanceAgent::GetInstance().UpdateSecCompEnhance(pid, seqNum); -} - -int32_t PrivacyManagerService::GetSecCompEnhance(int32_t pid, SecCompEnhanceDataParcel& enhanceParcel) -{ - SecCompEnhanceData enhanceData; - int32_t res = PrivacySecCompEnhanceAgent::GetInstance().GetSecCompEnhance(pid, enhanceData); - if (res != RET_SUCCESS) { - ACCESSTOKEN_LOG_WARN(LABEL, "Pid: %{public}d get enhance failed ", pid); - return res; - } - - enhanceParcel.enhanceData = enhanceData; - return RET_SUCCESS; -} - -int32_t PrivacyManagerService::GetSpecialSecCompEnhance(const std::string& bundleName, - std::vector& enhanceParcelList) -{ - std::vector enhanceList; - PrivacySecCompEnhanceAgent::GetInstance().GetSpecialSecCompEnhance(bundleName, enhanceList); - for (const auto& enhance : enhanceList) { - SecCompEnhanceDataParcel parcel; - parcel.enhanceData = enhance; - enhanceParcelList.emplace_back(parcel); - } - return RET_SUCCESS; -} -#endif - int32_t PrivacyManagerService::ResponseDumpCommand(int32_t fd, const std::vector& args) { if (args.size() < 2) { // 2 :need two args 0:command 1:tokenId diff --git a/test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/BUILD.gn b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/BUILD.gn rename to test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/BUILD.gn diff --git a/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/BUILD.gn.orig b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..7103b3a139b6acc3d5f5499b45cdadf3081800c9 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/BUILD.gn.orig @@ -0,0 +1,43 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") + +ohos_fuzztest("GetSecCompEnhanceFuzzTest") { + module_out_path = module_output_path_interface_access_token + fuzz_config_file = "." + include_dirs = [ + "${access_token_path}/interfaces/innerkits/accesstoken/include", + "${access_token_path}/test/fuzztest/common", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "getseccompenhance_fuzzer.cpp" ] + deps = [ + "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + ] + + configs = [ "${access_token_path}/config:coverage_flags" ] + cflags_cc = [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] +} \ No newline at end of file diff --git a/test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/corpus/init b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/corpus/init rename to test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/corpus/init diff --git a/test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/getseccompenhance_fuzzer.cpp b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/getseccompenhance_fuzzer.cpp similarity index 100% rename from test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/getseccompenhance_fuzzer.cpp rename to test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/getseccompenhance_fuzzer.cpp diff --git a/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/getseccompenhance_fuzzer.cpp.orig b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/getseccompenhance_fuzzer.cpp.orig new file mode 100644 index 0000000000000000000000000000000000000000..50a3f7dfe3a69926699d15c39a3a69c272ea42b4 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/getseccompenhance_fuzzer.cpp.orig @@ -0,0 +1,51 @@ +/* + * 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 "getseccompenhance_fuzzer.h" + +#include +#include +#include +#include + +#include "accesstoken_fuzzdata.h" +#undef private +#include "accesstoken_kit.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; + +namespace OHOS { + bool GetSecCompEnhanceFuzzTest(const uint8_t* data, size_t size) + { + if ((data == nullptr) || (size == 0)) { + return false; + } + + AccessTokenFuzzData fuzzData(data, size); + + SecCompEnhanceData secData; + + return AccessTokenKit::GetSecCompEnhance(fuzzData.GetData(), secData) == 0; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::GetSecCompEnhanceFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/getseccompenhance_fuzzer.h b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/getseccompenhance_fuzzer.h similarity index 100% rename from test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/getseccompenhance_fuzzer.h rename to test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/getseccompenhance_fuzzer.h diff --git a/test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/project.xml b/test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/project.xml similarity index 100% rename from test/fuzztest/innerkits/privacy/getseccompenhance_fuzzer/project.xml rename to test/fuzztest/innerkits/accesstoken/getseccompenhance_fuzzer/project.xml diff --git a/test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/BUILD.gn b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/BUILD.gn rename to test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/BUILD.gn diff --git a/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/BUILD.gn.orig b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..39bd4126d92cc6ea6f921604b955028bfc355428 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/BUILD.gn.orig @@ -0,0 +1,43 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") + +ohos_fuzztest("GetSpecialSecCompEnhanceFuzzTest") { + module_out_path = module_output_path_interface_access_token + fuzz_config_file = "." + include_dirs = [ + "${access_token_path}/interfaces/innerkits/accesstoken/include", + "${access_token_path}/test/fuzztest/common", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "getspecialseccompenhance_fuzzer.cpp" ] + deps = [ + "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + ] + + configs = [ "${access_token_path}/config:coverage_flags" ] + cflags_cc = [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] +} \ No newline at end of file diff --git a/test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/corpus/init b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/corpus/init rename to test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/corpus/init diff --git a/test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.cpp b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.cpp similarity index 100% rename from test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.cpp rename to test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.cpp diff --git a/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.cpp.orig b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.cpp.orig new file mode 100644 index 0000000000000000000000000000000000000000..0879776d9deaefdc2619c1d68bfe257f5999cda8 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.cpp.orig @@ -0,0 +1,51 @@ +/* + * 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 "getspecialseccompenhance_fuzzer.h" + +#include +#include +#include +#include + +#include "accesstoken_fuzzdata.h" +#undef private +#include "accesstoken_kit.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; + +namespace OHOS { + bool GetSpecialSecCompEnhanceFuzzTest(const uint8_t* data, size_t size) + { + if ((data == nullptr) || (size == 0)) { + return false; + } + + AccessTokenFuzzData fuzzData(data, size); + + std::vector enhanceList; + + return AccessTokenKit::GetSpecialSecCompEnhance(fuzzData.GenerateStochasticString(), enhanceList) == 0; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::GetSpecialSecCompEnhanceFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.h b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.h similarity index 100% rename from test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.h rename to test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/getspecialseccompenhance_fuzzer.h diff --git a/test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/project.xml b/test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/project.xml similarity index 100% rename from test/fuzztest/innerkits/privacy/getspecialseccompenhance_fuzzer/project.xml rename to test/fuzztest/innerkits/accesstoken/getspecialseccompenhance_fuzzer/project.xml diff --git a/test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/BUILD.gn b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/BUILD.gn rename to test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/BUILD.gn diff --git a/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/BUILD.gn.orig b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..e76dc0cb1af5e11ead891deea6c41715effc39b9 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/BUILD.gn.orig @@ -0,0 +1,43 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") + +ohos_fuzztest("RegisterSecCompEnhanceFuzzTest") { + module_out_path = module_output_path_interface_access_token + fuzz_config_file = "." + include_dirs = [ + "${access_token_path}/interfaces/innerkits/accesstoken/include", + "${access_token_path}/test/fuzztest/common", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "registerseccompenhance_fuzzer.cpp" ] + deps = [ + "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + ] + + configs = [ "${access_token_path}/config:coverage_flags" ] + cflags_cc = [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] +} \ No newline at end of file diff --git a/test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/corpus/init b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/corpus/init rename to test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/corpus/init diff --git a/test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/project.xml b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/project.xml similarity index 100% rename from test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/project.xml rename to test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/project.xml diff --git a/test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.cpp b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.cpp similarity index 100% rename from test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.cpp rename to test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.cpp diff --git a/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.cpp.orig b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.cpp.orig new file mode 100644 index 0000000000000000000000000000000000000000..b18d9fa5127f3dcec333e3894101eb09f5ca62d4 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.cpp.orig @@ -0,0 +1,57 @@ +/* + * 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 "registerseccompenhance_fuzzer.h" + +#include +#include +#include +#include + +#include "accesstoken_fuzzdata.h" +#undef private +#include "accesstoken_kit.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; + +namespace OHOS { + bool RegisterSecCompEnhanceFuzzTest(const uint8_t* data, size_t size) + { + if ((data == nullptr) || (size == 0)) { + return false; + } + + AccessTokenFuzzData fuzzData(data, size); + + SecCompEnhanceData secData; + secData.callback = nullptr; + secData.pid = fuzzData.GetData(); + secData.token = static_cast(fuzzData.GetData()); + secData.challenge = fuzzData.GetData(); + secData.sessionId = fuzzData.GetData(); + secData.seqNum = fuzzData.GetData(); + + return AccessTokenKit::RegisterSecCompEnhance(secData) == 0; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::RegisterSecCompEnhanceFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.h b/test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.h similarity index 100% rename from test/fuzztest/innerkits/privacy/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.h rename to test/fuzztest/innerkits/accesstoken/registerseccompenhance_fuzzer/registerseccompenhance_fuzzer.h diff --git a/test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/BUILD.gn b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/BUILD.gn rename to test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/BUILD.gn diff --git a/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/BUILD.gn.orig b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..a7d77cc8b2d3efa0c490179ddb2559b5689e9844 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/BUILD.gn.orig @@ -0,0 +1,43 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") + +ohos_fuzztest("UpdateSecCompEnhanceFuzzTest") { + module_out_path = module_output_path_interface_access_token + fuzz_config_file = "." + include_dirs = [ + "${access_token_path}/interfaces/innerkits/accesstoken/include", + "${access_token_path}/test/fuzztest/common", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "updateseccompenhance_fuzzer.cpp" ] + deps = [ + "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + ] + + configs = [ "${access_token_path}/config:coverage_flags" ] + cflags_cc = [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] +} diff --git a/test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/corpus/init b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/corpus/init rename to test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/corpus/init diff --git a/test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/project.xml b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/project.xml similarity index 100% rename from test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/project.xml rename to test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/project.xml diff --git a/test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.cpp b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.cpp similarity index 100% rename from test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.cpp rename to test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.cpp diff --git a/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.cpp.orig b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.cpp.orig new file mode 100644 index 0000000000000000000000000000000000000000..ae4fcaf3fc779ded9c682bec5eb1444258a8eea0 --- /dev/null +++ b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.cpp.orig @@ -0,0 +1,49 @@ +/* + * 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 "updateseccompenhance_fuzzer.h" + +#include +#include +#include +#include + +#include "accesstoken_fuzzdata.h" +#undef private +#include "accesstoken_kit.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; + +namespace OHOS { + bool UpdateSecCompEnhanceFuzzTest(const uint8_t* data, size_t size) + { + if ((data == nullptr) || (size == 0)) { + return false; + } + + AccessTokenFuzzData fuzzData(data, size); + + return AccessTokenKit::UpdateSecCompEnhance(fuzzData.GetData(), fuzzData.GetData()) == 0; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::UpdateSecCompEnhanceFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.h b/test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.h similarity index 100% rename from test/fuzztest/innerkits/privacy/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.h rename to test/fuzztest/innerkits/accesstoken/updateseccompenhance_fuzzer/updateseccompenhance_fuzzer.h diff --git a/test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/BUILD.gn b/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/BUILD.gn rename to test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/BUILD.gn diff --git a/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/BUILD.gn.orig b/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..3c19beefa77770b1f215b6187b751dcdc3b7e34e --- /dev/null +++ b/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/BUILD.gn.orig @@ -0,0 +1,46 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") +import("../access_token_service_fuzz.gni") + +ohos_fuzztest("GetSecCompEnhanceStubFuzzTest") { + module_out_path = module_output_path_service_access_token + fuzz_config_file = "." + + sources = [ "getseccompenhancestub_fuzzer.cpp" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + include_dirs = access_token_include_dirs + + deps = access_token_deps + + configs = [ "${access_token_path}/config:coverage_flags" ] + + external_deps = access_token_external_deps + + include_dirs += access_token_impl_include_dirs + + cflags_cc = access_token_cflags_cc + + sources += access_token_sources + sources += access_token_impl_sources +} diff --git a/test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/corpus/init b/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/corpus/init rename to test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/corpus/init diff --git a/test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.cpp similarity index 100% rename from test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.cpp rename to test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.cpp diff --git a/test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.h b/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.h similarity index 100% rename from test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.h rename to test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/getseccompenhancestub_fuzzer.h diff --git a/test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/project.xml b/test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/project.xml similarity index 100% rename from test/fuzztest/services/privacy/getseccompenhancestub_fuzzer/project.xml rename to test/fuzztest/services/accesstoken/getseccompenhancestub_fuzzer/project.xml diff --git a/test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/BUILD.gn b/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/BUILD.gn rename to test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/BUILD.gn diff --git a/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/BUILD.gn.orig b/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..a069f9ee51ef325a94e5081b1ed1d71ba318b82c --- /dev/null +++ b/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/BUILD.gn.orig @@ -0,0 +1,46 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") +import("../access_token_service_fuzz.gni") + +ohos_fuzztest("GetSpecialSecCompEnhanceStubFuzzTest") { + module_out_path = module_output_path_service_access_token + fuzz_config_file = "." + + sources = [ "getspecialseccompenhancestub_fuzzer.cpp" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + include_dirs = access_token_include_dirs + + deps = access_token_deps + + configs = [ "${access_token_path}/config:coverage_flags" ] + + external_deps = access_token_external_deps + + include_dirs += access_token_impl_include_dirs + + cflags_cc = access_token_cflags_cc + + sources += access_token_sources + sources += access_token_impl_sources +} \ No newline at end of file diff --git a/test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/corpus/init b/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/corpus/init rename to test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/corpus/init diff --git a/test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.cpp similarity index 100% rename from test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.cpp rename to test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.cpp diff --git a/test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.h b/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.h similarity index 100% rename from test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.h rename to test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/getspecialseccompenhancestub_fuzzer.h diff --git a/test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/project.xml b/test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/project.xml similarity index 100% rename from test/fuzztest/services/privacy/getspecialseccompenhancestub_fuzzer/project.xml rename to test/fuzztest/services/accesstoken/getspecialseccompenhancestub_fuzzer/project.xml diff --git a/test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/BUILD.gn b/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/BUILD.gn rename to test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/BUILD.gn diff --git a/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/BUILD.gn.orig b/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..a4d9d7c8a47170dcde6eef2b252cc6376f84bf1b --- /dev/null +++ b/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/BUILD.gn.orig @@ -0,0 +1,46 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") +import("../access_token_service_fuzz.gni") + +ohos_fuzztest("RegisterSecCompEnhanceStubFuzzTest") { + module_out_path = module_output_path_service_access_token + fuzz_config_file = "." + + sources = [ "registerseccompenhancestub_fuzzer.cpp" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + include_dirs = access_token_include_dirs + + deps = access_token_deps + + configs = [ "${access_token_path}/config:coverage_flags" ] + + external_deps = access_token_external_deps + + include_dirs += access_token_impl_include_dirs + + cflags_cc = access_token_cflags_cc + + sources += access_token_sources + sources += access_token_impl_sources +} \ No newline at end of file diff --git a/test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/corpus/init b/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/corpus/init rename to test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/corpus/init diff --git a/test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/project.xml b/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/project.xml similarity index 100% rename from test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/project.xml rename to test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/project.xml diff --git a/test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.cpp similarity index 100% rename from test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.cpp rename to test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.cpp diff --git a/test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.h b/test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.h similarity index 100% rename from test/fuzztest/services/privacy/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.h rename to test/fuzztest/services/accesstoken/registerseccompenhancestub_fuzzer/registerseccompenhancestub_fuzzer.h diff --git a/test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/BUILD.gn b/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/BUILD.gn similarity index 100% rename from test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/BUILD.gn rename to test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/BUILD.gn diff --git a/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/BUILD.gn.orig b/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/BUILD.gn.orig new file mode 100644 index 0000000000000000000000000000000000000000..0d43d652bb42d537912f3c2051756db6635213df --- /dev/null +++ b/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/BUILD.gn.orig @@ -0,0 +1,46 @@ +# 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/config/features.gni") +import("//build/test.gni") +import("../../../../../access_token.gni") +import("../access_token_service_fuzz.gni") + +ohos_fuzztest("UpdateSecCompEnhanceStubFuzzTest") { + module_out_path = module_output_path_service_access_token + fuzz_config_file = "." + + sources = [ "updateseccompenhancestub_fuzzer.cpp" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + include_dirs = access_token_include_dirs + + deps = access_token_deps + + configs = [ "${access_token_path}/config:coverage_flags" ] + + external_deps = access_token_external_deps + + include_dirs += access_token_impl_include_dirs + + cflags_cc = access_token_cflags_cc + + sources += access_token_sources + sources += access_token_impl_sources +} \ No newline at end of file diff --git a/test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/corpus/init b/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/corpus/init rename to test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/corpus/init diff --git a/test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/project.xml b/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/project.xml similarity index 100% rename from test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/project.xml rename to test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/project.xml diff --git a/test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.cpp similarity index 100% rename from test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.cpp rename to test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.cpp diff --git a/test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.h b/test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.h similarity index 100% rename from test/fuzztest/services/privacy/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.h rename to test/fuzztest/services/accesstoken/updateseccompenhancestub_fuzzer/updateseccompenhancestub_fuzzer.h