change innerkits to inner_api

Signed-off-by: wangyongzhong2 <wangyongzhong2@huawei.com>
This commit is contained in:
wangyongzhong2
2024-10-18 17:28:17 +08:00
parent b7d4d65a28
commit 390a946366
12 changed files with 238 additions and 239 deletions
+1 -1
View File
@@ -14,6 +14,6 @@
import("//build/ohos.gni")
group("dataclassification_build_module") {
if (os_level == "standard") {
deps = [ "interfaces/innerkits/datatransmitmgr:data_transit_mgr" ]
deps = [ "interfaces/inner_api/datatransmitmgr:data_transit_mgr" ]
}
}
+2 -2
View File
@@ -41,12 +41,12 @@
],
"inner_kits": [
{
"name": "//base/security/dataclassification/interfaces/innerkits/datatransmitmgr:data_transit_mgr",
"name": "//base/security/dataclassification/interfaces/inner_api/datatransmitmgr:data_transit_mgr",
"header": {
"header_files": [
"dev_slinfo_mgr.h"
],
"header_base": "//base/security/dataclassification/interfaces/innerkits/datatransmitmgr/include"
"header_base": "//base/security/dataclassification/interfaces/inner_api/datatransmitmgr/include"
}
}
],
@@ -1,70 +1,70 @@
/*
* Copyright (C) 2022 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 DEV_SLINFO_ADPT_H
#define DEV_SLINFO_ADPT_H
#include "device_security_info.h"
#include "dev_slinfo_mgr.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DEFAULT_DEV_SEC_LEVEL 0
#define DEV_SEC_LEVEL1 1 /* sl1 */
#define DEV_SEC_LEVEL2 2 /* sl2 */
#define DEV_SEC_LEVEL3 3 /* sl3 */
#define DEV_SEC_LEVEL4 4 /* sl4 */
#define DEV_SEC_LEVEL5 5 /* sl5 */
typedef int32_t (*RequestDeviceSecurityInfoFunction)(const DeviceIdentify *identify,
const RequestOption *option,
DeviceSecurityInfo **info);
typedef int32_t (*RequestDeviceSecurityInfoAsyncFunction)(const DeviceIdentify *identify,
const RequestOption *option,
DeviceSecurityInfoCallback callback);
typedef void (*FreeDeviceSecurityInfoFunction)(DeviceSecurityInfo *info);
typedef int32_t (*GetDeviceSecurityLevelValueFunction)(const DeviceSecurityInfo *info, int32_t *level);
typedef struct {
RequestDeviceSecurityInfoFunction requestDeviceSecurityInfo;
RequestDeviceSecurityInfoAsyncFunction requestDeviceSecurityInfoAsync;
FreeDeviceSecurityInfoFunction freeDeviceSecurityInfo;
GetDeviceSecurityLevelValueFunction getDeviceSecurityLevelValue;
int32_t version;
} DeviceSecEnv;
int32_t StartDevslEnv(void);
void FinishDevslEnv(void);
int32_t GetDeviceSecLevelByUdid(const uint8_t *udid, uint32_t udidLen, int32_t *devLevel);
int32_t CompareUdid(DEVSLQueryParams *queryParamsL, DEVSLQueryParams *queryParamsR);
int32_t GetDeviceSecLevelByUdidAsync(const uint8_t *udid, uint32_t udidLen);
uint32_t GetDataSecLevelByDevSecLevel(int32_t devLevel);
int32_t UpdateCallbackListParams(DEVSLQueryParams *queryParams, HigestSecInfoCallback *callback);
#ifdef __cplusplus
}
#endif
/*
* Copyright (C) 2022 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 DEV_SLINFO_ADPT_H
#define DEV_SLINFO_ADPT_H
#include "device_security_info.h"
#include "dev_slinfo_mgr.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DEFAULT_DEV_SEC_LEVEL 0
#define DEV_SEC_LEVEL1 1 /* sl1 */
#define DEV_SEC_LEVEL2 2 /* sl2 */
#define DEV_SEC_LEVEL3 3 /* sl3 */
#define DEV_SEC_LEVEL4 4 /* sl4 */
#define DEV_SEC_LEVEL5 5 /* sl5 */
typedef int32_t (*RequestDeviceSecurityInfoFunction)(const DeviceIdentify *identify,
const RequestOption *option,
DeviceSecurityInfo **info);
typedef int32_t (*RequestDeviceSecurityInfoAsyncFunction)(const DeviceIdentify *identify,
const RequestOption *option,
DeviceSecurityInfoCallback callback);
typedef void (*FreeDeviceSecurityInfoFunction)(DeviceSecurityInfo *info);
typedef int32_t (*GetDeviceSecurityLevelValueFunction)(const DeviceSecurityInfo *info, int32_t *level);
typedef struct {
RequestDeviceSecurityInfoFunction requestDeviceSecurityInfo;
RequestDeviceSecurityInfoAsyncFunction requestDeviceSecurityInfoAsync;
FreeDeviceSecurityInfoFunction freeDeviceSecurityInfo;
GetDeviceSecurityLevelValueFunction getDeviceSecurityLevelValue;
int32_t version;
} DeviceSecEnv;
int32_t StartDevslEnv(void);
void FinishDevslEnv(void);
int32_t GetDeviceSecLevelByUdid(const uint8_t *udid, uint32_t udidLen, int32_t *devLevel);
int32_t CompareUdid(DEVSLQueryParams *queryParamsL, DEVSLQueryParams *queryParamsR);
int32_t GetDeviceSecLevelByUdidAsync(const uint8_t *udid, uint32_t udidLen);
uint32_t GetDataSecLevelByDevSecLevel(int32_t devLevel);
int32_t UpdateCallbackListParams(DEVSLQueryParams *queryParams, HigestSecInfoCallback *callback);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,49 +1,49 @@
/*
* Copyright (C) 2022 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 DEV_SLINFO_LIST_H
#define DEV_SLINFO_LIST_H
#include <stdlib.h>
#include "dev_slinfo_mgr.h"
struct DATASLCallbackParams {
DEVSLQueryParams queryParams;
HigestSecInfoCallback *callback;
};
struct DATASLListParams {
struct DATASLCallbackParams *callbackParams;
struct DATASLListParams *prev;
struct DATASLListParams *next;
};
struct DATASLListParams* InitList(void);
int32_t PushListNode(struct DATASLListParams *list, struct DATASLCallbackParams *callbackParams);
void RemoveListNode(struct DATASLListParams *list, struct DATASLCallbackParams *callbackParams);
void ClearList(struct DATASLListParams *list);
int32_t GetListLength(struct DATASLListParams *list);
int32_t InitPthreadMutex(void);
void DestroyPthreadMutex(void);
void LookupCallback(struct DATASLListParams *list, DEVSLQueryParams *queryParams, int32_t result, uint32_t levelInfo);
/*
* Copyright (C) 2022 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 DEV_SLINFO_LIST_H
#define DEV_SLINFO_LIST_H
#include <stdlib.h>
#include "dev_slinfo_mgr.h"
struct DATASLCallbackParams {
DEVSLQueryParams queryParams;
HigestSecInfoCallback *callback;
};
struct DATASLListParams {
struct DATASLCallbackParams *callbackParams;
struct DATASLListParams *prev;
struct DATASLListParams *next;
};
struct DATASLListParams* InitList(void);
int32_t PushListNode(struct DATASLListParams *list, struct DATASLCallbackParams *callbackParams);
void RemoveListNode(struct DATASLListParams *list, struct DATASLCallbackParams *callbackParams);
void ClearList(struct DATASLListParams *list);
int32_t GetListLength(struct DATASLListParams *list);
int32_t InitPthreadMutex(void);
void DestroyPthreadMutex(void);
void LookupCallback(struct DATASLListParams *list, DEVSLQueryParams *queryParams, int32_t result, uint32_t levelInfo);
#endif
@@ -1,49 +1,49 @@
/*
* Copyright (C) 2022-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 DEV_SLINFO_LOG_H
#define DEV_SLINFO_LOG_H
#ifdef HILOG_ENABLE
#include "hilog/log.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "DataSl"
#ifdef LOG_DOMAIN
#undef LOG_DOMAIN
#endif
#define LOG_DOMAIN 0xD002F04
#define DATA_SEC_LOG_DEBUG(fmt, ...) HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__)
#define DATA_SEC_LOG_INFO(fmt, ...) HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__)
#define DATA_SEC_LOG_WARN(fmt, ...) HILOG_WARN(LOG_CORE, fmt, ##__VA_ARGS__)
#define DATA_SEC_LOG_ERROR(fmt, ...) HILOG_ERROR(LOG_CORE, fmt, ##__VA_ARGS__)
#else
#include <stdio.h>
#include <stdlib.h>
#define DATA_SEC_LOG_DEBUG(fmt, ...) printf("[DataSl][D][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#define DATA_SEC_LOG_INFO(fmt, ...) printf("[DataSl][I][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#define DATA_SEC_LOG_WARN(fmt, ...) printf("[DataSl][W][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#define DATA_SEC_LOG_ERROR(fmt, ...) printf("[DataSl][E][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#endif
/*
* Copyright (C) 2022-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 DEV_SLINFO_LOG_H
#define DEV_SLINFO_LOG_H
#ifdef HILOG_ENABLE
#include "hilog/log.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "DataSl"
#ifdef LOG_DOMAIN
#undef LOG_DOMAIN
#endif
#define LOG_DOMAIN 0xD002F04
#define DATA_SEC_LOG_DEBUG(fmt, ...) HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__)
#define DATA_SEC_LOG_INFO(fmt, ...) HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__)
#define DATA_SEC_LOG_WARN(fmt, ...) HILOG_WARN(LOG_CORE, fmt, ##__VA_ARGS__)
#define DATA_SEC_LOG_ERROR(fmt, ...) HILOG_ERROR(LOG_CORE, fmt, ##__VA_ARGS__)
#else
#include <stdio.h>
#include <stdlib.h>
#define DATA_SEC_LOG_DEBUG(fmt, ...) printf("[DataSl][D][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#define DATA_SEC_LOG_INFO(fmt, ...) printf("[DataSl][I][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#define DATA_SEC_LOG_WARN(fmt, ...) printf("[DataSl][W][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#define DATA_SEC_LOG_ERROR(fmt, ...) printf("[DataSl][E][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#endif
#endif
@@ -1,61 +1,61 @@
/*
* Copyright (C) 2022 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 DEV_SLINFO_MGR_H
#define DEV_SLINFO_MGR_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_UDID_LENGTH 64
#define DATA_SEC_LEVEL0 0 /* s0 */
#define DATA_SEC_LEVEL1 1 /* s1 */
#define DATA_SEC_LEVEL2 2 /* s2 */
#define DATA_SEC_LEVEL3 3 /* s3 */
#define DATA_SEC_LEVEL4 4 /* s4 */
typedef struct {
uint8_t udid[MAX_UDID_LENGTH];
uint32_t udidLen;
} DEVSLQueryParams;
enum {
DEVSL_SUCCESS = 0,
DEVSL_ERROR = 100,
DEVSL_ERR_REQUEST_DEVICE_EXCEED_LIMIT = 101,
DEVSL_ERR_DEVICE_SEC_SDK_INIT = 102,
DEVSL_ERR_OUT_OF_MEMORY = 103,
DEVSL_ERR_MUTEX_LOCK_INIT = 104,
DEVSL_ERR_BAD_PARAMETERS = 105,
};
int32_t DATASL_GetHighestSecLevel(DEVSLQueryParams *queryParams, uint32_t *levelInfo);
int32_t DATASL_OnStart(void);
void DATASL_OnStop(void);
typedef void HigestSecInfoCallback(DEVSLQueryParams *queryParams, int32_t result, uint32_t levelInfo);
int32_t DATASL_GetHighestSecLevelAsync(DEVSLQueryParams *queryParams, HigestSecInfoCallback *callback);
#ifdef __cplusplus
}
#endif
/*
* Copyright (C) 2022 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 DEV_SLINFO_MGR_H
#define DEV_SLINFO_MGR_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_UDID_LENGTH 64
#define DATA_SEC_LEVEL0 0 /* s0 */
#define DATA_SEC_LEVEL1 1 /* s1 */
#define DATA_SEC_LEVEL2 2 /* s2 */
#define DATA_SEC_LEVEL3 3 /* s3 */
#define DATA_SEC_LEVEL4 4 /* s4 */
typedef struct {
uint8_t udid[MAX_UDID_LENGTH];
uint32_t udidLen;
} DEVSLQueryParams;
enum {
DEVSL_SUCCESS = 0,
DEVSL_ERROR = 100,
DEVSL_ERR_REQUEST_DEVICE_EXCEED_LIMIT = 101,
DEVSL_ERR_DEVICE_SEC_SDK_INIT = 102,
DEVSL_ERR_OUT_OF_MEMORY = 103,
DEVSL_ERR_MUTEX_LOCK_INIT = 104,
DEVSL_ERR_BAD_PARAMETERS = 105,
};
int32_t DATASL_GetHighestSecLevel(DEVSLQueryParams *queryParams, uint32_t *levelInfo);
int32_t DATASL_OnStart(void);
void DATASL_OnStop(void);
typedef void HigestSecInfoCallback(DEVSLQueryParams *queryParams, int32_t result, uint32_t levelInfo);
int32_t DATASL_GetHighestSecLevelAsync(DEVSLQueryParams *queryParams, HigestSecInfoCallback *callback);
#ifdef __cplusplus
}
#endif
#endif
@@ -27,12 +27,12 @@ ohos_fuzztest("DataTransmitMgrFuzzTest") {
include_dirs = [
"./",
"../../../../interfaces/innerkits/datatransmitmgr/include",
"../../../../interfaces/inner_api/datatransmitmgr/include",
]
sources = [ "datatransmitmgr_fuzzer.cpp" ]
deps = [ "../../../../interfaces/innerkits/datatransmitmgr:data_transit_mgr" ]
deps = [ "../../../../interfaces/inner_api/datatransmitmgr:data_transit_mgr" ]
external_deps = [
"c_utils:utils",
@@ -27,12 +27,12 @@ ohos_fuzztest("DevSlinfoAdptFuzzTest") {
include_dirs = [
"./",
"../../../../interfaces/innerkits/datatransmitmgr/include",
"../../../../interfaces/inner_api/datatransmitmgr/include",
]
sources = [ "devslinfoadpt_fuzzer.cpp" ]
deps = [ "../../../../interfaces/innerkits/datatransmitmgr:data_transit_mgr" ]
deps = [ "../../../../interfaces/inner_api/datatransmitmgr:data_transit_mgr" ]
defines = [ "HILOG_ENABLE" ]
@@ -27,12 +27,12 @@ ohos_fuzztest("GetHighestSecLevelFuzzTest") {
include_dirs = [
"./",
"../../../../interfaces/innerkits/datatransmitmgr/include",
"../../../../interfaces/inner_api/datatransmitmgr/include",
]
sources = [ "gethighestseclevel_fuzzer.cpp" ]
deps = [ "../../../../interfaces/innerkits/datatransmitmgr:data_transit_mgr" ]
deps = [ "../../../../interfaces/inner_api/datatransmitmgr:data_transit_mgr" ]
defines = [ "HILOG_ENABLE" ]
@@ -27,12 +27,12 @@ ohos_fuzztest("GetHighestSecLevelAsyncFuzzTest") {
include_dirs = [
"./",
"../../../../interfaces/innerkits/datatransmitmgr/include",
"../../../../interfaces/inner_api/datatransmitmgr/include",
]
sources = [ "gethighestseclevelasync_fuzzer.cpp" ]
deps = [ "../../../../interfaces/innerkits/datatransmitmgr:data_transit_mgr" ]
deps = [ "../../../../interfaces/inner_api/datatransmitmgr:data_transit_mgr" ]
defines = [ "HILOG_ENABLE" ]
+2 -3
View File
@@ -18,8 +18,7 @@ config("datatransmitmgr_test_config") {
visibility = [ ":*" ]
include_dirs = [
"//base/security/dataclassification/test/unittest/datatransmitmgr",
"//base/security/dataclassification/interfaces/innerkits/datatransmitmgr/include",
"//base/startup/init/interfaces/innerkits/include/syspara",
"../../../interfaces/inner_api/datatransmitmgr/include",
"//third_party/googletest/googletest/include",
"//commonlibrary/c_utils/base/include",
]
@@ -45,7 +44,7 @@ ohos_unittest("DevSLMgrTest") {
}
}
deps = [ "../../../interfaces/innerkits/datatransmitmgr:data_transit_mgr" ]
deps = [ "../../../interfaces/inner_api/datatransmitmgr:data_transit_mgr" ]
defines = [ "HILOG_ENABLE" ]