diff --git a/bundle.json b/bundle.json index fd3b3d47c9037f08b3792c57625eed6238f6faf7..590f64fe56eff6e3a7eda95b2d2f23f3bed68ebb 100644 --- a/bundle.json +++ b/bundle.json @@ -26,8 +26,7 @@ "c_utils", "hilog", "init", - "os_account", - "drivers_interface_devices_security" + "os_account" ], "third_party": [ "json", diff --git a/interfaces/innerkits/appverify/BUILD.gn b/interfaces/innerkits/appverify/BUILD.gn index c19d794d6838c815213c98d747e0c980d0a1cacc..c93351cfde465ce7265982e91e543c9f269bc2fe 100644 --- a/interfaces/innerkits/appverify/BUILD.gn +++ b/interfaces/innerkits/appverify/BUILD.gn @@ -61,14 +61,6 @@ if (os_level == "standard") { external_deps = [ "c_utils:utils" ] defines = [] - if (defined(global_parts_info) && - defined(global_parts_info.hdf_drivers_interface_devices_security)) { - defines += [ "APPVERIFY_DEVICES_SECURITY" ] - - external_deps += - [ "drivers_interface_devices_security:libdevices_security_proxy_1.0" ] - } - if (is_standard_system) { defines += [ "STANDARD_SYSTEM" ] diff --git a/interfaces/innerkits/appverify/include/provision/provision_verify.h b/interfaces/innerkits/appverify/include/provision/provision_verify.h index 7e680481a74a0d0d66128900cda27d99a87af1b8..2d0a62f988fd5f5e20b89e0a039381db8e1cfe7c 100644 --- a/interfaces/innerkits/appverify/include/provision/provision_verify.h +++ b/interfaces/innerkits/appverify/include/provision/provision_verify.h @@ -54,6 +54,8 @@ DLL_EXPORT AppProvisionVerifyResult ParseProvision(const std::string& appProvisi * @return AppProvisionVerifyResult parse result. */ DLL_EXPORT AppProvisionVerifyResult ParseProfile(const std::string& appProvision, ProvisionInfo& info); + +DLL_EXPORT void SetRdDevice(bool isRdDevice); } // namespace Verify } // namespace Security } // namespace OHOS diff --git a/interfaces/innerkits/appverify/src/provision/provision_verify.cpp b/interfaces/innerkits/appverify/src/provision/provision_verify.cpp index 44f682b6c38aeba30b5b17489c2634eb0670573c..8f1cd826f53a77aafb5070ffbf197ab7ef31a091 100644 --- a/interfaces/innerkits/appverify/src/provision/provision_verify.cpp +++ b/interfaces/innerkits/appverify/src/provision/provision_verify.cpp @@ -29,10 +29,6 @@ #include "common/hap_verify_log.h" #include "init/device_type_manager.h" -#ifdef APPVERIFY_DEVICES_SECURITY -#include "v1_0/idevices_security_interface.h" -#endif - using namespace std; using namespace nlohmann; @@ -61,7 +57,6 @@ const string KEY_DEVICE_IDS = "device-ids"; const string KEY_ISSUER = "issuer"; const string KEY_APP_PRIVILEGE_CAPABILITIES = "app-privilege-capabilities"; const string KEY_DEVELOPMENT_MODE = "const.product.developmentmode"; -const string KEY_OEM_MODE = "const.boot.oemmode"; const string VALUE_TYPE_RELEASE = "release"; const string VALUE_DIST_TYPE_APP_GALLERY = "app_gallery"; const string VALUE_DIST_TYPE_ENTERPRISE = "enterprise"; @@ -73,7 +68,6 @@ const string VALUE_DEVICE_ID_TYPE_UDID = "udid"; const string VALUE_VALIDITY = "validity"; const string VALUE_NOT_BEFORE = "not-before"; const string VALUE_NOT_AFTER = "not-after"; -const string VALUE_OEM_MODE_RD = "rd"; // reserved field const string KEY_BASEAPP_INFO = "baseapp-info"; @@ -87,7 +81,6 @@ const string VALUE_DEVELOPMENT_MODE = "1"; const int32_t MAXIMUM_NUM_DEVICES = 100; const int32_t VERSION_CODE_TWO = 2; const int32_t DEVELOPMENT_MODE_LENGTH = 2; -const int32_t OEM_MODE_LENGTH = 10; inline void GetStringIfExist(const json& obj, const string& key, string& out) { @@ -139,6 +132,8 @@ const std::map distTypeMap = { {VALUE_DIST_TYPE_CROWDTESTING, AppDistType::CROWDTESTING} }; +static bool g_isRdDevice = false; + void ParseType(const json& obj, ProvisionInfo& out) { string type; @@ -342,32 +337,9 @@ AppProvisionVerifyResult CheckDeviceID(ProvisionInfo& info) return PROVISION_OK; } -inline bool IsRdDevice() +void SetRdDevice(bool isRdDevice) { - char oemMode[OEM_MODE_LENGTH] = {0}; - GetParameter(KEY_OEM_MODE.c_str(), nullptr, oemMode, sizeof(oemMode)); - if (strcmp(oemMode, VALUE_OEM_MODE_RD.c_str()) == 0) { - HAPVERIFY_LOG_DEBUG(LABEL, "oem mode is rd, skip device id check"); - return true; - } -#ifdef APPVERIFY_DEVICES_SECURITY - sptr devicesSecurityProxy = - HDI::DevicesSecurity::V1_0::IDevicesSecurityInterface::Get("devices_security_interface_service", true); - if (devicesSecurityProxy == nullptr) { - HAPVERIFY_LOG_DEBUG(LABEL, "get devicesSecurityProxy failed, seen as non-rd"); - return false; - } - int32_t fuseState = devicesSecurityProxy->GetFuseState(); - // 0: fused, 1: not fused, -1: error - if (fuseState == 1) { - HAPVERIFY_LOG_DEBUG(LABEL, "device is not fused, skip device id check"); - return true; - } - HAPVERIFY_LOG_DEBUG(LABEL, "device is fused, need to check device id"); - return false; -#endif - HAPVERIFY_LOG_DEBUG(LABEL, "cannot get fuse state, seen as non-rd"); - return false; + g_isRdDevice = isRdDevice; } AppProvisionVerifyResult ParseAndVerify(const string& appProvision, ProvisionInfo& info) @@ -383,7 +355,8 @@ AppProvisionVerifyResult ParseAndVerify(const string& appProvision, ProvisionInf const char *value = VALUE_DEVELOPMENT_MODE.data(); bool isDevelopmentMode = (strcmp(developmentMode, value) == 0) ? true : false; HAPVERIFY_LOG_DEBUG(LABEL, "Current development mode is %{public}d", isDevelopmentMode); - if (info.type == ProvisionType::DEBUG && !isDevelopmentMode && !IsRdDevice()) { + HAPVERIFY_LOG_DEBUG(LABEL, "rd device status is %{public}d", g_isRdDevice); + if (info.type == ProvisionType::DEBUG && !isDevelopmentMode && !g_isRdDevice) { ret = CheckDeviceID(info); if (ret != PROVISION_OK) { return ret;