diff --git a/bundle.json b/bundle.json index 1a9d2b39003889d222f27cfae4e22d5c9aca74cf..f787443b350cc45aa010eec3f97ecf9dde4de02e 100644 --- a/bundle.json +++ b/bundle.json @@ -28,7 +28,6 @@ "deps": { "components": [ "access_token", - "device_security_level", "hilog", "init", "c_utils", diff --git a/frameworks/datatransmitmgr/dev_slinfo_adpt.c b/frameworks/datatransmitmgr/dev_slinfo_adpt.c index 61f7166dd991f5288a8a16ff0247b875e7aba6ea..de28bfcbb7b9aeee41bc78861f97d0dd15ec0d01 100644 --- a/frameworks/datatransmitmgr/dev_slinfo_adpt.c +++ b/frameworks/datatransmitmgr/dev_slinfo_adpt.c @@ -42,7 +42,7 @@ static void DestroyDeviceSecEnv(void) static int32_t DlopenSDK(void) { - g_deviceSecLevelHandle = dlopen("libdslm_sdk.z.so", RTLD_LAZY | RTLD_NODELETE); + g_deviceSecLevelHandle = dlopen("libdslm_sdk.z.so", RTLD_LAZY); if (g_deviceSecLevelHandle == NULL) { DATA_SEC_LOG_ERROR("failed to load libdevicesecmgrsdktmp: %s", dlerror()); return DEVSL_ERROR; @@ -163,14 +163,14 @@ int32_t GetDeviceSecLevelByUdid(const uint8_t *udid, uint32_t udidLen, int32_t * devId.length = udidLen; ret = g_deviceSecEnv.requestDeviceSecurityInfo(&devId, NULL, &info); - if (ret != SUCCESS) { + if (ret != DEVSL_SUCCESS) { DATA_SEC_LOG_ERROR("GetDeviceSecLevelByUdid: request device Security info failed, %d", ret); g_deviceSecEnv.freeDeviceSecurityInfo(info); return ret; } ret = g_deviceSecEnv.getDeviceSecurityLevelValue(info, devLevel); - if (ret != SUCCESS) { + if (ret != DEVSL_SUCCESS) { DATA_SEC_LOG_ERROR("GetDeviceSecLevelByUdid: get device Security value failed, %d", ret); g_deviceSecEnv.freeDeviceSecurityInfo(info); return ret; @@ -209,7 +209,7 @@ void OnApiDeviceSecInfoCallback(const DeviceIdentify *identify, struct DeviceSec if (ret == DEVSL_SUCCESS) { ret = g_deviceSecEnv.getDeviceSecurityLevelValue(info, &devLevel); - if (ret != SUCCESS) { + if (ret != DEVSL_SUCCESS) { DATA_SEC_LOG_ERROR("OnApiDeviceSecInfoCallback: get device security level value, %d", ret); } else { levelInfo = GetDataSecLevelByDevSecLevel(devLevel); @@ -251,7 +251,7 @@ int32_t GetDeviceSecLevelByUdidAsync(const uint8_t *udid, uint32_t udidLen) } devId.length = udidLen; ret = g_deviceSecEnv.requestDeviceSecurityInfoAsync(&devId, NULL, OnApiDeviceSecInfoCallback); - if (ret != SUCCESS) { + if (ret != DEVSL_SUCCESS) { DATA_SEC_LOG_ERROR("GetDeviceSecLevelByUdidAsync: request device security Info for Async failed, %d", ret); return ret; } diff --git a/interfaces/inner_api/datatransmitmgr/BUILD.gn b/interfaces/inner_api/datatransmitmgr/BUILD.gn index 1f0dfe4182a810751763530be5126344d3a62265..f539fd4d6be4214de87fbde7f8b505ee819b5658 100644 --- a/interfaces/inner_api/datatransmitmgr/BUILD.gn +++ b/interfaces/inner_api/datatransmitmgr/BUILD.gn @@ -57,7 +57,6 @@ ohos_shared_library("data_transit_mgr") { external_deps = [ "c_utils:utils" ] } external_deps += [ - "device_security_level:dslm_sdk", "hilog:libhilog", ] diff --git a/interfaces/inner_api/datatransmitmgr/include/dev_slinfo_adpt.h b/interfaces/inner_api/datatransmitmgr/include/dev_slinfo_adpt.h index 2b5bf4991098b2e7d5da3c9df44ec547bfd0b5f7..d4bbe922779f5d8f207dd67d3beff56d0ae14972 100644 --- a/interfaces/inner_api/datatransmitmgr/include/dev_slinfo_adpt.h +++ b/interfaces/inner_api/datatransmitmgr/include/dev_slinfo_adpt.h @@ -16,7 +16,6 @@ #ifndef DEV_SLINFO_ADPT_H #define DEV_SLINFO_ADPT_H -#include "device_security_info.h" #include "dev_slinfo_mgr.h" #ifdef __cplusplus @@ -29,6 +28,26 @@ extern "C" { #define DEV_SEC_LEVEL3 3 /* sl3 */ #define DEV_SEC_LEVEL4 4 /* sl4 */ #define DEV_SEC_LEVEL5 5 /* sl5 */ +#define DEVICE_ID_MAX_LEN 64 + +typedef struct DeviceIdentify { + uint32_t length; + uint8_t identity[DEVICE_ID_MAX_LEN]; +} DeviceIdentify; + +typedef struct DeviceSecurityInfo { + uint32_t magicNum; + uint32_t result; + uint32_t level; +} DeviceSecurityInfo; + +typedef struct RequestOption { + uint64_t challenge; + uint32_t timeout; + uint32_t extra; +} RequestOption; + +typedef void DeviceSecurityInfoCallback(const DeviceIdentify *identify, struct DeviceSecurityInfo *info); typedef int32_t (*RequestDeviceSecurityInfoFunction)(const DeviceIdentify *identify, const RequestOption *option, diff --git a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/BUILD.gn b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/BUILD.gn index ac1797f8715b45178948fe19ee329918f5a51e89..4c9ace43fce4a3d5843a5339a2899cbbeb49204c 100644 --- a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/BUILD.gn +++ b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/test.gni") ohos_fuzztest("DataTransmitMgrFuzzTest") { - module_out_path = "security/dataclassification" + module_out_path = "security/dataclassification/dataclassification" fuzz_config_file = "." cflags = [ diff --git a/test/fuzztest/datatransmitmgr/devslinfoadpt_fuzzer/BUILD.gn b/test/fuzztest/datatransmitmgr/devslinfoadpt_fuzzer/BUILD.gn index 5bc44787aa894b5a682409f22923f2e76b3d0bb5..aee511c7096795c176fe2b301a1367829ece3181 100644 --- a/test/fuzztest/datatransmitmgr/devslinfoadpt_fuzzer/BUILD.gn +++ b/test/fuzztest/datatransmitmgr/devslinfoadpt_fuzzer/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/test.gni") ohos_fuzztest("DevSlinfoAdptFuzzTest") { - module_out_path = "security/dataclassification" + module_out_path = "security/dataclassification/dataclassification" fuzz_config_file = "." cflags = [ @@ -42,7 +42,6 @@ ohos_fuzztest("DevSlinfoAdptFuzzTest") { "access_token:libtoken_setproc", "cJSON:cjson_static", "c_utils:utils", - "device_security_level:dslm_sdk", "hilog:libhilog", "init:libbegetutil", "selinux_adapter:librestorecon", diff --git a/test/fuzztest/datatransmitmgr/gethighestseclevel_fuzzer/BUILD.gn b/test/fuzztest/datatransmitmgr/gethighestseclevel_fuzzer/BUILD.gn index f606386b28e9ce656a3168ea153aacc883e73b53..2591fa2e4383b6e7f57d821d651816a911898165 100644 --- a/test/fuzztest/datatransmitmgr/gethighestseclevel_fuzzer/BUILD.gn +++ b/test/fuzztest/datatransmitmgr/gethighestseclevel_fuzzer/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/test.gni") ohos_fuzztest("GetHighestSecLevelFuzzTest") { - module_out_path = "security/dataclassification" + module_out_path = "security/dataclassification/dataclassification" fuzz_config_file = "." cflags = [ @@ -42,7 +42,6 @@ ohos_fuzztest("GetHighestSecLevelFuzzTest") { "access_token:libtoken_setproc", "cJSON:cjson_static", "c_utils:utils", - "device_security_level:dslm_sdk", "hilog:libhilog", "init:libbegetutil", "selinux_adapter:librestorecon", diff --git a/test/fuzztest/datatransmitmgr/gethighestseclevelasync_fuzzer/BUILD.gn b/test/fuzztest/datatransmitmgr/gethighestseclevelasync_fuzzer/BUILD.gn index 77a8a219fd04ca0f74878d3c2f6e3479ec923081..72f060be7525f07e6ea13c6648b5e35a361b5c06 100644 --- a/test/fuzztest/datatransmitmgr/gethighestseclevelasync_fuzzer/BUILD.gn +++ b/test/fuzztest/datatransmitmgr/gethighestseclevelasync_fuzzer/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/test.gni") ohos_fuzztest("GetHighestSecLevelAsyncFuzzTest") { - module_out_path = "security/dataclassification" + module_out_path = "security/dataclassification/dataclassification" fuzz_config_file = "." cflags = [ @@ -42,7 +42,6 @@ ohos_fuzztest("GetHighestSecLevelAsyncFuzzTest") { "access_token:libtoken_setproc", "cJSON:cjson_static", "c_utils:utils", - "device_security_level:dslm_sdk", "hilog:libhilog", "init:libbegetutil", "selinux_adapter:librestorecon", diff --git a/test/unittest/datatransmitmgr/BUILD.gn b/test/unittest/datatransmitmgr/BUILD.gn index 1e3655d379ba7f27a1b5224bbf566a3c9982ef1b..407fbd0954723ca1ac07400387d5aefbd0910d30 100644 --- a/test/unittest/datatransmitmgr/BUILD.gn +++ b/test/unittest/datatransmitmgr/BUILD.gn @@ -49,7 +49,6 @@ ohos_unittest("DevSLMgrTest") { "access_token:libtoken_setproc", "cJSON:cjson_static", "c_utils:utils", - "device_security_level:dslm_sdk", "hilog:libhilog", "init:libbegetutil", "selinux_adapter:librestorecon", diff --git a/test/unittest/datatransmitmgr/DevSLMgrTest.cpp b/test/unittest/datatransmitmgr/DevSLMgrTest.cpp index 0d60a9bcf6761b392aa5cd7d1092a4e11123de3d..179f7064e4683581e2c59782fe8ea12a23d6abbf 100644 --- a/test/unittest/datatransmitmgr/DevSLMgrTest.cpp +++ b/test/unittest/datatransmitmgr/DevSLMgrTest.cpp @@ -44,10 +44,8 @@ private: static const int32_t DEV_SEC_LEVEL_ERR = 100; static const int32_t LIST_LENGTH = 128; -struct DeviceSecurityInfo { - uint32_t magicNum {0}; - uint32_t result {0}; - uint32_t level {0}; +enum { + ERR_NOEXIST_DEVICE = 38, }; extern "C" {