diff --git a/common_lib/impl/src/json_utils.c b/common_lib/impl/src/json_utils.c index e8d1ac2..7fa0d94 100644 --- a/common_lib/impl/src/json_utils.c +++ b/common_lib/impl/src/json_utils.c @@ -19,7 +19,7 @@ #include #include "clib_error.h" #include "clib_types.h" -#include "common_util.h" +#include "string_util.h" #define RECURSE_FLAG_TRUE 1 diff --git a/common_lib/impl/src/common_util.c b/common_lib/impl/src/string_util.c similarity index 96% rename from common_lib/impl/src/common_util.c rename to common_lib/impl/src/string_util.c index 04eef58..cc6a8ac 100644 --- a/common_lib/impl/src/common_util.c +++ b/common_lib/impl/src/string_util.c @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "common_util.h" +#include "string_util.h" #include #include #include diff --git a/common_lib/interfaces/common_util.h b/common_lib/interfaces/string_util.h similarity index 94% rename from common_lib/interfaces/common_util.h rename to common_lib/interfaces/string_util.h index 5f49ddc..c8dae74 100644 --- a/common_lib/interfaces/common_util.h +++ b/common_lib/interfaces/string_util.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef COMMON_UTIL_H -#define COMMON_UTIL_H +#ifndef STRING_UTIL_H +#define STRING_UTIL_H #include diff --git a/deps_adapter/BUILD.gn b/deps_adapter/BUILD.gn index 63961dc..9c296dd 100644 --- a/deps_adapter/BUILD.gn +++ b/deps_adapter/BUILD.gn @@ -34,11 +34,9 @@ if (defined(ohos_lite)) { sources = hal_common_files sources += [ "${key_management_adapter_path}/impl/src/mini/huks_adapter.c", - "${os_adapter_path}/impl/src/dev_info/3861/hc_dev_info.c", "${os_adapter_path}/impl/src/liteos/hc_condition.c", - "${os_adapter_path}/impl/src/liteos/hc_mutex.c", + "${os_adapter_path}/impl/src/liteos/hc_dev_info.c", "${os_adapter_path}/impl/src/liteos/hc_thread.c", - "${os_adapter_path}/impl/src/liteos/hc_time.c", "${os_adapter_path}/impl/src/liteos/hc_types.c", "${os_adapter_path}/impl/src/liteos/mini/hc_file.c", "${os_adapter_path}/impl/src/liteos/mini/hc_init_protection.c", @@ -70,13 +68,11 @@ if (defined(ohos_lite)) { sources += [ "${key_management_adapter_path}/impl/src/small/huks_adapter.c", "${key_management_adapter_path}/impl/src/small/mbedtls_hash_to_point.c", - "${os_adapter_path}/impl/src/dev_info/3516/hc_dev_info.c", "${os_adapter_path}/impl/src/linux/hc_condition.c", + "${os_adapter_path}/impl/src/linux/hc_dev_info.c", "${os_adapter_path}/impl/src/linux/hc_file.c", "${os_adapter_path}/impl/src/linux/hc_init_protection.c", - "${os_adapter_path}/impl/src/linux/hc_mutex.c", "${os_adapter_path}/impl/src/linux/hc_thread.c", - "${os_adapter_path}/impl/src/linux/hc_time.c", "${os_adapter_path}/impl/src/linux/hc_types.c", ] @@ -111,13 +107,11 @@ if (defined(ohos_lite)) { sources += [ "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c", "${key_management_adapter_path}/impl/src/standard/huks_adapter.c", - "${os_adapter_path}/impl/src/dev_info/3516/hc_dev_info.c", "${os_adapter_path}/impl/src/linux/hc_condition.c", + "${os_adapter_path}/impl/src/linux/hc_dev_info.c", "${os_adapter_path}/impl/src/linux/hc_file.c", "${os_adapter_path}/impl/src/linux/hc_init_protection.c", - "${os_adapter_path}/impl/src/linux/hc_mutex.c", "${os_adapter_path}/impl/src/linux/hc_thread.c", - "${os_adapter_path}/impl/src/linux/hc_time.c", "${os_adapter_path}/impl/src/linux/hc_types.c", ] cflags = [ "-DHILOG_ENABLE" ] diff --git a/deps_adapter/deviceauth_hals.gni b/deps_adapter/deviceauth_hals.gni index 5f17bb5..0c10e18 100644 --- a/deps_adapter/deviceauth_hals.gni +++ b/deps_adapter/deviceauth_hals.gni @@ -21,7 +21,6 @@ if (target_os == "liteos" || "${key_management_adapter_path}/impl/inc", "${os_adapter_path}/interfaces", "${os_adapter_path}/interfaces/liteos", - "${os_adapter_path}/interfaces/dev_info/3861", ] hal_module_name = "deviceauth_hal_liteos" } else { @@ -31,7 +30,6 @@ if (target_os == "liteos" || "${key_management_adapter_path}/impl/inc", "${os_adapter_path}/interfaces", "${os_adapter_path}/interfaces/linux", - "${os_adapter_path}/interfaces/dev_info/3516", ] hal_module_name = "deviceauth_hal_linux" } @@ -42,9 +40,11 @@ hal_common_files = [ "${common_lib_path}/impl/src/hc_string.c", "${common_lib_path}/impl/src/hc_tlv_parser.c", "${common_lib_path}/impl/src/json_utils.c", - "${common_lib_path}/impl/src/common_util.c", + "${common_lib_path}/impl/src/string_util.c", "${key_management_adapter_path}/impl/src/alg_loader.c", - "${os_adapter_path}/impl/src/hc_task_thread.c", "${os_adapter_path}/impl/src/hc_log.c", + "${os_adapter_path}/impl/src/hc_mutex.c", + "${os_adapter_path}/impl/src/hc_task_thread.c", + "${os_adapter_path}/impl/src/hc_time.c", ] diff --git a/deps_adapter/key_management_adapter/impl/inc/mbedtls_hash_to_point.h b/deps_adapter/key_management_adapter/impl/inc/mbedtls_hash_to_point.h index 29c6e99..574eaf6 100644 --- a/deps_adapter/key_management_adapter/impl/inc/mbedtls_hash_to_point.h +++ b/deps_adapter/key_management_adapter/impl/inc/mbedtls_hash_to_point.h @@ -17,7 +17,7 @@ #define MBEDTLS_HASH_TO_POINT_H #include -#include "common_util.h" +#include "string_util.h" #define HASH2POINT_PARA_PREPRO 0xc0 #define BYTE_LENGTH_CURVE_25519 32 diff --git a/deps_adapter/key_management_adapter/impl/src/mini/huks_adapter.c b/deps_adapter/key_management_adapter/impl/src/mini/huks_adapter.c index f7abe6b..a6c1293 100644 --- a/deps_adapter/key_management_adapter/impl/src/mini/huks_adapter.c +++ b/deps_adapter/key_management_adapter/impl/src/mini/huks_adapter.c @@ -14,13 +14,13 @@ */ #include "huks_adapter.h" -#include "common_util.h" #include "hal_error.h" #include "hc_file.h" #include "hc_log.h" #include "hks_api.h" #include "hks_param.h" #include "hks_type.h" +#include "string_util.h" static int32_t BaseCheckParams(const Uint8Buff **inParams, const char **paramTags, uint32_t len) { diff --git a/deps_adapter/key_management_adapter/impl/src/small/huks_adapter.c b/deps_adapter/key_management_adapter/impl/src/small/huks_adapter.c index b6fa040..e841932 100644 --- a/deps_adapter/key_management_adapter/impl/src/small/huks_adapter.c +++ b/deps_adapter/key_management_adapter/impl/src/small/huks_adapter.c @@ -14,12 +14,12 @@ */ #include "huks_adapter.h" -#include "common_util.h" #include "hc_log.h" #include "hks_api.h" #include "hks_param.h" #include "hks_type.h" #include "mbedtls_hash_to_point.h" +#include "string_util.h" static enum HksKeyAlg g_algToHksAlgorithm[] = { HKS_ALG_ED25519, diff --git a/deps_adapter/key_management_adapter/impl/src/standard/huks_adapter.c b/deps_adapter/key_management_adapter/impl/src/standard/huks_adapter.c index fbc7075..02c8a99 100644 --- a/deps_adapter/key_management_adapter/impl/src/standard/huks_adapter.c +++ b/deps_adapter/key_management_adapter/impl/src/standard/huks_adapter.c @@ -14,12 +14,12 @@ */ #include "huks_adapter.h" -#include "common_util.h" #include "crypto_hash_to_point.h" #include "hc_log.h" #include "hks_api.h" #include "hks_param.h" #include "hks_type.h" +#include "string_util.h" static enum HksKeyAlg g_algToHksAlgorithm[] = { HKS_ALG_ED25519, diff --git a/deps_adapter/key_management_adapter/interfaces/alg_defs.h b/deps_adapter/key_management_adapter/interfaces/alg_defs.h index bf41adb..d7e57c2 100644 --- a/deps_adapter/key_management_adapter/interfaces/alg_defs.h +++ b/deps_adapter/key_management_adapter/interfaces/alg_defs.h @@ -16,8 +16,8 @@ #ifndef ALG_DEFS_H #define ALG_DEFS_H -#include "common_util.h" #include "hc_types.h" +#include "string_util.h" #define SHA256_LEN 32 #define HMAC_LEN 32 diff --git a/deps_adapter/os_adapter/impl/src/liteos/hc_mutex.c b/deps_adapter/os_adapter/impl/src/hc_mutex.c similarity index 90% rename from deps_adapter/os_adapter/impl/src/liteos/hc_mutex.c rename to deps_adapter/os_adapter/impl/src/hc_mutex.c index 5b76967..54679d8 100644 --- a/deps_adapter/os_adapter/impl/src/liteos/hc_mutex.c +++ b/deps_adapter/os_adapter/impl/src/hc_mutex.c @@ -15,6 +15,10 @@ #include "hc_mutex.h" +#ifdef __cplusplus +extern "C" { +#endif + static int HcMutexLock(HcMutex *mutex) { if (mutex == NULL) { @@ -51,4 +55,8 @@ void DestroyHcMutex(struct HcMutexT *mutex) return; } pthread_mutex_destroy(&mutex->mutex); -} \ No newline at end of file +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/deps_adapter/os_adapter/impl/src/linux/hc_time.c b/deps_adapter/os_adapter/impl/src/hc_time.c similarity index 100% rename from deps_adapter/os_adapter/impl/src/linux/hc_time.c rename to deps_adapter/os_adapter/impl/src/hc_time.c diff --git a/deps_adapter/os_adapter/impl/src/dev_info/3516/hc_dev_info.c b/deps_adapter/os_adapter/impl/src/linux/hc_dev_info.c similarity index 100% rename from deps_adapter/os_adapter/impl/src/dev_info/3516/hc_dev_info.c rename to deps_adapter/os_adapter/impl/src/linux/hc_dev_info.c diff --git a/deps_adapter/os_adapter/impl/src/linux/hc_mutex.c b/deps_adapter/os_adapter/impl/src/linux/hc_mutex.c deleted file mode 100644 index e1b8a0a..0000000 --- a/deps_adapter/os_adapter/impl/src/linux/hc_mutex.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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_mutex.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int MutexLock(HcMutex* mutex) -{ - if (mutex == NULL) { - return -1; - } - return -pthread_mutex_lock(&mutex->mutex); -} - -void MutexUnlock(HcMutex* mutex) -{ - if (mutex == NULL) { - return; - } - pthread_mutex_unlock(&mutex->mutex); -} - -int32_t InitHcMutex(struct HcMutexT* mutex) -{ - if (mutex == NULL) { - return -1; - } - int res = pthread_mutex_init(&mutex->mutex, NULL); - if (res != 0) { - return res; - } - mutex->lock = MutexLock; - mutex->unlock = MutexUnlock; - return res; -} - -void DestroyHcMutex(struct HcMutexT* mutex) -{ - if (mutex == NULL) { - return; - } - pthread_mutex_destroy(&mutex->mutex); -} - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps_adapter/os_adapter/impl/src/linux/hc_types.c b/deps_adapter/os_adapter/impl/src/linux/hc_types.c index dc22845..7596934 100644 --- a/deps_adapter/os_adapter/impl/src/linux/hc_types.c +++ b/deps_adapter/os_adapter/impl/src/linux/hc_types.c @@ -51,24 +51,6 @@ uint32_t HcStrlen(const char *str) return p - str - 1; } -const char *HcFmtLogData(const char *funName, char *out, int32_t outSz, const char *fmtStr, ...) -{ - int32_t ret; - int32_t cnt; - int32_t n = 0; - va_list arglist; - - cnt = sprintf_s(out, outSz, "%s: ", funName); - if (cnt <= 0) { - return NULL; - } - n += cnt; - va_start(arglist, fmtStr); - ret = vsprintf_s(out + n, outSz - n, fmtStr, arglist); - va_end(arglist); - return (ret > 0) ? ((const char *)out) : NULL; -} - #ifdef __cplusplus } #endif diff --git a/deps_adapter/os_adapter/impl/src/dev_info/3861/hc_dev_info.c b/deps_adapter/os_adapter/impl/src/liteos/hc_dev_info.c similarity index 100% rename from deps_adapter/os_adapter/impl/src/dev_info/3861/hc_dev_info.c rename to deps_adapter/os_adapter/impl/src/liteos/hc_dev_info.c diff --git a/deps_adapter/os_adapter/impl/src/liteos/hc_time.c b/deps_adapter/os_adapter/impl/src/liteos/hc_time.c deleted file mode 100644 index cc64aa4..0000000 --- a/deps_adapter/os_adapter/impl/src/liteos/hc_time.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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_time.h" -#include -#include -#include "hc_log.h" - -int64_t HcGetCurTime() -{ - struct timespec start; - int res = clock_gettime(CLOCK_MONOTONIC, &start); - if (res != 0) { - LOGE("clock_gettime failed, res:%d", res); - return -1; - } - return start.tv_sec; -} - -int64_t HcGetIntervalTime(int64_t startTime) -{ - if (startTime < 0) { - LOGE("Start time is invalid"); - return -1; - } - struct timespec end; - int res = clock_gettime(CLOCK_MONOTONIC, &end); - if (res != 0) { - LOGE("clock_gettime failed, res:%d", res); - return -1; - } - if (end.tv_sec < startTime) { - LOGE("End time is invalid"); - return -1; - } - return (end.tv_sec - startTime); -} \ No newline at end of file diff --git a/deps_adapter/os_adapter/interfaces/dev_info/3861/hc_dev_info.h b/deps_adapter/os_adapter/interfaces/dev_info/3861/hc_dev_info.h deleted file mode 100644 index 3e6791d..0000000 --- a/deps_adapter/os_adapter/interfaces/dev_info/3861/hc_dev_info.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ - -#ifndef HC_DEV_INFO_H -#define HC_DEV_INFO_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define INPUT_UDID_LEN 65 -#define MAX_INPUT_UDID_LEN 200 -#define MAX_SESSION_COUNT 20 - -/* - * Get the unique device ID of the device(UDID). - * udid: It is used to store the UDID finally obtained. - * udidLen: The size of array to store UDID. Its value is the real udid size + 1 (including '\0'). - * In liteos and linux, the udidLen must be 65. - * Return 0 if the UDID is successfully obtained, other returns an error code. - */ -int32_t HcGetUdid(uint8_t *udid, int32_t udidLen); - -const char *GetStoragePath(void); - -#ifdef __cplusplus -} -#endif -#endif \ No newline at end of file diff --git a/deps_adapter/os_adapter/interfaces/dev_info/3516/hc_dev_info.h b/deps_adapter/os_adapter/interfaces/hc_dev_info.h similarity index 100% rename from deps_adapter/os_adapter/interfaces/dev_info/3516/hc_dev_info.h rename to deps_adapter/os_adapter/interfaces/hc_dev_info.h diff --git a/deps_adapter/os_adapter/interfaces/linux/hc_mutex.h b/deps_adapter/os_adapter/interfaces/hc_mutex.h similarity index 100% rename from deps_adapter/os_adapter/interfaces/linux/hc_mutex.h rename to deps_adapter/os_adapter/interfaces/hc_mutex.h diff --git a/deps_adapter/os_adapter/interfaces/linux/hc_thread.h b/deps_adapter/os_adapter/interfaces/hc_thread.h similarity index 100% rename from deps_adapter/os_adapter/interfaces/linux/hc_thread.h rename to deps_adapter/os_adapter/interfaces/hc_thread.h diff --git a/deps_adapter/os_adapter/interfaces/linux/hc_time.h b/deps_adapter/os_adapter/interfaces/hc_time.h similarity index 100% rename from deps_adapter/os_adapter/interfaces/linux/hc_time.h rename to deps_adapter/os_adapter/interfaces/hc_time.h diff --git a/deps_adapter/os_adapter/interfaces/linux/hc_types.h b/deps_adapter/os_adapter/interfaces/hc_types.h similarity index 100% rename from deps_adapter/os_adapter/interfaces/linux/hc_types.h rename to deps_adapter/os_adapter/interfaces/hc_types.h diff --git a/deps_adapter/os_adapter/interfaces/liteos/hc_mutex.h b/deps_adapter/os_adapter/interfaces/liteos/hc_mutex.h deleted file mode 100644 index a166590..0000000 --- a/deps_adapter/os_adapter/interfaces/liteos/hc_mutex.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -#ifndef HC_MUTEX_H -#define HC_MUTEX_H - -#include -#include "pthread.h" - -typedef struct HcMutexT { - int (*lock)(struct HcMutexT* mutex); - void (*unlock)(struct HcMutexT* mutex); - pthread_mutex_t mutex; -} HcMutex; - -int32_t InitHcMutex(HcMutex* mutex); -void DestroyHcMutex(HcMutex* mutex); - -#endif \ No newline at end of file diff --git a/deps_adapter/os_adapter/interfaces/liteos/hc_time.h b/deps_adapter/os_adapter/interfaces/liteos/hc_time.h deleted file mode 100644 index d3878d7..0000000 --- a/deps_adapter/os_adapter/interfaces/liteos/hc_time.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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. - */ - -#ifndef HC_TIME_H -#define HC_TIME_H - -#include - - /* Calculate in seconds */ -#define TIME_OUT_VALUE 600 - -/* Return in seconds */ -int64_t HcGetCurTime(void); - -/* Return the interval seconds from startTime to current Time */ -int64_t HcGetIntervalTime(int64_t startTime); - -#endif \ No newline at end of file diff --git a/deps_adapter/os_adapter/interfaces/liteos/hc_types.h b/deps_adapter/os_adapter/interfaces/liteos/hc_types.h deleted file mode 100644 index 454827e..0000000 --- a/deps_adapter/os_adapter/interfaces/liteos/hc_types.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ - -#ifndef HC_TYPES_H -#define HC_TYPES_H - -#include -#include -#include -#include -#include - -void *HcMalloc(uint32_t size, char val); -void HcFree(void *addr); -uint32_t HcStrlen(const char *str); - -#endif diff --git a/services/common/inc/data_base/database_manager.h b/services/common/inc/data_base/database_manager.h index 840cc85..7ba447f 100644 --- a/services/common/inc/data_base/database_manager.h +++ b/services/common/inc/data_base/database_manager.h @@ -17,7 +17,7 @@ #define DATABASE_MANAGER_H #include "common_defs.h" -#include "common_util.h" +#include "string_util.h" #include "database.h" #define HC_TRUST_DEV_ENTRY_MAX_NUM 101 diff --git a/services/group_manager/inc/group_operation_common.h b/services/group_manager/inc/group_operation_common.h index 05c9dc5..d30e323 100644 --- a/services/group_manager/inc/group_operation_common.h +++ b/services/group_manager/inc/group_operation_common.h @@ -16,7 +16,7 @@ #ifndef GROUP_OPERATION_COMMON_H #define GROUP_OPERATION_COMMON_H -#include "common_util.h" +#include "string_util.h" #include "database.h" #include "json_utils.h" diff --git a/services/group_manager/src/group_operation/group_operation_common.c b/services/group_manager/src/group_operation/group_operation_common.c index 18c260d..2d0b5a2 100644 --- a/services/group_manager/src/group_operation/group_operation_common.c +++ b/services/group_manager/src/group_operation/group_operation_common.c @@ -16,7 +16,7 @@ #include "group_operation_common.h" #include "alg_loader.h" -#include "common_util.h" +#include "string_util.h" #include "database_manager.h" #include "dev_auth_module_manager.h" #include "group_operation.h" diff --git a/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c b/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c index 2550d28..c6c82b4 100644 --- a/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c +++ b/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c @@ -18,7 +18,7 @@ #include "alg_defs.h" #include "callback_manager.h" #include "channel_manager.h" -#include "common_util.h" +#include "string_util.h" #include "database_manager.h" #include "group_operation_common.h" #include "hc_dev_info.h" diff --git a/services/module/inc/das_module/das_common.h b/services/module/inc/das_module/das_common.h index 032064b..0eb5973 100644 --- a/services/module/inc/das_module/das_common.h +++ b/services/module/inc/das_module/das_common.h @@ -16,10 +16,10 @@ #ifndef DAS_COMMON_H #define DAS_COMMON_H -#include "common_util.h" #include "das_module_defines.h" #include "hc_types.h" #include "json_utils.h" +#include "string_util.h" int32_t GenerateKeyAlias(const Uint8Buff *pkgName, const Uint8Buff *serviceType, const KeyAliasType keyType, const Uint8Buff *authId, Uint8Buff *outKeyAlias); diff --git a/services/module/inc/das_module/das_module.h b/services/module/inc/das_module/das_module.h index 574f3fc..43e5b0b 100644 --- a/services/module/inc/das_module/das_module.h +++ b/services/module/inc/das_module/das_module.h @@ -17,7 +17,7 @@ #define DAS_MODULE_H #include "common_defs.h" -#include "common_util.h" +#include "string_util.h" bool IsDasSupported(void); diff --git a/services/module/inc/dev_auth_module_manager.h b/services/module/inc/dev_auth_module_manager.h index 19b881c..97c8103 100644 --- a/services/module/inc/dev_auth_module_manager.h +++ b/services/module/inc/dev_auth_module_manager.h @@ -16,8 +16,8 @@ #ifndef DEV_AUTH_MODULE_MANAGER_H #define DEV_AUTH_MODULE_MANAGER_H -#include "common_util.h" #include "json_utils.h" +#include "string_util.h" #ifdef __cplusplus extern "C" { diff --git a/services/module/inc/module_common.h b/services/module/inc/module_common.h index d3bdfac..a46727e 100644 --- a/services/module/inc/module_common.h +++ b/services/module/inc/module_common.h @@ -16,7 +16,7 @@ #ifndef MODULE_COMMON_H #define MODULE_COMMON_H -#include "common_util.h" +#include "string_util.h" int32_t InitSingleParam(Uint8Buff *param, uint32_t len); diff --git a/services/module/inc/protocol/protocol_common.h b/services/module/inc/protocol/protocol_common.h index d6b22cc..ddd272c 100644 --- a/services/module/inc/protocol/protocol_common.h +++ b/services/module/inc/protocol/protocol_common.h @@ -16,7 +16,7 @@ #ifndef PROTOCOL_COMMON_H #define PROTOCOL_COMMON_H -#include "common_util.h" +#include "string_util.h" typedef enum { UNSUPPORTED_ALG = 0x0000, 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 3331c8a..052bf1e 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 @@ -21,7 +21,7 @@ #include #include "common_defs.h" -#include "common_util.h" +#include "string_util.h" #include "auth_common.h" #define FILE_VERSION 0x01 diff --git a/services/module/inc/tcis_module/tcis_module_defines.h b/services/module/inc/tcis_module/tcis_module_defines.h index 2a35742..d5655cc 100644 --- a/services/module/inc/tcis_module/tcis_module_defines.h +++ b/services/module/inc/tcis_module/tcis_module_defines.h @@ -18,8 +18,8 @@ #include "alg_defs.h" #include "auth_common.h" -#include "common_util.h" #include "pake_protocol_common.h" +#include "string_util.h" typedef enum { TASK_TYPE_DEFAULT = 0, diff --git a/services/module/src/das_module/das_common.c b/services/module/src/das_module/das_common.c index 48241bb..2b0e066 100644 --- a/services/module/src/das_module/das_common.c +++ b/services/module/src/das_module/das_common.c @@ -16,10 +16,10 @@ #include "das_common.h" #include "alg_defs.h" #include "alg_loader.h" -#include "common_util.h" #include "hc_log.h" #include "hc_types.h" #include "module_common.h" +#include "string_util.h" #define KEY_TYPE_PAIR_LEN 2 #define PACKAGE_NAME_MAX_LEN 256 diff --git a/services/module/src/das_module/das_version_util.c b/services/module/src/das_module/das_version_util.c index 9e84c69..2e64881 100644 --- a/services/module/src/das_module/das_version_util.c +++ b/services/module/src/das_module/das_version_util.c @@ -15,10 +15,10 @@ #include "das_version_util.h" #include "common_defs.h" -#include "common_util.h" #include "hc_log.h" #include "hc_types.h" #include "json_utils.h" +#include "string_util.h" #define BIND_PRIORITY_LEN 5 #define AUTH_PRIORITY_LEN 5 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 01e527c..6dac51c 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 @@ -14,11 +14,11 @@ */ #include "iso_server_unbind_exchange_task.h" -#include "common_util.h" #include "das_module_defines.h" #include "hc_log.h" #include "hc_types.h" #include "iso_task_common.h" +#include "string_util.h" enum { TASK_TYPE_BEGIN = 1, diff --git a/services/module/src/das_module/pake_task/pake_message_util.c b/services/module/src/das_module/pake_task/pake_message_util.c index 085a5f5..18a5bd4 100644 --- a/services/module/src/das_module/pake_task/pake_message_util.c +++ b/services/module/src/das_module/pake_task/pake_message_util.c @@ -13,13 +13,13 @@ * limitations under the License. */ -#include "json_utils.h" -#include "common_util.h" #include "das_common.h" #include "hc_log.h" +#include "json_utils.h" #include "module_common.h" #include "pake_base_cur_task.h" #include "protocol_common.h" +#include "string_util.h" int32_t ParseStartJsonParams(PakeParams *params, const CJson *in) { 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 1bfd4da..ecf7f7e 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 @@ -14,7 +14,6 @@ */ #include "pake_task_common.h" -#include "common_util.h" #include "das_asy_token_manager.h" #include "das_common.h" #include "das_module_defines.h" @@ -23,6 +22,7 @@ #include "module_common.h" #include "protocol_common.h" #include "standard_client_bind_exchange_task.h" +#include "string_util.h" #define ASCII_CASE_DIFFERENCE_VALUE 32 diff --git a/services/module/src/das_module/pake_task/standard_exchange_task/common_standard_bind_exchange.c b/services/module/src/das_module/pake_task/standard_exchange_task/common_standard_bind_exchange.c index 05a2b12..61fd586 100644 --- a/services/module/src/das_module/pake_task/standard_exchange_task/common_standard_bind_exchange.c +++ b/services/module/src/das_module/pake_task/standard_exchange_task/common_standard_bind_exchange.c @@ -14,14 +14,14 @@ */ #include "common_standard_bind_exchange.h" +#include "securec.h" #include "alg_defs.h" -#include "common_util.h" #include "das_asy_token_manager.h" #include "das_common.h" #include "hc_log.h" #include "hc_types.h" #include "module_common.h" -#include "securec.h" +#include "string_util.h" int32_t InitStandardBindExchangeParams(StandardBindExchangeParams *params) { diff --git a/services/module/src/das_module/pake_task/standard_exchange_task/standard_exchange_message_util.c b/services/module/src/das_module/pake_task/standard_exchange_task/standard_exchange_message_util.c index 5d491d9..a8a7757 100644 --- a/services/module/src/das_module/pake_task/standard_exchange_task/standard_exchange_message_util.c +++ b/services/module/src/das_module/pake_task/standard_exchange_task/standard_exchange_message_util.c @@ -15,12 +15,12 @@ #include "standard_exchange_message_util.h" #include "common_defs.h" -#include "common_util.h" #include "hc_log.h" #include "hc_types.h" #include "json_utils.h" #include "module_common.h" #include "pake_base_cur_task.h" +#include "string_util.h" int32_t PackageNonceAndCipherToJson(const Uint8Buff *nonce, const Uint8Buff *cipher, CJson *data, const char *key) { diff --git a/services/module/src/version_util.c b/services/module/src/version_util.c index 8e4a0ee..e868908 100644 --- a/services/module/src/version_util.c +++ b/services/module/src/version_util.c @@ -14,11 +14,11 @@ */ #include "version_util.h" -#include "common_util.h" +#include "securec.h" #include "hc_log.h" #include "hc_types.h" #include "protocol_common.h" -#include "securec.h" +#include "string_util.h" static const char *Split(char *str, char delim, int *next) { diff --git a/services/session/src/auth_session/auth_session_common.c b/services/session/src/auth_session/auth_session_common.c index f5641cc..a40715e 100644 --- a/services/session/src/auth_session/auth_session_common.c +++ b/services/session/src/auth_session/auth_session_common.c @@ -19,7 +19,7 @@ #include "alg_defs.h" #include "auth_session_util.h" #include "common_defs.h" -#include "common_util.h" +#include "string_util.h" #include "database_manager.h" #include "dev_auth_module_manager.h" #include "hc_log.h" diff --git a/services/session/src/auth_session/auth_session_util.c b/services/session/src/auth_session/auth_session_util.c index 7d5de75..881ac2c 100644 --- a/services/session/src/auth_session/auth_session_util.c +++ b/services/session/src/auth_session/auth_session_util.c @@ -19,9 +19,9 @@ #include "alg_loader.h" #include "auth_session_common_defines.h" #include "common_defs.h" -#include "common_util.h" #include "device_auth_defines.h" #include "hc_log.h" +#include "string_util.h" static int32_t AuthFormToModuleType(int32_t authForm) { diff --git a/services/session/src/auth_session_common_util.c b/services/session/src/auth_session_common_util.c index 5afa4e7..3fd5e86 100644 --- a/services/session/src/auth_session_common_util.c +++ b/services/session/src/auth_session_common_util.c @@ -15,7 +15,7 @@ #include "auth_session_common_util.h" #include "common_defs.h" -#include "common_util.h" +#include "string_util.h" #include "device_auth_defines.h" #include "hc_log.h" #include "hc_types.h" diff --git a/test/unittest/deviceauth/BUILD.gn b/test/unittest/deviceauth/BUILD.gn index a5ad199..19e03e4 100644 --- a/test/unittest/deviceauth/BUILD.gn +++ b/test/unittest/deviceauth/BUILD.gn @@ -32,21 +32,21 @@ ohos_unittest("deviceauth_llt") { sources = [ "${common_lib_path}/impl/src/clib_types.c", - "${common_lib_path}/impl/src/common_util.c", "${common_lib_path}/impl/src/hc_parcel.c", "${common_lib_path}/impl/src/hc_string.c", "${common_lib_path}/impl/src/hc_tlv_parser.c", "${common_lib_path}/impl/src/json_utils.c", + "${common_lib_path}/impl/src/string_util.c", "${key_management_adapter_path}/impl/src/alg_loader.c", "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c", "${key_management_adapter_path}/impl/src/standard/huks_adapter.c", + "${os_adapter_path}/impl/src/hc_mutex.c", "${os_adapter_path}/impl/src/hc_task_thread.c", + "${os_adapter_path}/impl/src/hc_time.c", "${os_adapter_path}/impl/src/linux/hc_condition.c", "${os_adapter_path}/impl/src/linux/hc_file.c", "${os_adapter_path}/impl/src/linux/hc_init_protection.c", - "${os_adapter_path}/impl/src/linux/hc_mutex.c", "${os_adapter_path}/impl/src/linux/hc_thread.c", - "${os_adapter_path}/impl/src/linux/hc_time.c", "${os_adapter_path}/impl/src/linux/hc_types.c", ] sources += deviceauth_files