From d4cd9b7280de6c61963bd625eea2ccbc232dd248 Mon Sep 17 00:00:00 2001 From: winnie Date: Wed, 8 Sep 2021 10:28:11 +0800 Subject: [PATCH] add build.gn for L0 Signed-off-by: winnieHu --- BUILD.gn | 26 ++- hals/BUILD.gn | 94 +++++------ hals/inc/common/alg_defs.h | 2 +- hals/inc/common/alg_loader.h | 2 +- hals/inc/common/hc_string.h | 2 +- hals/inc/common/hc_tlv_parser.h | 2 +- hals/inc/common/hc_vector.h | 2 +- hals/inc/common/huks_adapter.h | 2 +- hals/inc/common/json_utils.h | 4 +- hals/inc/dev_info/3516/hc_dev_info.h | 2 +- hals/inc/dev_info/watch/hc_dev_info.h | 2 +- hals/inc/linux/hc_init_protection.h | 8 +- hals/inc/linux/hc_time.h | 2 +- hals/inc/linux/hc_types.h | 2 +- hals/inc/liteos/hc_file.h | 15 +- hals/inc/liteos/hc_init_protection.h | 8 +- hals/inc/liteos/hc_time.h | 2 +- hals/inc/liteos/hc_types.h | 2 +- hals/src/dev_info/3516/hc_dev_info.c | 2 +- hals/src/liteos/L0/hc_file.c | 138 ++++++++++++++++ hals/src/liteos/hc_file.c | 26 +-- hals/src/liteos/hc_mutex.c | 12 +- hals/src/liteos/hc_types.c | 14 +- interfaces/innerkits/device_auth.h | 8 +- services/BUILD.gn | 152 ++++++++++-------- .../inc/broadcast_manager/broadcast_manager.h | 8 +- .../common/inc/data_base/database_manager.h | 20 +-- .../soft_bus_channel_mock.c | 1 + .../common/src/data_base/database_manager.c | 36 ++--- services/device_auth.c | 10 +- services/deviceauth.gni | 94 ++++++++--- .../account_related_group_auth.h | 2 +- .../account_unrelated_group_auth.h | 2 +- .../account_related_group_manager.h | 4 +- .../account_related/across_account_group.h | 4 +- .../account_related/identical_account_group.h | 4 +- .../account_unrelated_group_manager.h | 4 +- .../account_unrelated/peer_to_peer_group.h | 4 +- services/group_manager/inc/group_manager.h | 8 +- services/module/inc/das_module/das_module.h | 4 +- .../das_module/iso_task/iso_base_cur_task.h | 2 +- .../iso_client_protocol_task.h | 2 +- .../iso_server_protocol_task.h | 2 +- .../inc/das_module/iso_task/iso_task_main.h | 4 +- .../pake_task/das_asy_token_manager.h | 2 +- .../new_pake_client_protocol_task.h | 2 +- .../new_pake_server_protocol_task.h | 2 +- .../new_pake_task/new_pake_task_main.h | 2 +- .../das_module/pake_task/pake_base_cur_task.h | 2 +- .../pake_task/pake_client_protocol_task.h | 2 +- .../pake_task/pake_server_protocol_task.h | 2 +- .../pake_task/pake_task/pake_task_main.h | 2 +- .../standard_client_bind_exchange_task.h | 2 +- .../standard_client_unbind_exchange_task.h | 2 +- .../standard_server_bind_exchange_task.h | 2 +- .../standard_server_unbind_exchange_task.h | 2 +- services/module/inc/das_module/task_main.h | 4 +- services/module/inc/dev_auth_module_manager.h | 4 +- .../new_pake_protocol/new_pake_protocol_dl.h | 2 +- .../new_pake_protocol/new_pake_protocol_ec.h | 2 +- .../pake_protocol/pake_protocol_dl.h | 2 +- .../pake_protocol/pake_protocol_ec.h | 2 +- services/module/inc/tcis_module/task_base.h | 2 +- .../tcis_auth_token_manager.h | 8 +- services/module/inc/tcis_module/tcis_module.h | 4 +- services/module/src/das_module/das_common.c | 1 + .../iso_client_protocol_task.c | 5 +- .../iso_server_protocol_task.c | 2 +- .../src/das_module/iso_task/iso_task_common.c | 2 +- .../src/das_module/iso_task/iso_task_main.c | 6 +- .../iso_client_bind_exchange_task.c | 2 +- .../iso_client_unbind_exchange_task.c | 2 +- .../iso_server_bind_exchange_task.c | 2 +- .../iso_server_unbind_exchange_task.c | 2 +- .../iso_task_mock/iso_task_main_mock.c | 4 +- .../pake_client_protocol_task.c | 2 +- .../pake_server_protocol_task.c | 2 +- .../das_module/pake_task/pake_task_common.c | 1 + .../standard_client_bind_exchange_task.c | 2 +- .../standard_client_unbind_exchange_task.c | 2 +- .../standard_server_bind_exchange_task.c | 2 +- .../standard_server_unbind_exchange_task.c | 2 +- services/module/src/das_module/task_main.c | 4 +- services/module/src/dev_auth_module_manager.c | 10 +- .../iso_protocol/iso_protocol_common.c | 1 + .../pake_protocol/pake_protocol_common.c | 1 + services/session/inc/session_manager.h | 4 +- services/session/src/session_manager.c | 2 +- 88 files changed, 540 insertions(+), 323 deletions(-) mode change 100755 => 100644 BUILD.gn mode change 100755 => 100644 hals/BUILD.gn create mode 100644 hals/src/liteos/L0/hc_file.c mode change 100755 => 100644 services/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn old mode 100755 new mode 100644 index 001e0bd..09f76fe --- a/BUILD.gn +++ b/BUILD.gn @@ -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" ] diff --git a/hals/BUILD.gn b/hals/BUILD.gn old mode 100755 new mode 100644 index f654f91..36d8d25 --- a/hals/BUILD.gn +++ b/hals/BUILD.gn @@ -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", diff --git a/hals/inc/common/alg_defs.h b/hals/inc/common/alg_defs.h index bbf7023..6a6be2b 100644 --- a/hals/inc/common/alg_defs.h +++ b/hals/inc/common/alg_defs.h @@ -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); diff --git a/hals/inc/common/alg_loader.h b/hals/inc/common/alg_loader.h index ad46a86..3a8639f 100644 --- a/hals/inc/common/alg_loader.h +++ b/hals/inc/common/alg_loader.h @@ -18,6 +18,6 @@ #include "alg_defs.h" -const AlgLoader *GetLoaderInstance(); +const AlgLoader *GetLoaderInstance(void); #endif \ No newline at end of file diff --git a/hals/inc/common/hc_string.h b/hals/inc/common/hc_string.h index 17598ac..f5fca6f 100644 --- a/hals/inc/common/hc_string.h +++ b/hals/inc/common/hc_string.h @@ -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, diff --git a/hals/inc/common/hc_tlv_parser.h b/hals/inc/common/hc_tlv_parser.h index 0cdec87..6a164fb 100644 --- a/hals/inc/common/hc_tlv_parser.h +++ b/hals/inc/common/hc_tlv_parser.h @@ -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; \ diff --git a/hals/inc/common/hc_vector.h b/hals/inc/common/hc_vector.h index 5e9853a..eb0cce0 100644 --- a/hals/inc/common/hc_vector.h +++ b/hals/inc/common/hc_vector.h @@ -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; \ diff --git a/hals/inc/common/huks_adapter.h b/hals/inc/common/huks_adapter.h index 869afc0..61c3c45 100644 --- a/hals/inc/common/huks_adapter.h +++ b/hals/inc/common/huks_adapter.h @@ -76,6 +76,6 @@ union KeyRoleInfoUnion { uint32_t roleInfo; }; -const AlgLoader *GetRealLoaderInstance(); +const AlgLoader *GetRealLoaderInstance(void); #endif diff --git a/hals/inc/common/json_utils.h b/hals/inc/common/json_utils.h index b58aa79..ef34d68 100644 --- a/hals/inc/common/json_utils.h +++ b/hals/inc/common/json_utils.h @@ -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); diff --git a/hals/inc/dev_info/3516/hc_dev_info.h b/hals/inc/dev_info/3516/hc_dev_info.h index 41ad226..d95a180 100644 --- a/hals/inc/dev_info/3516/hc_dev_info.h +++ b/hals/inc/dev_info/3516/hc_dev_info.h @@ -35,7 +35,7 @@ extern "C" { */ int32_t HcGetUdid(uint8_t *udid, int32_t udidLen); -const char *GetStoragePath(); +const char *GetStoragePath(void); #ifdef __cplusplus } diff --git a/hals/inc/dev_info/watch/hc_dev_info.h b/hals/inc/dev_info/watch/hc_dev_info.h index ebe073e..9eb8674 100644 --- a/hals/inc/dev_info/watch/hc_dev_info.h +++ b/hals/inc/dev_info/watch/hc_dev_info.h @@ -31,6 +31,6 @@ */ int32_t HcGetUdid(uint8_t *udid, int32_t udidLen); -const char *GetStoragePath(); +const char *GetStoragePath(void); #endif \ No newline at end of file diff --git a/hals/inc/linux/hc_init_protection.h b/hals/inc/linux/hc_init_protection.h index 60d481f..56252fb 100644 --- a/hals/inc/linux/hc_init_protection.h +++ b/hals/inc/linux/hc_init_protection.h @@ -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 \ No newline at end of file diff --git a/hals/inc/linux/hc_time.h b/hals/inc/linux/hc_time.h index adb0aa6..7cf0b89 100644 --- a/hals/inc/linux/hc_time.h +++ b/hals/inc/linux/hc_time.h @@ -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); diff --git a/hals/inc/linux/hc_types.h b/hals/inc/linux/hc_types.h index b73be19..643616e 100644 --- a/hals/inc/linux/hc_types.h +++ b/hals/inc/linux/hc_types.h @@ -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 diff --git a/hals/inc/liteos/hc_file.h b/hals/inc/liteos/hc_file.h index b982eaa..e16a96d 100644 --- a/hals/inc/liteos/hc_file.h +++ b/hals/inc/liteos/hc_file.h @@ -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); diff --git a/hals/inc/liteos/hc_init_protection.h b/hals/inc/liteos/hc_init_protection.h index 60d481f..56252fb 100644 --- a/hals/inc/liteos/hc_init_protection.h +++ b/hals/inc/liteos/hc_init_protection.h @@ -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 \ No newline at end of file diff --git a/hals/inc/liteos/hc_time.h b/hals/inc/liteos/hc_time.h index 5acc2e1..d3878d7 100644 --- a/hals/inc/liteos/hc_time.h +++ b/hals/inc/liteos/hc_time.h @@ -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); diff --git a/hals/inc/liteos/hc_types.h b/hals/inc/liteos/hc_types.h index 8c7b46d..c9d81e1 100644 --- a/hals/inc/liteos/hc_types.h +++ b/hals/inc/liteos/hc_types.h @@ -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 diff --git a/hals/src/dev_info/3516/hc_dev_info.c b/hals/src/dev_info/3516/hc_dev_info.c index abffb72..9077262 100644 --- a/hals/src/dev_info/3516/hc_dev_info.c +++ b/hals/src/dev_info/3516/hc_dev_info.c @@ -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) { diff --git a/hals/src/liteos/L0/hc_file.c b/hals/src/liteos/L0/hc_file.c new file mode 100644 index 0000000..4b91782 --- /dev/null +++ b/hals/src/liteos/L0/hc_file.c @@ -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 +#include +#include +#include +#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); +} diff --git a/hals/src/liteos/hc_file.c b/hals/src/liteos/hc_file.c index 17d31f6..311aab0 100644 --- a/hals/src/liteos/hc_file.c +++ b/hals/src/liteos/hc_file.c @@ -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; } diff --git a/hals/src/liteos/hc_mutex.c b/hals/src/liteos/hc_mutex.c index 9e91f41..5b76967 100644 --- a/hals/src/liteos/hc_mutex.c +++ b/hals/src/liteos/hc_mutex.c @@ -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; diff --git a/hals/src/liteos/hc_types.c b/hals/src/liteos/hc_types.c index a70c8b0..b54ef2b 100644 --- a/hals/src/liteos/hc_types.c +++ b/hals/src/liteos/hc_types.c @@ -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 } } diff --git a/interfaces/innerkits/device_auth.h b/interfaces/innerkits/device_auth.h index c1432db..e7b1186 100644 --- a/interfaces/innerkits/device_auth.h +++ b/interfaces/innerkits/device_auth.h @@ -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 diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100755 new mode 100644 index 79ba0a6..d6bd355 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -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") { diff --git a/services/common/inc/broadcast_manager/broadcast_manager.h b/services/common/inc/broadcast_manager/broadcast_manager.h index ab3ea1e..402a9eb 100644 --- a/services/common/inc/broadcast_manager/broadcast_manager.h +++ b/services/common/inc/broadcast_manager/broadcast_manager.h @@ -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); diff --git a/services/common/inc/data_base/database_manager.h b/services/common/inc/data_base/database_manager.h index 610947b..30c9bcd 100644 --- a/services/common/inc/data_base/database_manager.h +++ b/services/common/inc/data_base/database_manager.h @@ -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); diff --git a/services/common/src/channel_manager/soft_bus_channel_mock/soft_bus_channel_mock.c b/services/common/src/channel_manager/soft_bus_channel_mock/soft_bus_channel_mock.c index b7135d4..8a928ec 100644 --- a/services/common/src/channel_manager/soft_bus_channel_mock/soft_bus_channel_mock.c +++ b/services/common/src/channel_manager/soft_bus_channel_mock/soft_bus_channel_mock.c @@ -15,6 +15,7 @@ #include "soft_bus_channel.h" +#include #include "device_auth_defines.h" int32_t InitSoftBusChannelModule(void) diff --git a/services/common/src/data_base/database_manager.c b/services/common/src/data_base/database_manager.c index b5cae43..6afe52d 100644 --- a/services/common/src/data_base/database_manager.c +++ b/services/common/src/data_base/database_manager.c @@ -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; } \ No newline at end of file diff --git a/services/device_auth.c b/services/device_auth.c index 3f7c2d9..20db2dc 100644 --- a/services/device_auth.c +++ b/services/device_auth.c @@ -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) { diff --git a/services/deviceauth.gni b/services/deviceauth.gni index 8e23a3e..ade6339 100644 --- a/services/deviceauth.gni +++ b/services/deviceauth.gni @@ -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") { diff --git a/services/group_auth/inc/account_related_group_auth/account_related_group_auth.h b/services/group_auth/inc/account_related_group_auth/account_related_group_auth.h index e863daa..a46aa7e 100644 --- a/services/group_auth/inc/account_related_group_auth/account_related_group_auth.h +++ b/services/group_auth/inc/account_related_group_auth/account_related_group_auth.h @@ -29,6 +29,6 @@ typedef struct { GetTcisCandidateGroupFunc getTcisCandidateGroup; } AccountRelatedGroupAuth; -BaseGroupAuth *GetAccountRelatedGroupAuth(); +BaseGroupAuth *GetAccountRelatedGroupAuth(void); #endif diff --git a/services/group_auth/inc/account_unrelated_group_auth/account_unrelated_group_auth.h b/services/group_auth/inc/account_unrelated_group_auth/account_unrelated_group_auth.h index 5ccc0c2..78feaf8 100644 --- a/services/group_auth/inc/account_unrelated_group_auth/account_unrelated_group_auth.h +++ b/services/group_auth/inc/account_unrelated_group_auth/account_unrelated_group_auth.h @@ -26,6 +26,6 @@ typedef struct { OnDasErrorFunc onDasError; } NonAccountGroupAuth; -BaseGroupAuth *GetNonAccountGroupAuth(); +BaseGroupAuth *GetNonAccountGroupAuth(void); #endif diff --git a/services/group_manager/inc/account_related/account_related_group_manager.h b/services/group_manager/inc/account_related/account_related_group_manager.h index f36547a..97be60e 100644 --- a/services/group_manager/inc/account_related/account_related_group_manager.h +++ b/services/group_manager/inc/account_related/account_related_group_manager.h @@ -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 diff --git a/services/group_manager/inc/account_related/across_account_group.h b/services/group_manager/inc/account_related/across_account_group.h index d0781a0..f42afde 100644 --- a/services/group_manager/inc/account_related/across_account_group.h +++ b/services/group_manager/inc/account_related/across_account_group.h @@ -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 diff --git a/services/group_manager/inc/account_related/identical_account_group.h b/services/group_manager/inc/account_related/identical_account_group.h index 370293b..101b0b4 100644 --- a/services/group_manager/inc/account_related/identical_account_group.h +++ b/services/group_manager/inc/account_related/identical_account_group.h @@ -24,7 +24,7 @@ typedef struct { int32_t (*syncDeleteGroup)(const CJson *jsonParams); } IdenticalAccountGroup; -bool IsIdenticalAccountGroupSupported(); -BaseGroup *GetIdenticalAccountGroupInstance(); +bool IsIdenticalAccountGroupSupported(void); +BaseGroup *GetIdenticalAccountGroupInstance(void); #endif diff --git a/services/group_manager/inc/account_unrelated/account_unrelated_group_manager.h b/services/group_manager/inc/account_unrelated/account_unrelated_group_manager.h index 686ad08..2df3138 100644 --- a/services/group_manager/inc/account_unrelated/account_unrelated_group_manager.h +++ b/services/group_manager/inc/account_unrelated/account_unrelated_group_manager.h @@ -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 diff --git a/services/group_manager/inc/account_unrelated/peer_to_peer_group.h b/services/group_manager/inc/account_unrelated/peer_to_peer_group.h index 8a81ca8..b171f4a 100644 --- a/services/group_manager/inc/account_unrelated/peer_to_peer_group.h +++ b/services/group_manager/inc/account_unrelated/peer_to_peer_group.h @@ -31,7 +31,7 @@ typedef struct { uint32_t *returnSize); } PeerToPeerGroup; -BaseGroup *GetPeerToPeerGroupInstance(); -bool IsPeerToPeerGroupSupported(); +BaseGroup *GetPeerToPeerGroupInstance(void); +bool IsPeerToPeerGroupSupported(void); #endif diff --git a/services/group_manager/inc/group_manager.h b/services/group_manager/inc/group_manager.h index 798d456..378022c 100644 --- a/services/group_manager/inc/group_manager.h +++ b/services/group_manager/inc/group_manager.h @@ -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 diff --git a/services/module/inc/das_module/das_module.h b/services/module/inc/das_module/das_module.h index ca3f237..89236ea 100644 --- a/services/module/inc/das_module/das_module.h +++ b/services/module/inc/das_module/das_module.h @@ -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 diff --git a/services/module/inc/das_module/iso_task/iso_base_cur_task.h b/services/module/inc/das_module/iso_task/iso_base_cur_task.h index faf871e..f6cf0b1 100644 --- a/services/module/inc/das_module/iso_task/iso_base_cur_task.h +++ b/services/module/inc/das_module/iso_task/iso_base_cur_task.h @@ -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; diff --git a/services/module/inc/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.h b/services/module/inc/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.h index ba6c61c..d7a264a 100644 --- a/services/module/inc/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.h +++ b/services/module/inc/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.h @@ -22,6 +22,6 @@ typedef struct { SymBaseCurTask taskBase; } IsoProtocolClientTask; -SymBaseCurTask *CreateProtocolClientTask(); +SymBaseCurTask *CreateProtocolClientTask(void); #endif diff --git a/services/module/inc/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.h b/services/module/inc/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.h index 040d983..9c8f38a 100644 --- a/services/module/inc/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.h +++ b/services/module/inc/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.h @@ -22,6 +22,6 @@ typedef struct { SymBaseCurTask taskBase; } IsoProtocolServerTask; -SymBaseCurTask *CreateProtocolServerTask(); +SymBaseCurTask *CreateProtocolServerTask(void); #endif diff --git a/services/module/inc/das_module/iso_task/iso_task_main.h b/services/module/inc/das_module/iso_task/iso_task_main.h index 419fcc8..ab6ff24 100644 --- a/services/module/inc/das_module/iso_task/iso_task_main.h +++ b/services/module/inc/das_module/iso_task/iso_task_main.h @@ -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 diff --git a/services/module/inc/das_module/pake_task/das_asy_token_manager.h b/services/module/inc/das_module/pake_task/das_asy_token_manager.h index 1e7b180..6654620 100644 --- a/services/module/inc/das_module/pake_task/das_asy_token_manager.h +++ b/services/module/inc/das_module/pake_task/das_asy_token_manager.h @@ -26,6 +26,6 @@ typedef struct TokenManagerT { int (*computeAndSavePsk)(const PakeParams *params); } TokenManager; -const TokenManager *GetAsyTokenManagerInstance(); +const TokenManager *GetAsyTokenManagerInstance(void); #endif diff --git a/services/module/inc/das_module/pake_task/new_pake_task/new_pake_client_protocol_task.h b/services/module/inc/das_module/pake_task/new_pake_task/new_pake_client_protocol_task.h index 37d837f..0d2a69d 100644 --- a/services/module/inc/das_module/pake_task/new_pake_task/new_pake_client_protocol_task.h +++ b/services/module/inc/das_module/pake_task/new_pake_task/new_pake_client_protocol_task.h @@ -22,6 +22,6 @@ typedef struct { AsyBaseCurTask taskBase; } NewPakeProtocolClientTask; -AsyBaseCurTask *CreateNewPakeProtocolClientTask(); +AsyBaseCurTask *CreateNewPakeProtocolClientTask(void); #endif diff --git a/services/module/inc/das_module/pake_task/new_pake_task/new_pake_server_protocol_task.h b/services/module/inc/das_module/pake_task/new_pake_task/new_pake_server_protocol_task.h index ab4f34c..f71047a 100644 --- a/services/module/inc/das_module/pake_task/new_pake_task/new_pake_server_protocol_task.h +++ b/services/module/inc/das_module/pake_task/new_pake_task/new_pake_server_protocol_task.h @@ -22,6 +22,6 @@ typedef struct { AsyBaseCurTask taskBase; } NewPakeProtocolServerTask; -AsyBaseCurTask *CreateNewPakeProtocolServerTask(); +AsyBaseCurTask *CreateNewPakeProtocolServerTask(void); #endif diff --git a/services/module/inc/das_module/pake_task/new_pake_task/new_pake_task_main.h b/services/module/inc/das_module/pake_task/new_pake_task/new_pake_task_main.h index 2b552d3..35bb208 100644 --- a/services/module/inc/das_module/pake_task/new_pake_task/new_pake_task_main.h +++ b/services/module/inc/das_module/pake_task/new_pake_task/new_pake_task_main.h @@ -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 diff --git a/services/module/inc/das_module/pake_task/pake_base_cur_task.h b/services/module/inc/das_module/pake_task/pake_base_cur_task.h index 7d40617..8449728 100644 --- a/services/module/inc/das_module/pake_task/pake_base_cur_task.h +++ b/services/module/inc/das_module/pake_task/pake_base_cur_task.h @@ -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; diff --git a/services/module/inc/das_module/pake_task/pake_task/pake_client_protocol_task.h b/services/module/inc/das_module/pake_task/pake_task/pake_client_protocol_task.h index 3206867..514f096 100644 --- a/services/module/inc/das_module/pake_task/pake_task/pake_client_protocol_task.h +++ b/services/module/inc/das_module/pake_task/pake_task/pake_client_protocol_task.h @@ -22,6 +22,6 @@ typedef struct { AsyBaseCurTask taskBase; } PakeProtocolClientTask; -AsyBaseCurTask *CreatePakeProtocolClientTask(); +AsyBaseCurTask *CreatePakeProtocolClientTask(void); #endif diff --git a/services/module/inc/das_module/pake_task/pake_task/pake_server_protocol_task.h b/services/module/inc/das_module/pake_task/pake_task/pake_server_protocol_task.h index 14ce742..8d57caa 100644 --- a/services/module/inc/das_module/pake_task/pake_task/pake_server_protocol_task.h +++ b/services/module/inc/das_module/pake_task/pake_task/pake_server_protocol_task.h @@ -22,6 +22,6 @@ typedef struct { AsyBaseCurTask taskBase; } PakeProtocolServerTask; -AsyBaseCurTask *CreatePakeProtocolServerTask(); +AsyBaseCurTask *CreatePakeProtocolServerTask(void); #endif diff --git a/services/module/inc/das_module/pake_task/pake_task/pake_task_main.h b/services/module/inc/das_module/pake_task/pake_task/pake_task_main.h index 73b4174..1187e89 100644 --- a/services/module/inc/das_module/pake_task/pake_task/pake_task_main.h +++ b/services/module/inc/das_module/pake_task/pake_task/pake_task_main.h @@ -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 diff --git a/services/module/inc/das_module/pake_task/standard_client_bind_exchange_task.h b/services/module/inc/das_module/pake_task/standard_client_bind_exchange_task.h index d427474..e016ef4 100644 --- a/services/module/inc/das_module/pake_task/standard_client_bind_exchange_task.h +++ b/services/module/inc/das_module/pake_task/standard_client_bind_exchange_task.h @@ -24,6 +24,6 @@ typedef struct { StandardBindExchangeParams params; } StandardBindExchangeClientTask; -AsyBaseCurTask *CreateStandardBindExchangeClientTask(); +AsyBaseCurTask *CreateStandardBindExchangeClientTask(void); #endif diff --git a/services/module/inc/das_module/pake_task/standard_client_unbind_exchange_task.h b/services/module/inc/das_module/pake_task/standard_client_unbind_exchange_task.h index 85a84a8..4a25a5a 100644 --- a/services/module/inc/das_module/pake_task/standard_client_unbind_exchange_task.h +++ b/services/module/inc/das_module/pake_task/standard_client_unbind_exchange_task.h @@ -24,6 +24,6 @@ typedef struct { StandardUnbindExchangeParams params; } StandardUnbindExchangeClientTask; -AsyBaseCurTask *CreateStandardUnbindExchangeClientTask(); +AsyBaseCurTask *CreateStandardUnbindExchangeClientTask(void); #endif diff --git a/services/module/inc/das_module/pake_task/standard_server_bind_exchange_task.h b/services/module/inc/das_module/pake_task/standard_server_bind_exchange_task.h index bdd5a9e..176eb31 100644 --- a/services/module/inc/das_module/pake_task/standard_server_bind_exchange_task.h +++ b/services/module/inc/das_module/pake_task/standard_server_bind_exchange_task.h @@ -24,6 +24,6 @@ typedef struct { StandardBindExchangeParams params; } StandardBindExchangeServerTask; -AsyBaseCurTask *CreateStandardBindExchangeServerTask(); +AsyBaseCurTask *CreateStandardBindExchangeServerTask(void); #endif diff --git a/services/module/inc/das_module/pake_task/standard_server_unbind_exchange_task.h b/services/module/inc/das_module/pake_task/standard_server_unbind_exchange_task.h index 01d2787..0d87805 100644 --- a/services/module/inc/das_module/pake_task/standard_server_unbind_exchange_task.h +++ b/services/module/inc/das_module/pake_task/standard_server_unbind_exchange_task.h @@ -24,6 +24,6 @@ typedef struct { StandardUnbindExchangeParams params; } StandardUnbindExchangeServerTask; -AsyBaseCurTask *CreateStandardUnbindExchangeServerTask(); +AsyBaseCurTask *CreateStandardUnbindExchangeServerTask(void); #endif diff --git a/services/module/inc/das_module/task_main.h b/services/module/inc/das_module/task_main.h index e25a627..44614f1 100644 --- a/services/module/inc/das_module/task_main.h +++ b/services/module/inc/das_module/task_main.h @@ -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); diff --git a/services/module/inc/dev_auth_module_manager.h b/services/module/inc/dev_auth_module_manager.h index a566ac2..1c5782e 100644 --- a/services/module/inc/dev_auth_module_manager.h +++ b/services/module/inc/dev_auth_module_manager.h @@ -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); diff --git a/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_dl.h b/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_dl.h index ff7c1a5..c7918fd 100644 --- a/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_dl.h +++ b/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_dl.h @@ -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); diff --git a/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_ec.h b/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_ec.h index fc90c1a..6ab7d2d 100644 --- a/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_ec.h +++ b/services/module/inc/protocol/pake_protocol/new_pake_protocol/new_pake_protocol_ec.h @@ -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); diff --git a/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_dl.h b/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_dl.h index ebe8d4d..474661b 100644 --- a/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_dl.h +++ b/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_dl.h @@ -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); diff --git a/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_ec.h b/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_ec.h index d086485..2b2410d 100644 --- a/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_ec.h +++ b/services/module/inc/protocol/pake_protocol/pake_protocol/pake_protocol_ec.h @@ -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); diff --git a/services/module/inc/tcis_module/task_base.h b/services/module/inc/tcis_module/task_base.h index e5f1842..a358783 100644 --- a/services/module/inc/tcis_module/task_base.h +++ b/services/module/inc/tcis_module/task_base.h @@ -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; diff --git a/services/module/inc/tcis_module/tcis_auth_token_manager/tcis_auth_token_manager.h b/services/module/inc/tcis_module/tcis_auth_token_manager/tcis_auth_token_manager.h index 41948c3..3331c8a 100644 --- a/services/module/inc/tcis_module/tcis_auth_token_manager/tcis_auth_token_manager.h +++ b/services/module/inc/tcis_module/tcis_auth_token_manager/tcis_auth_token_manager.h @@ -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 diff --git a/services/module/inc/tcis_module/tcis_module.h b/services/module/inc/tcis_module/tcis_module.h index 6616db4..2ad2592 100644 --- a/services/module/inc/tcis_module/tcis_module.h +++ b/services/module/inc/tcis_module/tcis_module.h @@ -50,8 +50,8 @@ typedef struct { AlgLoader *algLoader; } TcisAuthModule; -AuthModuleBase *CreateTcisModule(); +AuthModuleBase *CreateTcisModule(void); -bool IsTcisSupported(); +bool IsTcisSupported(void); #endif diff --git a/services/module/src/das_module/das_common.c b/services/module/src/das_module/das_common.c index 494ae4b..48241bb 100644 --- a/services/module/src/das_module/das_common.c +++ b/services/module/src/das_module/das_common.c @@ -75,6 +75,7 @@ err: void SendErrMsgToSelf(const CJson *in, CJson *out, int errCode) { + (void)in; CJson *sendToSelf = CreateJson(); if (sendToSelf == NULL) { return; diff --git a/services/module/src/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.c b/services/module/src/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.c index 11207df..3eb4804 100644 --- a/services/module/src/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.c +++ b/services/module/src/das_module/iso_task/iso_protocol_task/iso_client_protocol_task.c @@ -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) { diff --git a/services/module/src/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.c b/services/module/src/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.c index ec95366..a7adbfd 100644 --- a/services/module/src/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.c +++ b/services/module/src/das_module/iso_task/iso_protocol_task/iso_server_protocol_task.c @@ -29,7 +29,7 @@ enum { TASK_STATUS_FINAL, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_ISO_PROTOCOL; } diff --git a/services/module/src/das_module/iso_task/iso_task_common.c b/services/module/src/das_module/iso_task/iso_task_common.c index 5241221..7720d5d 100644 --- a/services/module/src/das_module/iso_task/iso_task_common.c +++ b/services/module/src/das_module/iso_task/iso_task_common.c @@ -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"); diff --git a/services/module/src/das_module/iso_task/iso_task_main.c b/services/module/src/das_module/iso_task/iso_task_main.c index 4598d99..2c475c9 100644 --- a/services/module/src/das_module/iso_task/iso_task_main.c +++ b/services/module/src/das_module/iso_task/iso_task_main.c @@ -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; } \ No newline at end of file diff --git a/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c b/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c index 79b2656..aa8aeee 100644 --- a/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c +++ b/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c @@ -28,7 +28,7 @@ enum { TASK_TYPE_FINAL, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_BIND_LITE_EXCHANGE; } diff --git a/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c b/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c index 87217bb..2f243a0 100644 --- a/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c +++ b/services/module/src/das_module/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c @@ -24,7 +24,7 @@ enum { TASK_TYPE_FINAL, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_UNBIND_LITE_EXCHANGE; } diff --git a/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c b/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c index da8410b..8008628 100644 --- a/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c +++ b/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c @@ -27,7 +27,7 @@ enum { TASK_TYPE_FINAL, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_BIND_LITE_EXCHANGE; } diff --git a/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c b/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c index 6053e1b..01e527c 100644 --- a/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c +++ b/services/module/src/das_module/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c @@ -25,7 +25,7 @@ enum { TASK_TYPE_FINAL, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_UNBIND_LITE_EXCHANGE; } diff --git a/services/module/src/das_module/iso_task_mock/iso_task_main_mock.c b/services/module/src/das_module/iso_task_mock/iso_task_main_mock.c index 79badc5..f078699 100644 --- a/services/module/src/das_module/iso_task_mock/iso_task_main_mock.c +++ b/services/module/src/das_module/iso_task_mock/iso_task_main_mock.c @@ -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; } \ No newline at end of file diff --git a/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_client_protocol_task.c b/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_client_protocol_task.c index fbd27fb..a45230e 100644 --- a/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_client_protocol_task.c +++ b/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_client_protocol_task.c @@ -28,7 +28,7 @@ enum { TASK_STATUS_CLIENT_PAKE_VERIFY_CONFIRM, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_PAKE_PROTOCOL; } diff --git a/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_server_protocol_task.c b/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_server_protocol_task.c index 6f3c036..2408437 100644 --- a/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_server_protocol_task.c +++ b/services/module/src/das_module/pake_task/pake_task/pake_protocol_task/pake_server_protocol_task.c @@ -27,7 +27,7 @@ enum { TASK_STATUS_SERVER_PAKE_CONFIRM }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_PAKE_PROTOCOL; } diff --git a/services/module/src/das_module/pake_task/pake_task_common.c b/services/module/src/das_module/pake_task/pake_task_common.c index a486e78..73b0969 100644 --- a/services/module/src/das_module/pake_task/pake_task_common.c +++ b/services/module/src/das_module/pake_task/pake_task_common.c @@ -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); diff --git a/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_bind_exchange_task.c b/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_bind_exchange_task.c index ff481eb..67e88aa 100644 --- a/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_bind_exchange_task.c +++ b/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_bind_exchange_task.c @@ -26,7 +26,7 @@ enum { TASK_STATUS_CLIENT_BIND_EXCHANGE_CONFIRM, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_BIND_STANDARD_EXCHANGE; } diff --git a/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_unbind_exchange_task.c b/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_unbind_exchange_task.c index 65d4d60..f472e0a 100644 --- a/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_unbind_exchange_task.c +++ b/services/module/src/das_module/pake_task/standard_exchange_task/standard_client_unbind_exchange_task.c @@ -24,7 +24,7 @@ enum { TASK_STATUS_CLIENT_UNBIND_EXCHANGE_CONFIRM, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_UNBIND_STANDARD_EXCHANGE; } diff --git a/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_bind_exchange_task.c b/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_bind_exchange_task.c index 1561c64..8943ed0 100644 --- a/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_bind_exchange_task.c +++ b/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_bind_exchange_task.c @@ -24,7 +24,7 @@ enum { TASK_STATUS_SERVER_BIND_EXCHANGE_RESPONSE, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_BIND_STANDARD_EXCHANGE; } diff --git a/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_unbind_exchange_task.c b/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_unbind_exchange_task.c index 10f79dd..f68ae0c 100644 --- a/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_unbind_exchange_task.c +++ b/services/module/src/das_module/pake_task/standard_exchange_task/standard_server_unbind_exchange_task.c @@ -24,7 +24,7 @@ enum { TASK_STATUS_SERVER_UNBIND_EXCHANGE_RESPONSE, }; -static CurTaskType GetTaskType() +static CurTaskType GetTaskType(void) { return TASK_TYPE_UNBIND_STANDARD_EXCHANGE; } diff --git a/services/module/src/das_module/task_main.c b/services/module/src/das_module/task_main.c index 80c19d5..bf38d3d 100644 --- a/services/module/src/das_module/task_main.c +++ b/services/module/src/das_module/task_main.c @@ -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; diff --git a/services/module/src/dev_auth_module_manager.c b/services/module/src/dev_auth_module_manager.c index f5f8d85..df366e8 100644 --- a/services/module/src/dev_auth_module_manager.c +++ b/services/module/src/dev_auth_module_manager.c @@ -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; diff --git a/services/module/src/protocol/iso_protocol/iso_protocol_common.c b/services/module/src/protocol/iso_protocol/iso_protocol_common.c index 87c6bd7..1d1ed61 100644 --- a/services/module/src/protocol/iso_protocol/iso_protocol_common.c +++ b/services/module/src/protocol/iso_protocol/iso_protocol_common.c @@ -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) diff --git a/services/module/src/protocol/pake_protocol/pake_protocol_common.c b/services/module/src/protocol/pake_protocol/pake_protocol_common.c index fdaec15..bf1d36b 100644 --- a/services/module/src/protocol/pake_protocol/pake_protocol_common.c +++ b/services/module/src/protocol/pake_protocol/pake_protocol_common.c @@ -329,6 +329,7 @@ static int32_t VerifyProof(const PakeBaseParams *params) int32_t ClientRequestPakeProtocol(const PakeBaseParams *params) { + (void)params; return HC_SUCCESS; } diff --git a/services/session/inc/session_manager.h b/services/session/inc/session_manager.h index b8b5369..ae79ab9 100644 --- a/services/session/inc/session_manager.h +++ b/services/session/inc/session_manager.h @@ -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); diff --git a/services/session/src/session_manager.c b/services/session/src/session_manager.c index e8e5eda..f29e9fc 100644 --- a/services/session/src/session_manager.c +++ b/services/session/src/session_manager.c @@ -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;