mirror of
https://github.com/openharmony/security_deviceauth.git
synced 2026-07-19 15:37:11 -04:00
@@ -14,33 +14,29 @@
|
||||
if (defined(ohos_lite)) {
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
lite_component("deviceauth_lite") {
|
||||
features = [
|
||||
"services:deviceauth",
|
||||
"services:deviceauth_service",
|
||||
"services:deviceauth_sdk",
|
||||
]
|
||||
features = [ "services:deviceauth" ]
|
||||
if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
|
||||
features += [
|
||||
"services:deviceauth_service",
|
||||
"services:deviceauth_sdk",
|
||||
]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
import("//build/ohos.gni")
|
||||
import("deviceauth_env.gni")
|
||||
group("deviceauth_build") {
|
||||
deps = [
|
||||
"services:deviceauth",
|
||||
]
|
||||
deps = [ "services:deviceauth" ]
|
||||
}
|
||||
|
||||
group("deviceauth_service_build") {
|
||||
deps = [
|
||||
"services:deviceauth_service",
|
||||
]
|
||||
deps = [ "services:deviceauth_service" ]
|
||||
}
|
||||
|
||||
group("deviceauth_sdk_build") {
|
||||
deps = [
|
||||
"services:deviceauth_sdk",
|
||||
]
|
||||
deps = [ "services:deviceauth_sdk" ]
|
||||
}
|
||||
|
||||
|
||||
group("deviceauth_test_build") {
|
||||
testonly = true
|
||||
deps = [ "test/unittest/deviceauth:deviceauth_llt" ]
|
||||
|
||||
Executable → Regular
+49
-45
@@ -9,7 +9,7 @@
|
||||
# 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.
|
||||
# limitations under the License.
|
||||
|
||||
if (defined(ohos_lite)) {
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
@@ -19,67 +19,71 @@ if (defined(ohos_lite)) {
|
||||
import("deviceauth_hals.gni")
|
||||
|
||||
if (defined(ohos_lite)) {
|
||||
static_library("deviceauth_hal_linux") {
|
||||
include_dirs = hals_inc_path
|
||||
include_dirs += [
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/security/deviceauth/services/common/inc",
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include"
|
||||
]
|
||||
|
||||
sources = hal_common_files
|
||||
sources += [
|
||||
"src/dev_info/3516/hc_dev_info.c",
|
||||
"src/linux/lite/mbedtls_hash_to_point.c",
|
||||
"src/linux/lite/huks_adapter.c",
|
||||
"src/linux/hc_condition.c",
|
||||
"src/linux/hc_file.c",
|
||||
"src/linux/hc_init_protection.c",
|
||||
"src/linux/hc_mutex.c",
|
||||
"src/linux/hc_thread.c",
|
||||
"src/linux/hc_time.c",
|
||||
"src/linux/hc_types.c",
|
||||
]
|
||||
|
||||
cflags = [ "-DHILOG_ENABLE" ]
|
||||
defines = [ "LITE_DEVICE" ]
|
||||
|
||||
deps = [
|
||||
"//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk",
|
||||
"//build/lite/config/component/openssl:openssl_shared",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
"//third_party/mbedtls:mbedtls_shared",
|
||||
"//utils/native/lite:utils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//build/lite/config/component/cJSON:cjson_shared"
|
||||
]
|
||||
}
|
||||
if (ohos_kernel_type == "liteos_m") {
|
||||
static_library("deviceauth_hal_liteos") {
|
||||
include_dirs = hals_inc_path
|
||||
include_dirs += [
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/security/deviceauth/services/common/inc",
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include"
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
|
||||
"//utils/native/lite/memory/include",
|
||||
"//base/startup/syspara_lite/interfaces/kits/"
|
||||
]
|
||||
|
||||
|
||||
sources = hal_common_files
|
||||
sources += [
|
||||
"src/dev_info/watch/hc_dev_info.c",
|
||||
"src/dev_info/3516/hc_dev_info.c",
|
||||
"src/liteos/L0/hc_init_protection.c",
|
||||
"src/liteos/L0/huks_adapter.c",
|
||||
"src/liteos/L0/hc_file.c",
|
||||
"src/liteos/hc_condition.c",
|
||||
"src/liteos/hc_file.c",
|
||||
"src/liteos/hc_mutex.c",
|
||||
"src/liteos/hc_thread.c",
|
||||
"src/liteos/hc_time.c",
|
||||
"src/liteos/hc_types.c",
|
||||
]
|
||||
|
||||
|
||||
cflags = [ "-DHILOG_ENABLE" ]
|
||||
deps = [
|
||||
"//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk",
|
||||
"//utils/native/lite:utils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
"//base/startup/syspara_lite/frameworks/parameter/src:sysparam"
|
||||
]
|
||||
}
|
||||
} else {
|
||||
static_library("deviceauth_hal_linux") {
|
||||
include_dirs = hals_inc_path
|
||||
include_dirs += [
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/security/deviceauth/services/common/inc",
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include"
|
||||
]
|
||||
|
||||
sources = hal_common_files
|
||||
sources += [
|
||||
"src/dev_info/3516/hc_dev_info.c",
|
||||
"src/linux/lite/mbedtls_hash_to_point.c",
|
||||
"src/linux/lite/huks_adapter.c",
|
||||
"src/linux/hc_condition.c",
|
||||
"src/linux/hc_file.c",
|
||||
"src/linux/hc_init_protection.c",
|
||||
"src/linux/hc_mutex.c",
|
||||
"src/linux/hc_thread.c",
|
||||
"src/linux/hc_time.c",
|
||||
"src/linux/hc_types.c",
|
||||
]
|
||||
|
||||
cflags = [ "-DHILOG_ENABLE" ]
|
||||
defines = [ "LITE_DEVICE" ]
|
||||
|
||||
deps = [
|
||||
"//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk",
|
||||
"//build/lite/config/component/openssl:openssl_shared",
|
||||
|
||||
@@ -63,7 +63,7 @@ typedef struct {
|
||||
bool isAlias;
|
||||
} KeyBuff;
|
||||
|
||||
typedef int32_t (*InitAlgFunc)();
|
||||
typedef int32_t (*InitAlgFunc)(void);
|
||||
|
||||
typedef int32_t (*Sha256Func)(const Uint8Buff *message, Uint8Buff *hash);
|
||||
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
|
||||
#include "alg_defs.h"
|
||||
|
||||
const AlgLoader *GetLoaderInstance();
|
||||
const AlgLoader *GetLoaderInstance(void);
|
||||
|
||||
#endif
|
||||
@@ -86,7 +86,7 @@ uint32_t StringLength(const HcString *self);
|
||||
* Notice: You should delete string when you don't need the string anymore.
|
||||
* @return the created string.
|
||||
*/
|
||||
HcString CreateString();
|
||||
HcString CreateString(void);
|
||||
|
||||
/*
|
||||
* Delete a string. In fact it will not destroy the string,
|
||||
|
||||
@@ -61,7 +61,7 @@ void Init##TlvS(TlvS *tlv, unsigned short checkTag) \
|
||||
Init##TlvMember(&tlv->TlvMemberName, CheckTag); \
|
||||
tlv->offset[index++] = offsetof(TlvStructType, TlvMemberName);
|
||||
|
||||
#define END_TLV_STRUCT_DEFINE() \
|
||||
#define END_TLV_STRUCT_DEFINE(void) \
|
||||
tlv->offsetCount = index; \
|
||||
tlv->base.parse = ParseTlvStruct; \
|
||||
tlv->base.getlen = GetLenTlvStruct; \
|
||||
|
||||
@@ -134,7 +134,7 @@ void VClear##ClassName(ClassName* obj) \
|
||||
ClearParcel(&obj->parcel); \
|
||||
} \
|
||||
} \
|
||||
ClassName Create##ClassName() \
|
||||
ClassName Create##ClassName(void) \
|
||||
{ \
|
||||
ClassName obj; \
|
||||
obj.pushBack = VPushBack##ClassName; \
|
||||
|
||||
@@ -76,6 +76,6 @@ union KeyRoleInfoUnion {
|
||||
uint32_t roleInfo;
|
||||
};
|
||||
|
||||
const AlgLoader *GetRealLoaderInstance();
|
||||
const AlgLoader *GetRealLoaderInstance(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,9 +28,9 @@ typedef cJSON CJson;
|
||||
/* Need to call FreeJson to free the returned pointer when it's no longer in use. */
|
||||
CJson *CreateJsonFromString(const char *jsonStr);
|
||||
/* Need to call FreeJson to free the returned pointer when it's no longer in use. */
|
||||
CJson *CreateJson();
|
||||
CJson *CreateJson(void);
|
||||
/* Need to call FreeJson to free the returned pointer when it's no longer in use. */
|
||||
CJson *CreateJsonArray();
|
||||
CJson *CreateJsonArray(void);
|
||||
/* Need to call FreeJson to free the returned pointer when it's no longer in use. */
|
||||
CJson *DuplicateJson(const CJson *jsonObj);
|
||||
void FreeJson(CJson *jsonObj);
|
||||
|
||||
@@ -35,7 +35,7 @@ extern "C" {
|
||||
*/
|
||||
int32_t HcGetUdid(uint8_t *udid, int32_t udidLen);
|
||||
|
||||
const char *GetStoragePath();
|
||||
const char *GetStoragePath(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@
|
||||
*/
|
||||
int32_t HcGetUdid(uint8_t *udid, int32_t udidLen);
|
||||
|
||||
const char *GetStoragePath();
|
||||
const char *GetStoragePath(void);
|
||||
|
||||
#endif
|
||||
@@ -25,9 +25,9 @@ typedef enum InitStatusEnum {
|
||||
FINISH_DESTROY,
|
||||
} InitStatus;
|
||||
|
||||
int CheckInit();
|
||||
int CheckDestroy();
|
||||
void SetInitStatus();
|
||||
void SetDeInitStatus();
|
||||
int CheckInit(void);
|
||||
int CheckDestroy(void);
|
||||
void SetInitStatus(void);
|
||||
void SetDeInitStatus(void);
|
||||
|
||||
#endif
|
||||
@@ -26,7 +26,7 @@ extern "C" {
|
||||
#define TIME_OUT_VALUE 600
|
||||
|
||||
/* Return in seconds */
|
||||
int64_t HcGetCurTime();
|
||||
int64_t HcGetCurTime(void);
|
||||
|
||||
/* Return the interval seconds from startTime to current Time */
|
||||
int64_t HcGetIntervalTime(int64_t startTime);
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef uint32_t HcBool;
|
||||
|
||||
void* HcMalloc(uint32_t size, char val);
|
||||
void HcFree(void* addr);
|
||||
void ReportMalloc();
|
||||
void ReportMalloc(void);
|
||||
uint32_t HcStrlen(const char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
#ifndef HC_FILE_H
|
||||
#define HC_FILE_H
|
||||
|
||||
typedef union {
|
||||
void* pfd;
|
||||
int fd;
|
||||
typedef struct {
|
||||
union {
|
||||
void *pfd;
|
||||
int fd;
|
||||
} fileHandle;
|
||||
const char *filePath;
|
||||
} FileHandle;
|
||||
|
||||
typedef enum FileIdEnumT {
|
||||
@@ -30,10 +33,10 @@ typedef enum FileIdEnumT {
|
||||
#define MODE_FILE_WRITE 1
|
||||
|
||||
/* 0 indicates success, -1 indicates fail */
|
||||
int HcFileOpen(int fileId, int mode, FileHandle* file);
|
||||
int HcFileOpen(int fileId, int mode, FileHandle *file);
|
||||
int HcFileSize(FileHandle file);
|
||||
int HcFileRead(FileHandle file, void* dst, int dstSize);
|
||||
int HcFileWrite(FileHandle file, const void* src, int srcSize);
|
||||
int HcFileRead(FileHandle file, void *dst, int dstSize);
|
||||
int HcFileWrite(FileHandle file, const void *src, int srcSize);
|
||||
void HcFileClose(FileHandle file);
|
||||
void HcFileRemove(int fileId);
|
||||
void SetFilePath(FileIdEnum fileId, const char *path);
|
||||
|
||||
@@ -25,9 +25,9 @@ typedef enum InitStatusEnum {
|
||||
FINISH_DESTROY,
|
||||
} InitStatus;
|
||||
|
||||
int CheckInit();
|
||||
int CheckDestroy();
|
||||
void SetInitStatus();
|
||||
void SetDeInitStatus();
|
||||
int CheckInit(void);
|
||||
int CheckDestroy(void);
|
||||
void SetInitStatus(void);
|
||||
void SetDeInitStatus(void);
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
#define TIME_OUT_VALUE 600
|
||||
|
||||
/* Return in seconds */
|
||||
int64_t HcGetCurTime();
|
||||
int64_t HcGetCurTime(void);
|
||||
|
||||
/* Return the interval seconds from startTime to current Time */
|
||||
int64_t HcGetIntervalTime(int64_t startTime);
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef uint32_t HcBool;
|
||||
#endif
|
||||
|
||||
void *HcMalloc(uint32_t size, char val);
|
||||
void HcFree(void* addr);
|
||||
void HcFree(void *addr);
|
||||
uint32_t HcStrlen(const char *str);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ int32_t HcGetUdid(uint8_t *udid, int32_t udidLen)
|
||||
return HAL_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
LOGW("using fake udid");
|
||||
LOGD("using fake udid");
|
||||
const char *udidTemp = "ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00";
|
||||
(void)memset_s(udid, udidLen, 0, udidLen);
|
||||
if (memcpy_s(udid, udidLen, udidTemp, strlen(udidTemp)) != EOK) {
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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 "hc_file.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <securec.h>
|
||||
#include <stdio.h>
|
||||
#include "common_defs.h"
|
||||
#include "hc_error.h"
|
||||
#include "hc_log.h"
|
||||
#include "utils_file.h"
|
||||
|
||||
#define MAX_FILE_PATH_SIZE 64
|
||||
#define MAX_FOLDER_NAME_SIZE 128
|
||||
#define GET_FOLDER_OK 0
|
||||
#define GET_FOLDER_FAILED (-1)
|
||||
#define GET_FILE_OK 1
|
||||
#define DEFAULT_FILE_PERMISSION 0666
|
||||
|
||||
typedef struct {
|
||||
FileIdEnum fileId;
|
||||
char filePath[MAX_FILE_PATH_SIZE];
|
||||
} FileDefInfo;
|
||||
|
||||
static FileDefInfo g_fileDefInfo[FILE_ID_LAST] = {
|
||||
{ FILE_ID_GROUP, "/data/hcgroup.dat" }
|
||||
};
|
||||
|
||||
void SetFilePath(FileIdEnum fileId, const char *path)
|
||||
{
|
||||
if (fileId < 0 || fileId >= FILE_ID_LAST || path == NULL) {
|
||||
LOGE("Invalid path param");
|
||||
return;
|
||||
}
|
||||
if (sprintf_s(g_fileDefInfo[fileId].filePath, MAX_FILE_PATH_SIZE, "%s", path) == HAL_FAILED) {
|
||||
LOGE("Set file path failed fileId:%d", fileId);
|
||||
}
|
||||
}
|
||||
|
||||
int HcFileOpenRead(const char *path)
|
||||
{
|
||||
int ret = UtilsFileOpen(path, O_RDONLY, 0);
|
||||
LOGI("ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int HcFileOpenWrite(const char *path)
|
||||
{
|
||||
int ret = UtilsFileOpen(path, 02 | 0100, 0);
|
||||
LOGI("ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int HcFileOpen(int fileId, int mode, FileHandle *file)
|
||||
{
|
||||
if (fileId < 0 || fileId >= FILE_ID_LAST || file == NULL) {
|
||||
return HAL_FAILED;
|
||||
}
|
||||
if (mode == MODE_FILE_READ) {
|
||||
file->fileHandle.fd = HcFileOpenRead(g_fileDefInfo[fileId].filePath);
|
||||
file->filePath = g_fileDefInfo[fileId].filePath;
|
||||
} else {
|
||||
file->fileHandle.fd = HcFileOpenWrite(g_fileDefInfo[fileId].filePath);
|
||||
file->filePath = g_fileDefInfo[fileId].filePath;
|
||||
}
|
||||
if (file->fileHandle.fd == HAL_FAILED) {
|
||||
return HAL_FAILED;
|
||||
}
|
||||
return HAL_SUCCESS;
|
||||
}
|
||||
|
||||
int HcFileSize(FileHandle file)
|
||||
{
|
||||
int fileSize = 0;
|
||||
int ret = UtilsFileStat(file.filePath, (unsigned int *)&fileSize);
|
||||
LOGI("ret = %d, fileSize = %d\n", ret, fileSize);
|
||||
if (ret == HAL_SUCCESS) {
|
||||
return fileSize;
|
||||
} else {
|
||||
return HAL_FAILED;
|
||||
}
|
||||
return HAL_FAILED;
|
||||
}
|
||||
|
||||
int HcFileRead(FileHandle file, void *dst, int dstSize)
|
||||
{
|
||||
int fp = file.fileHandle.fd;
|
||||
if (fp == HAL_FAILED || dstSize < 0 || dst == NULL) {
|
||||
return HAL_FAILED;
|
||||
}
|
||||
int ret = UtilsFileRead(fp, (char *)dst, dstSize);
|
||||
LOGI("ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int HcFileWrite(FileHandle file, const void *src, int srcSize)
|
||||
{
|
||||
int fp = file.fileHandle.fd;
|
||||
if (fp == HAL_FAILED || srcSize < 0 || src == NULL) {
|
||||
return HAL_FAILED;
|
||||
}
|
||||
int ret = UtilsFileWrite(fp, src, srcSize);
|
||||
LOGI("ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void HcFileClose(FileHandle file)
|
||||
{
|
||||
int fp = file.fileHandle.fd;
|
||||
if (fp < 0) {
|
||||
return;
|
||||
}
|
||||
int ret = UtilsFileClose(fp);
|
||||
LOGI("ret = %d", ret);
|
||||
}
|
||||
|
||||
void HcFileRemove(int fileId)
|
||||
{
|
||||
if (fileId >= FILE_ID_LAST) {
|
||||
LOGE("Invalid fileId:%d", fileId);
|
||||
return;
|
||||
}
|
||||
int ret = UtilsFileDelete(g_fileDefInfo[fileId].filePath);
|
||||
LOGI("File delete result:%d", ret);
|
||||
}
|
||||
+13
-13
@@ -53,7 +53,7 @@ void SetFilePath(FileIdEnum fileId, const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
int GetNextFolder(const char* filePath, int* beginPos, char* dst, int size)
|
||||
int GetNextFolder(const char *filePath, int *beginPos, char *dst, int size)
|
||||
{
|
||||
int pos = (*beginPos);
|
||||
while (1) {
|
||||
@@ -81,7 +81,7 @@ int GetNextFolder(const char* filePath, int* beginPos, char* dst, int size)
|
||||
}
|
||||
}
|
||||
|
||||
int HcFileOpenRead(const char* path)
|
||||
int HcFileOpenRead(const char *path)
|
||||
{
|
||||
return open(path, O_RDONLY);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ static int IsFileValid(const char *path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HcFileOpenWrite(const char* path)
|
||||
int HcFileOpenWrite(const char *path)
|
||||
{
|
||||
char filePath[MAX_FOLDER_NAME_SIZE + 1];
|
||||
int beginPos = 0;
|
||||
@@ -127,17 +127,17 @@ int HcFileOpenWrite(const char* path)
|
||||
}
|
||||
}
|
||||
|
||||
int HcFileOpen(int fileId, int mode, FileHandle* file)
|
||||
int HcFileOpen(int fileId, int mode, FileHandle *file)
|
||||
{
|
||||
if (fileId < 0 || fileId >= FILE_ID_LAST || file == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if (mode == MODE_FILE_READ) {
|
||||
file->fd = HcFileOpenRead(g_fileDefInfo[fileId].filePath);
|
||||
file->fileHandle.fd = HcFileOpenRead(g_fileDefInfo[fileId].filePath);
|
||||
} else {
|
||||
file->fd = HcFileOpenWrite(g_fileDefInfo[fileId].filePath);
|
||||
file->fileHandle.fd = HcFileOpenWrite(g_fileDefInfo[fileId].filePath);
|
||||
}
|
||||
if (file->fd == -1) {
|
||||
if (file->fileHandle.fd == -1) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -145,15 +145,15 @@ int HcFileOpen(int fileId, int mode, FileHandle* file)
|
||||
|
||||
int HcFileSize(FileHandle file)
|
||||
{
|
||||
int fp = file.fd;
|
||||
int fp = file.fileHandle.fd;
|
||||
int size = lseek(fp, 0, SEEK_END);
|
||||
(void)lseek(fp, 0, SEEK_SET);
|
||||
return size;
|
||||
}
|
||||
|
||||
int HcFileRead(FileHandle file, void* dst, int dstSize)
|
||||
int HcFileRead(FileHandle file, void *dst, int dstSize)
|
||||
{
|
||||
int fp = file.fd;
|
||||
int fp = file.fileHandle.fd;
|
||||
if (fp == -1 || dstSize < 0 || dst == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -178,12 +178,12 @@ int HcFileRead(FileHandle file, void* dst, int dstSize)
|
||||
|
||||
int HcFileWrite(FileHandle file, const void *src, int srcSize)
|
||||
{
|
||||
int fp = file.fd;
|
||||
int fp = file.fileHandle.fd;
|
||||
if (fp == -1 || srcSize < 0 || src == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* srcBuffer = (const char*)src;
|
||||
const char *srcBuffer = (const char *)src;
|
||||
int total = 0;
|
||||
while (total < srcSize) {
|
||||
int writeCount = write(fp, srcBuffer + total, srcSize - total);
|
||||
@@ -197,7 +197,7 @@ int HcFileWrite(FileHandle file, const void *src, int srcSize)
|
||||
|
||||
void HcFileClose(FileHandle file)
|
||||
{
|
||||
int fp = file.fd;
|
||||
int fp = file.fileHandle.fd;
|
||||
if (fp == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "hc_mutex.h"
|
||||
|
||||
int MutexLock(HcMutex* mutex)
|
||||
static int HcMutexLock(HcMutex *mutex)
|
||||
{
|
||||
if (mutex == NULL) {
|
||||
return -1;
|
||||
@@ -23,7 +23,7 @@ int MutexLock(HcMutex* mutex)
|
||||
return -pthread_mutex_lock(&mutex->mutex);
|
||||
}
|
||||
|
||||
void MutexUnlock(HcMutex* mutex)
|
||||
static void HcMutexUnlock(HcMutex *mutex)
|
||||
{
|
||||
if (mutex == NULL) {
|
||||
return;
|
||||
@@ -31,7 +31,7 @@ void MutexUnlock(HcMutex* mutex)
|
||||
pthread_mutex_unlock(&mutex->mutex);
|
||||
}
|
||||
|
||||
int32_t InitHcMutex(struct HcMutexT* mutex)
|
||||
int32_t InitHcMutex(struct HcMutexT *mutex)
|
||||
{
|
||||
if (mutex == NULL) {
|
||||
return -1;
|
||||
@@ -40,12 +40,12 @@ int32_t InitHcMutex(struct HcMutexT* mutex)
|
||||
if (res != 0) {
|
||||
return res;
|
||||
}
|
||||
mutex->lock = MutexLock;
|
||||
mutex->unlock = MutexUnlock;
|
||||
mutex->lock = HcMutexLock;
|
||||
mutex->unlock = HcMutexUnlock;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DestroyHcMutex(struct HcMutexT* mutex)
|
||||
void DestroyHcMutex(struct HcMutexT *mutex)
|
||||
{
|
||||
if (mutex == NULL) {
|
||||
return;
|
||||
|
||||
@@ -25,17 +25,25 @@ void *HcMalloc(uint32_t size, char val)
|
||||
LOGE("Malloc size is invalid.");
|
||||
return NULL;
|
||||
}
|
||||
void* addr = OhosMalloc(MEM_TYPE_HICHAIN, size);
|
||||
#if defined(OHOS_MEM)
|
||||
void *addr = OhosMalloc(MEM_TYPE_HICHAIN, size);
|
||||
#else
|
||||
void *addr = malloc(size);
|
||||
#endif
|
||||
if (addr != NULL) {
|
||||
(void)memset_s(addr, size, val, size);
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
void HcFree(void* addr)
|
||||
void HcFree(void *addr)
|
||||
{
|
||||
if (addr != NULL) {
|
||||
OhosFree(addr);
|
||||
#if defined(OHOS_MEM)
|
||||
OhosFree(addr);
|
||||
#else
|
||||
free(addr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,10 +157,10 @@ typedef struct {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DEVICE_AUTH_API_PUBLIC int InitDeviceAuthService();
|
||||
DEVICE_AUTH_API_PUBLIC void DestroyDeviceAuthService();
|
||||
DEVICE_AUTH_API_PUBLIC const GroupAuthManager *GetGaInstance();
|
||||
DEVICE_AUTH_API_PUBLIC const DeviceGroupManager *GetGmInstance();
|
||||
DEVICE_AUTH_API_PUBLIC int InitDeviceAuthService(void);
|
||||
DEVICE_AUTH_API_PUBLIC void DestroyDeviceAuthService(void);
|
||||
DEVICE_AUTH_API_PUBLIC const GroupAuthManager *GetGaInstance(void);
|
||||
DEVICE_AUTH_API_PUBLIC const DeviceGroupManager *GetGmInstance(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Executable → Regular
+84
-68
@@ -26,95 +26,111 @@ if (defined(ohos_lite)) {
|
||||
include_dirs += [
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/common",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/transport",
|
||||
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
|
||||
]
|
||||
sources = deviceauth_files
|
||||
|
||||
defines = [ "HILOG_ENABLE" ]
|
||||
cflags = build_flags
|
||||
|
||||
if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
|
||||
include_dirs += [
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/common",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/transport",
|
||||
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
|
||||
]
|
||||
sources = deviceauth_files
|
||||
} else {
|
||||
include_dirs += [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
|
||||
sources = deviceauth_lite0_files
|
||||
}
|
||||
|
||||
deps = [
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
"//utils/native/lite:utils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//foundation/communication/dsoftbus/sdk:softbus_client",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
]
|
||||
if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
|
||||
deps += [
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//foundation/communication/dsoftbus/sdk:softbus_client",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
]
|
||||
} else {
|
||||
deps += [ "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite" ]
|
||||
}
|
||||
}
|
||||
|
||||
executable("deviceauth_service") {
|
||||
include_dirs = inc_path
|
||||
include_dirs += hals_inc_path
|
||||
include_dirs += [
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"${frameworks_path}/inc/lite",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr"
|
||||
]
|
||||
if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
|
||||
executable("deviceauth_service") {
|
||||
include_dirs = inc_path
|
||||
include_dirs += hals_inc_path
|
||||
include_dirs += [
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"${frameworks_path}/inc/lite",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr"
|
||||
]
|
||||
|
||||
sources = deviceauth_ipc_files
|
||||
sources += [
|
||||
"${frameworks_path}/src/lite/ipc_service_init.c",
|
||||
"${frameworks_path}/src/ipc_service.c"
|
||||
]
|
||||
sources = deviceauth_ipc_files
|
||||
sources += [
|
||||
"${frameworks_path}/src/lite/ipc_service_init.c",
|
||||
"${frameworks_path}/src/ipc_service.c"
|
||||
]
|
||||
|
||||
defines = [ "HILOG_ENABLE" ]
|
||||
if (ohos_kernel_type == "linux") {
|
||||
defines += [ "__LINUX__" ]
|
||||
defines = [ "HILOG_ENABLE" ]
|
||||
if (ohos_kernel_type == "linux") {
|
||||
defines += [ "__LINUX__" ]
|
||||
}
|
||||
ldflags = [ "-pthread" ]
|
||||
|
||||
deps = [
|
||||
":deviceauth",
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"//utils/native/lite:utils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//foundation/communication/ipc_lite:liteipc_adapter",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
]
|
||||
}
|
||||
ldflags = [ "-pthread" ]
|
||||
|
||||
deps = [
|
||||
":deviceauth",
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"//utils/native/lite:utils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//foundation/communication/ipc_lite:liteipc_adapter",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
]
|
||||
}
|
||||
shared_library("deviceauth_sdk") {
|
||||
include_dirs = inc_path
|
||||
include_dirs += hals_inc_path
|
||||
include_dirs += [
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"${frameworks_path}/inc/lite",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr"
|
||||
]
|
||||
|
||||
shared_library("deviceauth_sdk") {
|
||||
include_dirs = inc_path
|
||||
include_dirs += hals_inc_path
|
||||
include_dirs += [
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"${frameworks_path}/inc/lite",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr"
|
||||
]
|
||||
sources = deviceauth_ipc_files
|
||||
sources += [ "${frameworks_path}/src/ipc_sdk.c" ]
|
||||
|
||||
sources = deviceauth_ipc_files
|
||||
sources += [ "${frameworks_path}/src/ipc_sdk.c" ]
|
||||
defines = [ "HILOG_ENABLE" ]
|
||||
if (ohos_kernel_type == "linux") {
|
||||
defines += [ "__LINUX__" ]
|
||||
}
|
||||
cflags = build_flags
|
||||
cflags += [ "-fPIC" ]
|
||||
|
||||
defines = [ "HILOG_ENABLE" ]
|
||||
if (ohos_kernel_type == "linux") {
|
||||
defines += [ "__LINUX__" ]
|
||||
deps = [
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"//utils/native/lite:utils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//foundation/communication/ipc_lite:liteipc_adapter",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
]
|
||||
}
|
||||
cflags = build_flags
|
||||
cflags += [ "-fPIC" ]
|
||||
|
||||
deps = [
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"//utils/native/lite:utils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//foundation/communication/ipc_lite:liteipc_adapter",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
ohos_static_library("deviceauth") {
|
||||
|
||||
@@ -29,10 +29,10 @@ typedef struct {
|
||||
void (*postOnTrustedDeviceNumChanged)(int curTrustedDeviceNum);
|
||||
} Broadcaster;
|
||||
|
||||
bool IsBroadcastSupported();
|
||||
int32_t InitBroadcastManager();
|
||||
void DestroyBroadcastManager();
|
||||
Broadcaster *GetBroadcaster();
|
||||
bool IsBroadcastSupported(void);
|
||||
int32_t InitBroadcastManager(void);
|
||||
void DestroyBroadcastManager(void);
|
||||
Broadcaster *GetBroadcaster(void);
|
||||
int32_t AddListener(const char *appId, const DataChangeListener *listener);
|
||||
int32_t RemoveListener(const char *appId);
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ typedef struct {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t InitDatabase();
|
||||
void DestroyDatabase();
|
||||
int32_t InitDatabase(void);
|
||||
void DestroyDatabase(void);
|
||||
|
||||
Int64Vector CreateInt64Vector();
|
||||
Int64Vector CreateInt64Vector(void);
|
||||
void DestroyInt64Vector(Int64Vector *obj);
|
||||
|
||||
int32_t AddGroup(const GroupInfo *addParams);
|
||||
@@ -56,11 +56,11 @@ int32_t GetLocalDevUdid(char **udid);
|
||||
void DestroyUdid(char **udid);
|
||||
|
||||
void RegisterBroadcaster(const Broadcaster *broadcaster);
|
||||
void DeregisterBroadcaster();
|
||||
void DeregisterBroadcaster(void);
|
||||
void RegGenerateGroupIdFunc(int32_t (*generateGroupId)(int64_t userId, int64_t sharedUserId, char **returnGroupId));
|
||||
void DeregGenerateGroupIdFunc();
|
||||
void DeregGenerateGroupIdFunc(void);
|
||||
|
||||
int32_t GetTrustedDevNumber();
|
||||
int32_t GetTrustedDevNumber(void);
|
||||
int32_t GetGroupEntryByGroupId(const char *groupId, GroupInfo *returnGroupInfo);
|
||||
int32_t GetGroupEntry(const char *groupId, const char *udid, GroupInfo *returnGroupInfo);
|
||||
int32_t GetDeviceInfoForDevAuth(const char *udid, const char *groupId, DeviceInfo *deviceInfo);
|
||||
@@ -73,8 +73,8 @@ bool IsGroupOwner(const char *groupId, const char *appId);
|
||||
bool IsGroupAccessible(const char *groupId, const char *appId);
|
||||
bool IsGroupEditAllowed(const char *groupId, const char *appId);
|
||||
bool IsGroupExist(const char *ownerName, const char *groupName);
|
||||
bool IsIdenticalGroupExist();
|
||||
bool IsAcrossAccountGroupExist();
|
||||
bool IsIdenticalGroupExist(void);
|
||||
bool IsAcrossAccountGroupExist(void);
|
||||
bool IsGroupExistByGroupId(const char *groupId);
|
||||
bool IsTrustedDeviceExist(const char *udid);
|
||||
bool IsTrustedDeviceInGroup(const char *groupId, const char *udid);
|
||||
@@ -92,8 +92,8 @@ int32_t AddGroupFriend(const char *groupId, const char *friendAppId);
|
||||
int32_t RemoveGroupFriend(const char *groupId, const char *friendAppId);
|
||||
int32_t GetGroupFriends(const char *groupId, CJson *returnFriends);
|
||||
|
||||
GroupInfo *CreateGroupInfoStruct();
|
||||
DeviceInfo *CreateDeviceInfoStruct();
|
||||
GroupInfo *CreateGroupInfoStruct(void);
|
||||
DeviceInfo *CreateDeviceInfoStruct(void);
|
||||
void DestroyGroupInfoStruct(GroupInfo *groupInfo);
|
||||
void DestroyDeviceInfoStruct(DeviceInfo *deviceInfo);
|
||||
void CreateGroupInfoVecStruct(GroupInfoVec *vec);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "soft_bus_channel.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "device_auth_defines.h"
|
||||
|
||||
int32_t InitSoftBusChannelModule(void)
|
||||
|
||||
@@ -84,7 +84,7 @@ static void DestroyStrVector(StringVector *vec)
|
||||
DESTROY_HC_VECTOR(StringVector, vec)
|
||||
}
|
||||
|
||||
static TrustedGroupEntry *CreateGroupEntryStruct()
|
||||
static TrustedGroupEntry *CreateGroupEntryStruct(void)
|
||||
{
|
||||
TrustedGroupEntry *ptr = (TrustedGroupEntry *)HcMalloc(sizeof(TrustedGroupEntry), 0);
|
||||
if (ptr == NULL) {
|
||||
@@ -107,7 +107,7 @@ static void DestroyGroupEntryStruct(TrustedGroupEntry *groupEntry)
|
||||
DESTROY_HC_VECTOR(Int64Vector, &groupEntry->sharedUserIdVec)
|
||||
}
|
||||
|
||||
static void DestroyGroupTable()
|
||||
static void DestroyGroupTable(void)
|
||||
{
|
||||
uint32_t groupIndex;
|
||||
TrustedGroupEntry **entry = NULL;
|
||||
@@ -126,7 +126,7 @@ static void DestroyDeviceEntryStruct(TrustedDeviceEntry *deviceEntry)
|
||||
DeleteParcel(&deviceEntry->ext);
|
||||
}
|
||||
|
||||
static void DestroyTrustDevTable()
|
||||
static void DestroyTrustDevTable(void)
|
||||
{
|
||||
uint32_t devIndex;
|
||||
TrustedDeviceEntry *deviceEntry = NULL;
|
||||
@@ -247,7 +247,7 @@ static TrustedDeviceEntry *GetTrustedDeviceEntryByAuthId(const char *authId, con
|
||||
* Currently, this interface does not return the actual number of trusted devices.
|
||||
* If at least one trusted device exists, return 1. Otherwise, return 0.
|
||||
*/
|
||||
static int GetTrustedDeviceNum()
|
||||
static int GetTrustedDeviceNum(void)
|
||||
{
|
||||
return (g_trustedDeviceTable.size(&g_trustedDeviceTable) > 0) ? 1 : 0;
|
||||
}
|
||||
@@ -440,7 +440,7 @@ static void NotifyLastGroupDeleted(const char *peerUdid, int groupType)
|
||||
}
|
||||
}
|
||||
|
||||
static void NotifyTrustedDeviceNumChanged()
|
||||
static void NotifyTrustedDeviceNumChanged(void)
|
||||
{
|
||||
int trustedDeviceNum = GetTrustedDeviceNum();
|
||||
if (g_broadcaster != NULL && g_broadcaster->postOnTrustedDeviceNumChanged != NULL) {
|
||||
@@ -982,7 +982,7 @@ static bool LoadDBFromParcel(HcParcel *parcelIn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool LoadDB()
|
||||
static bool LoadDB(void)
|
||||
{
|
||||
FileHandle file;
|
||||
int ret = HcFileOpen(FILE_ID_GROUP, MODE_FILE_READ, &file);
|
||||
@@ -1113,7 +1113,7 @@ static bool SaveDBToParcel(HcParcel *parcelOut)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool SaveDB()
|
||||
static bool SaveDB(void)
|
||||
{
|
||||
HcParcel parcel = CreateParcel(0, 0);
|
||||
if (!SaveDBToParcel(&parcel)) {
|
||||
@@ -1436,7 +1436,7 @@ bool IsTrustedDeviceExist(const char *udid)
|
||||
}
|
||||
}
|
||||
|
||||
int32_t GetTrustedDevNumber()
|
||||
int32_t GetTrustedDevNumber(void)
|
||||
{
|
||||
g_databaseMutex->lock(g_databaseMutex);
|
||||
int num = GetTrustedDeviceNum();
|
||||
@@ -1611,7 +1611,7 @@ static void DeleteUserIdExpiredGroupEntry(int64_t curUserId)
|
||||
}
|
||||
}
|
||||
|
||||
static void DeleteAccountDeviceEntry()
|
||||
static void DeleteAccountDeviceEntry(void)
|
||||
{
|
||||
uint32_t devIndex = 0;
|
||||
TrustedDeviceEntry *deviceEntry = NULL;
|
||||
@@ -1633,7 +1633,7 @@ static void DeleteAccountDeviceEntry()
|
||||
}
|
||||
}
|
||||
|
||||
static void DeleteAccountGroupEntry()
|
||||
static void DeleteAccountGroupEntry(void)
|
||||
{
|
||||
TrustedGroupEntry **groupEntry = NULL;
|
||||
uint32_t groupIndex = 0;
|
||||
@@ -1848,7 +1848,7 @@ bool IsGroupExist(const char *ownerName, const char *groupName)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsIdenticalGroupExist()
|
||||
bool IsIdenticalGroupExist(void)
|
||||
{
|
||||
uint32_t index;
|
||||
TrustedGroupEntry **entry = NULL;
|
||||
@@ -1863,7 +1863,7 @@ bool IsIdenticalGroupExist()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsAcrossAccountGroupExist()
|
||||
bool IsAcrossAccountGroupExist(void)
|
||||
{
|
||||
uint32_t index;
|
||||
TrustedGroupEntry **entry = NULL;
|
||||
@@ -2042,7 +2042,7 @@ int32_t GetGroupEntryByGroupId(const char *groupId, GroupInfo *returnGroupInfo)
|
||||
return res;
|
||||
}
|
||||
|
||||
GroupInfo *CreateGroupInfoStruct()
|
||||
GroupInfo *CreateGroupInfoStruct(void)
|
||||
{
|
||||
GroupInfo *ptr = (GroupInfo *)HcMalloc(sizeof(GroupInfo), 0);
|
||||
if (ptr == NULL) {
|
||||
@@ -2067,7 +2067,7 @@ void DestroyGroupInfoStruct(GroupInfo *groupInfo)
|
||||
groupInfo = NULL;
|
||||
}
|
||||
|
||||
DeviceInfo *CreateDeviceInfoStruct()
|
||||
DeviceInfo *CreateDeviceInfoStruct(void)
|
||||
{
|
||||
DeviceInfo *deviceInfo = (DeviceInfo *)HcMalloc(sizeof(DeviceInfo), 0);
|
||||
if (deviceInfo == NULL) {
|
||||
@@ -2406,7 +2406,7 @@ int32_t GetTrustedDevices(const char *groupId, DeviceInfoVec *deviceInfoVec)
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t InitDatabase()
|
||||
int32_t InitDatabase(void)
|
||||
{
|
||||
g_trustedGroupTable = CREATE_HC_VECTOR(TrustedGroupTable)
|
||||
g_trustedDeviceTable = CREATE_HC_VECTOR(TrustedDeviceTable)
|
||||
@@ -2436,7 +2436,7 @@ int32_t InitDatabase()
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
void DestroyDatabase()
|
||||
void DestroyDatabase(void)
|
||||
{
|
||||
DestroyTrustDevTable();
|
||||
DestroyGroupTable();
|
||||
@@ -2456,7 +2456,7 @@ void RegGenerateGroupIdFunc(int32_t (*generateGroupId)(int64_t userId, int64_t s
|
||||
g_generateIdFunc = generateGroupId;
|
||||
}
|
||||
|
||||
void DeregGenerateGroupIdFunc()
|
||||
void DeregGenerateGroupIdFunc(void)
|
||||
{
|
||||
g_generateIdFunc = NULL;
|
||||
}
|
||||
@@ -2470,7 +2470,7 @@ void RegisterBroadcaster(const Broadcaster *broadcaster)
|
||||
g_broadcaster = broadcaster;
|
||||
}
|
||||
|
||||
void DeregisterBroadcaster()
|
||||
void DeregisterBroadcaster(void)
|
||||
{
|
||||
g_broadcaster = NULL;
|
||||
}
|
||||
@@ -1424,7 +1424,7 @@ static void DestroyInfo(char **returnInfo)
|
||||
instance->destroyInfo(returnInfo);
|
||||
}
|
||||
|
||||
static int32_t AllocGmAndGa()
|
||||
static int32_t AllocGmAndGa(void)
|
||||
{
|
||||
if (g_groupManagerInstance == NULL) {
|
||||
g_groupManagerInstance = (DeviceGroupManager *)HcMalloc(sizeof(DeviceGroupManager), 0);
|
||||
@@ -1445,7 +1445,7 @@ static int32_t AllocGmAndGa()
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t InitAlgorithm()
|
||||
static int32_t InitAlgorithm(void)
|
||||
{
|
||||
const AlgLoader *loader = GetLoaderInstance();
|
||||
if (loader == NULL) {
|
||||
@@ -1460,7 +1460,7 @@ static int32_t InitAlgorithm()
|
||||
return res;
|
||||
}
|
||||
|
||||
static void DestroyGmAndGa()
|
||||
static void DestroyGmAndGa(void)
|
||||
{
|
||||
if (g_groupAuthManager != NULL) {
|
||||
HcFree(g_groupAuthManager);
|
||||
@@ -1472,7 +1472,7 @@ static void DestroyGmAndGa()
|
||||
}
|
||||
}
|
||||
|
||||
DEVICE_AUTH_API_PUBLIC int InitDeviceAuthService()
|
||||
DEVICE_AUTH_API_PUBLIC int InitDeviceAuthService(void)
|
||||
{
|
||||
LOGI("[Service]: Start to init device auth service!");
|
||||
if (CheckInit() == FINISH_INIT) {
|
||||
@@ -1519,7 +1519,7 @@ err:
|
||||
return res;
|
||||
}
|
||||
|
||||
DEVICE_AUTH_API_PUBLIC void DestroyDeviceAuthService()
|
||||
DEVICE_AUTH_API_PUBLIC void DestroyDeviceAuthService(void)
|
||||
{
|
||||
LOGI("[Service]: Start to destroy device auth service!");
|
||||
if (CheckDestroy() == FINISH_DESTROY) {
|
||||
|
||||
+69
-25
@@ -52,34 +52,36 @@ inc_path = [
|
||||
"${services_path}/session/inc/key_agree_session",
|
||||
]
|
||||
|
||||
deviceauth_files = [
|
||||
"${services_path}/device_auth.c",
|
||||
"${services_path}/common/src/broadcast_manager/broadcast_manager.c",
|
||||
"${services_path}/common/src/callback_manager/callback_manager.c",
|
||||
"${services_path}/common/src/channel_manager/channel_manager.c",
|
||||
"${services_path}/common/src/channel_manager/soft_bus_channel/soft_bus_channel.c",
|
||||
"${services_path}/common/src/data_base/database_manager.c",
|
||||
"${services_path}/common/src/task_manager/task_manager.c",
|
||||
module_only_iso_files = [
|
||||
"${services_path}/module/src/das_module/iso_task/iso_client_task.c",
|
||||
"${services_path}/module/src/das_module/iso_task/iso_server_task.c",
|
||||
"${services_path}/module/src/das_module/iso_task/iso_task_common.c",
|
||||
"${services_path}/module/src/das_module/iso_task/iso_task_main.c",
|
||||
"${services_path}/module/src/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.c",
|
||||
"${services_path}/module/src/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.c",
|
||||
"${services_path}/module/src/das_module/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c",
|
||||
"${services_path}/module/src/das_module/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c",
|
||||
"${services_path}/module/src/das_module/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c",
|
||||
"${services_path}/module/src/das_module/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c",
|
||||
|
||||
"${services_path}/group_auth/src/group_auth_manager/group_auth_manager.c",
|
||||
"${services_path}/group_auth/src/group_auth_manager/account_unrelated_group_auth/account_unrelated_group_auth.c",
|
||||
"${services_path}/group_auth/src/group_auth_manager/account_related_group_auth_mock/account_related_group_auth_mock.c",
|
||||
"${services_path}/module/src/das_module/pake_task/pake_task_common.c",
|
||||
"${services_path}/module/src/das_module/pake_task/pake_message_util.c",
|
||||
"${services_path}/module/src/das_module/pake_task/new_pake_task_mock/new_pake_task_main_mock.c",
|
||||
"${services_path}/module/src/das_module/pake_task/pake_task_mock/pake_task_main_mock.c",
|
||||
"${services_path}/module/src/das_module/pake_task/standard_exchange_task_mock/standard_exchange_task_mock.c",
|
||||
|
||||
"${services_path}/group_manager/src/group_manager/group_common.c",
|
||||
"${services_path}/group_manager/src/group_manager/group_manager.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_unrelated/peer_to_peer_group/peer_to_peer_group.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_unrelated/account_unrelated_group_manager/account_unrelated_group_manager.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_related/across_account_group_mock/across_account_group_mock.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_related/identical_account_group_mock/identical_account_group_mock.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_related/account_related_group_manager_mock/account_related_group_manager_mock.c",
|
||||
"${services_path}/module/src/protocol/protocol_common.c",
|
||||
"${services_path}/module/src/protocol/pake_protocol/pake_protocol_common.c",
|
||||
"${services_path}/module/src/protocol/iso_protocol/iso_protocol_common.c",
|
||||
"${services_path}/module/src/protocol/pake_protocol/pake_protocol_ec_mock/pake_protocol_ec_mock.c",
|
||||
"${services_path}/module/src/protocol/pake_protocol/pake_protocol_dl_mock/pake_protocol_dl_mock.c",
|
||||
"${services_path}/module/src/protocol/new_pake_protocol/new_pake_protocol_ec_mock/new_pake_protocol_ec_mock.c",
|
||||
"${services_path}/module/src/protocol/new_pake_protocol/new_pake_protocol_dl_mock/new_pake_protocol_dl_mock.c",
|
||||
|
||||
"${services_path}/module/src/dev_auth_module_manager.c",
|
||||
"${services_path}/module/src/module_common.c",
|
||||
"${services_path}/module/src/version_util.c",
|
||||
"${services_path}/module/src/das_module/das_common.c",
|
||||
"${services_path}/module/src/das_module/das_module.c",
|
||||
"${services_path}/module/src/das_module/task_main.c",
|
||||
"${services_path}/module/src/das_module/das_version_util.c",
|
||||
"${services_path}/module/src/tcis_module_mock/tcis_module_mock.c",
|
||||
]
|
||||
|
||||
module_only_pake_files = [
|
||||
"${services_path}/module/src/das_module/iso_task_mock/iso_task_main_mock.c",
|
||||
"${services_path}/module/src/das_module/pake_task/pake_task_common.c",
|
||||
"${services_path}/module/src/das_module/pake_task/pake_message_util.c",
|
||||
@@ -105,6 +107,31 @@ deviceauth_files = [
|
||||
"${services_path}/module/src/protocol/pake_protocol/pake_protocol_dl/pake_protocol_dl.c",
|
||||
"${services_path}/module/src/protocol/new_pake_protocol/new_pake_protocol_ec_mock/new_pake_protocol_ec_mock.c",
|
||||
"${services_path}/module/src/protocol/new_pake_protocol/new_pake_protocol_dl_mock/new_pake_protocol_dl_mock.c",
|
||||
]
|
||||
|
||||
channel_with_soft_bus_files = ["${services_path}/common/src/channel_manager/soft_bus_channel/soft_bus_channel.c"]
|
||||
|
||||
channel_without_soft_bus_files = ["${services_path}/common/src/channel_manager/soft_bus_channel_mock/soft_bus_channel_mock.c"]
|
||||
|
||||
deviceauth_base_files = [
|
||||
"${services_path}/device_auth.c",
|
||||
"${services_path}/common/src/broadcast_manager/broadcast_manager.c",
|
||||
"${services_path}/common/src/callback_manager/callback_manager.c",
|
||||
"${services_path}/common/src/channel_manager/channel_manager.c",
|
||||
"${services_path}/common/src/data_base/database_manager.c",
|
||||
"${services_path}/common/src/task_manager/task_manager.c",
|
||||
|
||||
"${services_path}/group_auth/src/group_auth_manager/group_auth_manager.c",
|
||||
"${services_path}/group_auth/src/group_auth_manager/account_unrelated_group_auth/account_unrelated_group_auth.c",
|
||||
"${services_path}/group_auth/src/group_auth_manager/account_related_group_auth_mock/account_related_group_auth_mock.c",
|
||||
|
||||
"${services_path}/group_manager/src/group_manager/group_common.c",
|
||||
"${services_path}/group_manager/src/group_manager/group_manager.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_unrelated/peer_to_peer_group/peer_to_peer_group.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_unrelated/account_unrelated_group_manager/account_unrelated_group_manager.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_related/across_account_group_mock/across_account_group_mock.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_related/identical_account_group_mock/identical_account_group_mock.c",
|
||||
"${services_path}/group_manager/src/group_manager/account_related/account_related_group_manager_mock/account_related_group_manager_mock.c",
|
||||
|
||||
"${services_path}/session/src/auth_session/auth_session_client.c",
|
||||
"${services_path}/session/src/auth_session/auth_session_common.c",
|
||||
@@ -124,8 +151,25 @@ deviceauth_files = [
|
||||
"${services_path}/session/src/auth_session_common_util.c",
|
||||
"${services_path}/session/src/session_common.c",
|
||||
"${services_path}/session/src/session_manager.c",
|
||||
|
||||
"${services_path}/module/src/dev_auth_module_manager.c",
|
||||
"${services_path}/module/src/module_common.c",
|
||||
"${services_path}/module/src/version_util.c",
|
||||
"${services_path}/module/src/das_module/das_common.c",
|
||||
"${services_path}/module/src/das_module/das_module.c",
|
||||
"${services_path}/module/src/das_module/task_main.c",
|
||||
"${services_path}/module/src/das_module/das_version_util.c",
|
||||
]
|
||||
|
||||
deviceauth_files = deviceauth_base_files
|
||||
deviceauth_files += module_only_pake_files
|
||||
deviceauth_files += channel_with_soft_bus_files
|
||||
|
||||
deviceauth_lite0_files = deviceauth_base_files
|
||||
deviceauth_lite0_files += module_only_iso_files
|
||||
deviceauth_lite0_files += channel_without_soft_bus_files
|
||||
|
||||
#build_flags = [ "-Wrestrict" ]
|
||||
build_flags = [ "-Werror" ]
|
||||
|
||||
if (target_os == "linux") {
|
||||
|
||||
@@ -29,6 +29,6 @@ typedef struct {
|
||||
GetTcisCandidateGroupFunc getTcisCandidateGroup;
|
||||
} AccountRelatedGroupAuth;
|
||||
|
||||
BaseGroupAuth *GetAccountRelatedGroupAuth();
|
||||
BaseGroupAuth *GetAccountRelatedGroupAuth(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,6 @@ typedef struct {
|
||||
OnDasErrorFunc onDasError;
|
||||
} NonAccountGroupAuth;
|
||||
|
||||
BaseGroupAuth *GetNonAccountGroupAuth();
|
||||
BaseGroupAuth *GetNonAccountGroupAuth(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef struct {
|
||||
int32_t (*processCredential)(int operationCode, const char *reqJsonStr, char **returnJsonStr);
|
||||
} AccountRelatedGroupManager;
|
||||
|
||||
AccountRelatedGroupManager *GetAccountRelatedGroupManager();
|
||||
bool IsAccountRelatedGroupManagerSupported();
|
||||
AccountRelatedGroupManager *GetAccountRelatedGroupManager(void);
|
||||
bool IsAccountRelatedGroupManagerSupported(void);
|
||||
bool IsAccountRelatedGroupTypeSupported(int32_t groupType);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef struct {
|
||||
int32_t (*generateGroupId)(int64_t userId, int64_t sharedUserId, char **returnGroupId);
|
||||
} AcrossAccountGroup;
|
||||
|
||||
bool IsAcrossAccountGroupSupported();
|
||||
BaseGroup *GetAcrossAccountGroupInstance();
|
||||
bool IsAcrossAccountGroupSupported(void);
|
||||
BaseGroup *GetAcrossAccountGroupInstance(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef struct {
|
||||
int32_t (*syncDeleteGroup)(const CJson *jsonParams);
|
||||
} IdenticalAccountGroup;
|
||||
|
||||
bool IsIdenticalAccountGroupSupported();
|
||||
BaseGroup *GetIdenticalAccountGroupInstance();
|
||||
bool IsIdenticalAccountGroupSupported(void);
|
||||
BaseGroup *GetIdenticalAccountGroupInstance(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,8 +31,8 @@ typedef struct {
|
||||
uint32_t *returnSize);
|
||||
} AccountUnrelatedGroupManager;
|
||||
|
||||
AccountUnrelatedGroupManager *GetAccountUnrelatedGroupManager();
|
||||
bool IsAccountUnrelatedGroupManagerSupported();
|
||||
AccountUnrelatedGroupManager *GetAccountUnrelatedGroupManager(void);
|
||||
bool IsAccountUnrelatedGroupManagerSupported(void);
|
||||
bool IsAccountUnrelatedGroupTypeSupported(int32_t groupType);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef struct {
|
||||
uint32_t *returnSize);
|
||||
} PeerToPeerGroup;
|
||||
|
||||
BaseGroup *GetPeerToPeerGroupInstance();
|
||||
bool IsPeerToPeerGroupSupported();
|
||||
BaseGroup *GetPeerToPeerGroupInstance(void);
|
||||
bool IsPeerToPeerGroupSupported(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -57,9 +57,9 @@ typedef struct {
|
||||
void (*destroyInfo)(char **returnInfo);
|
||||
} GroupManager;
|
||||
|
||||
int32_t InitGroupManager();
|
||||
void DestroyGroupManager();
|
||||
GroupManager *GetGroupManagerInstance();
|
||||
bool IsGroupManagerSupported();
|
||||
int32_t InitGroupManager(void);
|
||||
void DestroyGroupManager(void);
|
||||
GroupManager *GetGroupManagerInstance(void);
|
||||
bool IsGroupManagerSupported(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "common_defs.h"
|
||||
#include "common_util.h"
|
||||
|
||||
bool IsDasSupported();
|
||||
bool IsDasSupported(void);
|
||||
|
||||
typedef struct DasAuthModuleT {
|
||||
AuthModuleBase moduleBase;
|
||||
@@ -28,6 +28,6 @@ typedef struct DasAuthModuleT {
|
||||
int (*deletePeerAuthInfo)(const char *, const char *, Uint8Buff *, int);
|
||||
} DasAuthModule;
|
||||
|
||||
AuthModuleBase *CreateDasModule();
|
||||
AuthModuleBase *CreateDasModule(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ typedef struct IsoParamsT {
|
||||
} IsoParams;
|
||||
|
||||
typedef struct SymBaseCurTaskT {
|
||||
CurTaskType (*getCurTaskType)();
|
||||
CurTaskType (*getCurTaskType)(void);
|
||||
void (*destroyTask)(struct SymBaseCurTaskT *);
|
||||
int(*process)(struct SymBaseCurTaskT *, IsoParams *params, const CJson *in, CJson *out, int *status);
|
||||
int taskStatus;
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ typedef struct {
|
||||
SymBaseCurTask taskBase;
|
||||
} IsoProtocolClientTask;
|
||||
|
||||
SymBaseCurTask *CreateProtocolClientTask();
|
||||
SymBaseCurTask *CreateProtocolClientTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ typedef struct {
|
||||
SymBaseCurTask taskBase;
|
||||
} IsoProtocolServerTask;
|
||||
|
||||
SymBaseCurTask *CreateProtocolServerTask();
|
||||
SymBaseCurTask *CreateProtocolServerTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "json_utils.h"
|
||||
#include "das_asy_token_manager.h"
|
||||
|
||||
bool IsIsoSupported();
|
||||
const TokenManager *GetSymTokenManagerInstance();
|
||||
bool IsIsoSupported(void);
|
||||
const TokenManager *GetSymTokenManagerInstance(void);
|
||||
SubTaskBase *CreateIsoSubTask(const CJson *in, CJson *out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,6 @@ typedef struct TokenManagerT {
|
||||
int (*computeAndSavePsk)(const PakeParams *params);
|
||||
} TokenManager;
|
||||
|
||||
const TokenManager *GetAsyTokenManagerInstance();
|
||||
const TokenManager *GetAsyTokenManagerInstance(void);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ typedef struct {
|
||||
AsyBaseCurTask taskBase;
|
||||
} NewPakeProtocolClientTask;
|
||||
|
||||
AsyBaseCurTask *CreateNewPakeProtocolClientTask();
|
||||
AsyBaseCurTask *CreateNewPakeProtocolClientTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ typedef struct {
|
||||
AsyBaseCurTask taskBase;
|
||||
} NewPakeProtocolServerTask;
|
||||
|
||||
AsyBaseCurTask *CreateNewPakeProtocolServerTask();
|
||||
AsyBaseCurTask *CreateNewPakeProtocolServerTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "json_utils.h"
|
||||
#include "das_module_defines.h"
|
||||
|
||||
bool IsSupportNewPake();
|
||||
bool IsSupportNewPake(void);
|
||||
SubTaskBase *CreateNewPakeSubTask(const CJson *in, CJson *out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct PakeParamsT {
|
||||
} PakeParams;
|
||||
|
||||
typedef struct AsyBaseCurTaskT {
|
||||
CurTaskType (*getCurTaskType)();
|
||||
CurTaskType (*getCurTaskType)(void);
|
||||
void (*destroyTask)(struct AsyBaseCurTaskT *);
|
||||
int(*process)(struct AsyBaseCurTaskT *, PakeParams *params, const CJson *in, CJson *out, int *status);
|
||||
int taskStatus;
|
||||
|
||||
@@ -22,6 +22,6 @@ typedef struct {
|
||||
AsyBaseCurTask taskBase;
|
||||
} PakeProtocolClientTask;
|
||||
|
||||
AsyBaseCurTask *CreatePakeProtocolClientTask();
|
||||
AsyBaseCurTask *CreatePakeProtocolClientTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,6 @@ typedef struct {
|
||||
AsyBaseCurTask taskBase;
|
||||
} PakeProtocolServerTask;
|
||||
|
||||
AsyBaseCurTask *CreatePakeProtocolServerTask();
|
||||
AsyBaseCurTask *CreatePakeProtocolServerTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "json_utils.h"
|
||||
#include "das_module_defines.h"
|
||||
|
||||
bool IsSupportPake();
|
||||
bool IsSupportPake(void);
|
||||
SubTaskBase *CreatePakeSubTask(const CJson *in, CJson *out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,6 @@ typedef struct {
|
||||
StandardBindExchangeParams params;
|
||||
} StandardBindExchangeClientTask;
|
||||
|
||||
AsyBaseCurTask *CreateStandardBindExchangeClientTask();
|
||||
AsyBaseCurTask *CreateStandardBindExchangeClientTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,6 @@ typedef struct {
|
||||
StandardUnbindExchangeParams params;
|
||||
} StandardUnbindExchangeClientTask;
|
||||
|
||||
AsyBaseCurTask *CreateStandardUnbindExchangeClientTask();
|
||||
AsyBaseCurTask *CreateStandardUnbindExchangeClientTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,6 @@ typedef struct {
|
||||
StandardBindExchangeParams params;
|
||||
} StandardBindExchangeServerTask;
|
||||
|
||||
AsyBaseCurTask *CreateStandardBindExchangeServerTask();
|
||||
AsyBaseCurTask *CreateStandardBindExchangeServerTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,6 @@ typedef struct {
|
||||
StandardUnbindExchangeParams params;
|
||||
} StandardUnbindExchangeServerTask;
|
||||
|
||||
AsyBaseCurTask *CreateStandardUnbindExchangeServerTask();
|
||||
AsyBaseCurTask *CreateStandardUnbindExchangeServerTask(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,8 +33,8 @@ typedef struct TaskT {
|
||||
|
||||
Task *CreateTaskT(int *taskId, const CJson *in, CJson *out);
|
||||
|
||||
int32_t InitDasProtocolType();
|
||||
void DestroyDasProtocolType();
|
||||
int32_t InitDasProtocolType(void);
|
||||
void DestroyDasProtocolType(void);
|
||||
|
||||
int32_t RegisterLocalIdentityInTask(const char *pkgName, const char *serviceType, Uint8Buff *authId, int userType);
|
||||
int32_t UnregisterLocalIdentityInTask(const char *pkgName, const char *serviceType, Uint8Buff *authId, int userType);
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t InitModules();
|
||||
void DestroyModules();
|
||||
int32_t InitModules(void);
|
||||
void DestroyModules(void);
|
||||
|
||||
int32_t CreateTask(int *taskId, const CJson *in, CJson *out, int moduleType);
|
||||
int32_t ProcessTask(int taskId, const CJson *in, CJson *out, int *status, int moduleType);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "hc_types.h"
|
||||
#include "pake_defs.h"
|
||||
|
||||
uint32_t GetPakeNewDlAlg();
|
||||
uint32_t GetPakeNewDlAlg(void);
|
||||
int32_t GenerateNewDlPakeParams(PakeBaseParams *params, const Uint8Buff *secret);
|
||||
int32_t AgreeNewDlSharedSecret(PakeBaseParams *params, Uint8Buff *sharedSecret);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "hc_types.h"
|
||||
#include "pake_defs.h"
|
||||
|
||||
uint32_t GetPakeNewEcAlg();
|
||||
uint32_t GetPakeNewEcAlg(void);
|
||||
int32_t GenerateNewEcPakeParams(PakeBaseParams *params, Uint8Buff *secret);
|
||||
int32_t AgreeNewEcSharedSecret(PakeBaseParams *params, Uint8Buff *sharedSecret);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "hc_types.h"
|
||||
#include "pake_defs.h"
|
||||
|
||||
uint32_t GetPakeDlAlg();
|
||||
uint32_t GetPakeDlAlg(void);
|
||||
int32_t GenerateDlPakeParams(PakeBaseParams *params, const Uint8Buff *secret);
|
||||
int32_t GenerateDlSharedSecret(PakeBaseParams *params, Uint8Buff *sharedSecret);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "hc_types.h"
|
||||
#include "pake_defs.h"
|
||||
|
||||
uint32_t GetPakeEcAlg();
|
||||
uint32_t GetPakeEcAlg(void);
|
||||
int32_t GenerateEcPakeParams(PakeBaseParams *params, Uint8Buff *secret);
|
||||
int32_t GenerateEcSharedSecret(PakeBaseParams *params, Uint8Buff *sharedSecret);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "tcis_module_defines.h"
|
||||
|
||||
typedef struct _TaskBase {
|
||||
TcisTaskType (*getTaskType)();
|
||||
TcisTaskType (*getTaskType)(void);
|
||||
void (*destroyTask)(struct _TaskBase *);
|
||||
int (*process)(struct _TaskBase *, CJson *in, CJson *out, int *status);
|
||||
int taskStatus;
|
||||
|
||||
@@ -71,20 +71,20 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
int (*setToken)(CJson *in, CJson *out);
|
||||
uint64_t (*getUserId)();
|
||||
uint64_t (*getUserId)(void);
|
||||
int (*getDeviceId)(Uint8Buff *deviceId);
|
||||
int (*getToken)(TcisToken *token);
|
||||
int (*getServerPublicKey)(Uint8Buff *publicKey);
|
||||
int (*deleteToken)();
|
||||
int (*deleteToken)(void);
|
||||
#ifdef ASY
|
||||
int (*setRegisterProof)(CJson *in);
|
||||
int (*getRegisterProof)(CJson *out);
|
||||
#endif
|
||||
} TcisAuthTokenManager;
|
||||
|
||||
TcisAuthTokenManager *GetTcisAuthTokenManager();
|
||||
TcisAuthTokenManager *GetTcisAuthTokenManager(void);
|
||||
|
||||
void InitTcisTokenManagerAlg();
|
||||
void InitTcisTokenManagerAlg(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -50,8 +50,8 @@ typedef struct {
|
||||
AlgLoader *algLoader;
|
||||
} TcisAuthModule;
|
||||
|
||||
AuthModuleBase *CreateTcisModule();
|
||||
AuthModuleBase *CreateTcisModule(void);
|
||||
|
||||
bool IsTcisSupported();
|
||||
bool IsTcisSupported(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -75,6 +75,7 @@ err:
|
||||
|
||||
void SendErrMsgToSelf(const CJson *in, CJson *out, int errCode)
|
||||
{
|
||||
(void)in;
|
||||
CJson *sendToSelf = CreateJson();
|
||||
if (sendToSelf == NULL) {
|
||||
return;
|
||||
|
||||
+3
-2
@@ -28,7 +28,7 @@ enum {
|
||||
TASK_STATUS_FINAL,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_ISO_PROTOCOL;
|
||||
}
|
||||
@@ -81,6 +81,7 @@ err:
|
||||
|
||||
static int IsoClientStart(SymBaseCurTask *task, IsoParams *params, const CJson *in, CJson *out, int *status)
|
||||
{
|
||||
(void)in;
|
||||
if (task->taskStatus != TASK_STATUS_BEGIN) {
|
||||
LOGI("The message is repeated, ignore it, status :%d", task->taskStatus);
|
||||
*status = IGNORE_MSG;
|
||||
@@ -285,7 +286,7 @@ out_func:
|
||||
return res;
|
||||
}
|
||||
|
||||
SymBaseCurTask *CreateProtocolClientTask()
|
||||
SymBaseCurTask *CreateProtocolClientTask(void)
|
||||
{
|
||||
IsoProtocolClientTask *task = (IsoProtocolClientTask *)HcMalloc(sizeof(IsoProtocolClientTask), 0);
|
||||
if (task == NULL) {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ enum {
|
||||
TASK_STATUS_FINAL,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_ISO_PROTOCOL;
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ int GenerateSeed(IsoParams *params)
|
||||
HcFree(random);
|
||||
return res;
|
||||
}
|
||||
clock_t times = clock();
|
||||
clock_t times = 0;
|
||||
uint8_t *input = (uint8_t *)HcMalloc(SEED_LEN + sizeof(clock_t), 0);
|
||||
if (input == NULL) {
|
||||
LOGE("malloc failed");
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
static int32_t UnregisterLocalIdentity(const char *pkgName, const char *serviceType, Uint8Buff *authId, int userType)
|
||||
{
|
||||
(void)userType;
|
||||
const AlgLoader *loader = GetLoaderInstance();
|
||||
Uint8Buff pkgNameBuff = { (uint8_t *)pkgName, HcStrlen(pkgName) };
|
||||
Uint8Buff serviceTypeBuff = { (uint8_t *)serviceType, HcStrlen(serviceType) };
|
||||
@@ -47,6 +48,7 @@ static int32_t UnregisterLocalIdentity(const char *pkgName, const char *serviceT
|
||||
|
||||
static int32_t DeletePeerAuthInfo(const char *pkgName, const char *serviceType, Uint8Buff *authIdPeer, int userTypePeer)
|
||||
{
|
||||
(void)userTypePeer;
|
||||
const AlgLoader *loader = GetLoaderInstance();
|
||||
Uint8Buff pkgNameBuff = { (uint8_t *)pkgName, HcStrlen(pkgName)};
|
||||
Uint8Buff serviceTypeBuff = { (uint8_t *)serviceType, HcStrlen(serviceType) };
|
||||
@@ -75,7 +77,7 @@ TokenManager g_symTokenManagerInstance = {
|
||||
NULL
|
||||
};
|
||||
|
||||
bool IsIsoSupported()
|
||||
bool IsIsoSupported(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -97,7 +99,7 @@ SubTaskBase *CreateIsoSubTask(const CJson *in, CJson *out)
|
||||
}
|
||||
}
|
||||
|
||||
const TokenManager *GetSymTokenManagerInstance()
|
||||
const TokenManager *GetSymTokenManagerInstance(void)
|
||||
{
|
||||
return &g_symTokenManagerInstance;
|
||||
}
|
||||
+1
-1
@@ -28,7 +28,7 @@ enum {
|
||||
TASK_TYPE_FINAL,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_BIND_LITE_EXCHANGE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ enum {
|
||||
TASK_TYPE_FINAL,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_UNBIND_LITE_EXCHANGE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ enum {
|
||||
TASK_TYPE_FINAL,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_BIND_LITE_EXCHANGE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ enum {
|
||||
TASK_TYPE_FINAL,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_UNBIND_LITE_EXCHANGE;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "iso_task_main.h"
|
||||
#include "das_asy_token_manager.h"
|
||||
|
||||
bool IsIsoSupported()
|
||||
bool IsIsoSupported(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ SubTaskBase *CreateIsoSubTask(const CJson *in, CJson *out)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const TokenManager *GetSymTokenManagerInstance()
|
||||
const TokenManager *GetSymTokenManagerInstance(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
+1
-1
@@ -28,7 +28,7 @@ enum {
|
||||
TASK_STATUS_CLIENT_PAKE_VERIFY_CONFIRM,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_PAKE_PROTOCOL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ enum {
|
||||
TASK_STATUS_SERVER_PAKE_CONFIRM
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_PAKE_PROTOCOL;
|
||||
}
|
||||
|
||||
@@ -323,6 +323,7 @@ static int32_t FillPkgNameAndServiceType(PakeParams *params, const CJson *in)
|
||||
|
||||
static int32_t FillNonce(PakeParams *params, const CJson *in)
|
||||
{
|
||||
(void)in;
|
||||
if (params->opCode == AUTHENTICATE || params->opCode == OP_UNBIND) {
|
||||
params->nonce.length = PAKE_NONCE_LEN;
|
||||
params->nonce.val = (uint8_t *)HcMalloc(params->nonce.length, 0);
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ enum {
|
||||
TASK_STATUS_CLIENT_BIND_EXCHANGE_CONFIRM,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_BIND_STANDARD_EXCHANGE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ enum {
|
||||
TASK_STATUS_CLIENT_UNBIND_EXCHANGE_CONFIRM,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_UNBIND_STANDARD_EXCHANGE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ enum {
|
||||
TASK_STATUS_SERVER_BIND_EXCHANGE_RESPONSE,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_BIND_STANDARD_EXCHANGE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ enum {
|
||||
TASK_STATUS_SERVER_UNBIND_EXCHANGE_RESPONSE,
|
||||
};
|
||||
|
||||
static CurTaskType GetTaskType()
|
||||
static CurTaskType GetTaskType(void)
|
||||
{
|
||||
return TASK_TYPE_UNBIND_STANDARD_EXCHANGE;
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ int32_t DeletePeerAuthInfoInTask(const char *pkgName, const char *serviceType, U
|
||||
return res;
|
||||
}
|
||||
|
||||
int32_t InitDasProtocolType()
|
||||
int32_t InitDasProtocolType(void)
|
||||
{
|
||||
g_protocolTypeVec = CREATE_HC_VECTOR(DasProtocolTypeVec)
|
||||
DasProtocolType *protocol = NULL;
|
||||
@@ -522,7 +522,7 @@ int32_t InitDasProtocolType()
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
void DestroyDasProtocolType()
|
||||
void DestroyDasProtocolType(void)
|
||||
{
|
||||
uint32_t index;
|
||||
void **ptr = NULL;
|
||||
|
||||
@@ -284,12 +284,12 @@ void DestroyTask(int taskId, int moduleType)
|
||||
module->destroyTask(taskId);
|
||||
}
|
||||
|
||||
static AuthModuleBase *CreateDasModuleStatic()
|
||||
static AuthModuleBase *CreateDasModuleStatic(void)
|
||||
{
|
||||
return CreateDasModule();
|
||||
}
|
||||
|
||||
static uint32_t InitDasModule()
|
||||
static uint32_t InitDasModule(void)
|
||||
{
|
||||
AuthModuleBase *das = CreateDasModuleStatic();
|
||||
if (das == NULL) {
|
||||
@@ -300,7 +300,7 @@ static uint32_t InitDasModule()
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
static uint32_t InitTcisModule()
|
||||
static uint32_t InitTcisModule(void)
|
||||
{
|
||||
AuthModuleBase *tcis = CreateTcisModule();
|
||||
if (tcis == NULL) {
|
||||
@@ -311,7 +311,7 @@ static uint32_t InitTcisModule()
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t InitModules()
|
||||
int32_t InitModules(void)
|
||||
{
|
||||
g_authModuleVec = CREATE_HC_VECTOR(AuthModuleVec)
|
||||
InitGroupAndModuleVersion(&g_version);
|
||||
@@ -335,7 +335,7 @@ int32_t InitModules()
|
||||
return res;
|
||||
}
|
||||
|
||||
void DestroyModules()
|
||||
void DestroyModules(void)
|
||||
{
|
||||
uint32_t index;
|
||||
void **module = NULL;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "iso_protocol_common.h"
|
||||
#include "hc_log.h"
|
||||
#include "hc_types.h"
|
||||
#include "protocol_common.h"
|
||||
#include "securec.h"
|
||||
|
||||
static int IsoCalSelfToken(const IsoBaseParams *params, Uint8Buff *outHmac)
|
||||
|
||||
@@ -329,6 +329,7 @@ static int32_t VerifyProof(const PakeBaseParams *params)
|
||||
|
||||
int32_t ClientRequestPakeProtocol(const PakeBaseParams *params)
|
||||
{
|
||||
(void)params;
|
||||
return HC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#define BIND_TYPE 0
|
||||
#define AUTH_TYPE 1
|
||||
|
||||
void InitSessionManager();
|
||||
void DestroySessionManager();
|
||||
void InitSessionManager(void);
|
||||
void DestroySessionManager(void);
|
||||
|
||||
bool IsRequestExist(int64_t requestId);
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ static void InformTimeOutAndDestroyRequest(const DeviceAuthCallback *callback, i
|
||||
callback->onError(requestId, AUTH_FORM_INVALID_TYPE, HC_ERR_TIME_OUT, NULL);
|
||||
}
|
||||
|
||||
static void RemoveOverTimeSession()
|
||||
static void RemoveOverTimeSession(void)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
void **session = NULL;
|
||||
|
||||
Reference in New Issue
Block a user