From e3e01c48ef138f1b6ccda9d2658309d75086aff8 Mon Sep 17 00:00:00 2001 From: wangyongzhong2 Date: Tue, 19 Aug 2025 15:30:54 +0800 Subject: [PATCH] modify dslm deps Signed-off-by: wangyongzhong2 --- bundle.json | 1 - frameworks/datatransmitmgr/dev_slinfo_adpt.c | 10 ++++----- interfaces/inner_api/datatransmitmgr/BUILD.gn | 1 - .../datatransmitmgr/include/dev_slinfo_adpt.h | 21 ++++++++++++++++++- .../datatransmitmgr_fuzzer/BUILD.gn | 2 +- .../devslinfoadpt_fuzzer/BUILD.gn | 3 +-- .../gethighestseclevel_fuzzer/BUILD.gn | 3 +-- .../gethighestseclevelasync_fuzzer/BUILD.gn | 3 +-- test/unittest/datatransmitmgr/BUILD.gn | 1 - .../unittest/datatransmitmgr/DevSLMgrTest.cpp | 6 ++---- 10 files changed, 31 insertions(+), 20 deletions(-) diff --git a/bundle.json b/bundle.json index 1a9d2b3..f787443 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 61f7166..de28bfc 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 1f0dfe4..f539fd4 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 2b5bf49..d4bbe92 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 ac1797f..4c9ace4 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 5bc4478..aee511c 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 f606386..2591fa2 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 77a8a21..72f060b 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 1e3655d..407fbd0 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 0d60a9b..179f706 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" { -- Gitee