diff --git a/common_lib/impl/src/clib_types.c b/common_lib/impl/src/clib_types.c index 7b3c2af..c6ca169 100644 --- a/common_lib/impl/src/clib_types.c +++ b/common_lib/impl/src/clib_types.c @@ -14,7 +14,7 @@ */ #include "clib_types.h" -#include +#include "securec.h" void *ClibMalloc(uint32_t size, char val) { diff --git a/common_lib/impl/src/hc_parcel.c b/common_lib/impl/src/hc_parcel.c index 247acc5..1c9fb59 100644 --- a/common_lib/impl/src/hc_parcel.c +++ b/common_lib/impl/src/hc_parcel.c @@ -29,7 +29,7 @@ HcParcel CreateParcel(uint32_t size, uint32_t allocUnit) parcel.allocUnit = PARCEL_DEFAULT_INCREASE_STEP; } if (size > 0) { - parcel.data = (char*)ClibMalloc(size, 0); + parcel.data = (char *)ClibMalloc(size, 0); if (parcel.data != NULL) { parcel.length = size; } diff --git a/common_lib/impl/src/json_utils.c b/common_lib/impl/src/json_utils.c index 3c44500..7c7d806 100644 --- a/common_lib/impl/src/json_utils.c +++ b/common_lib/impl/src/json_utils.c @@ -16,7 +16,7 @@ #include "json_utils.h" #include #include -#include +#include "securec.h" #include "clib_error.h" #include "clib_types.h" #include "string_util.h" @@ -203,12 +203,7 @@ int32_t GetByteFromJson(const CJson *jsonObj, const char *key, uint8_t *byte, ui if (len < strlen(valueStr) / BYTE_TO_HEX_OPER_LENGTH) { return CLIB_ERR_INVALID_LEN; } - int32_t ret = HexStringToByte(valueStr, byte, len); - if (ret != CLIB_SUCCESS) { - return ret; - } - - return ret; + return HexStringToByte(valueStr, byte, len); } int32_t GetIntFromJson(const CJson *jsonObj, const char *key, int32_t *value) diff --git a/common_lib/impl/src/string_util.c b/common_lib/impl/src/string_util.c index 3eb8565..b08e51b 100644 --- a/common_lib/impl/src/string_util.c +++ b/common_lib/impl/src/string_util.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include "securec.h" #include "clib_error.h" #include "clib_types.h" @@ -228,8 +228,7 @@ int32_t ByteToBase64String(const uint8_t *byte, uint32_t byteLen, char *base64St if (byteLen % 3 == 1) { base64Str[i - 2] = '='; base64Str[i - 1] = '='; - } - if (byteLen % 3 == 2) { + } else if (byteLen % 3 == 2) { base64Str[i - 1] = '='; } base64Str[len] = '\0'; diff --git a/deps_adapter/key_management_adapter/impl/src/small/mbedtls_hash_to_point.c b/deps_adapter/key_management_adapter/impl/src/small/mbedtls_hash_to_point.c index f617841..42e457d 100644 --- a/deps_adapter/key_management_adapter/impl/src/small/mbedtls_hash_to_point.c +++ b/deps_adapter/key_management_adapter/impl/src/small/mbedtls_hash_to_point.c @@ -16,7 +16,7 @@ #include "mbedtls_hash_to_point.h" #include #include -#include +#include "securec.h" #include "alg_defs.h" #include "hal_error.h" #include "hc_log.h" diff --git a/deps_adapter/os_adapter/impl/src/hc_log.c b/deps_adapter/os_adapter/impl/src/hc_log.c index 569d7ed..d973f6b 100644 --- a/deps_adapter/os_adapter/impl/src/hc_log.c +++ b/deps_adapter/os_adapter/impl/src/hc_log.c @@ -14,7 +14,7 @@ */ #include "hc_log.h" -#include +#include "securec.h" #define LOG_PRINT_MAX_LEN 256 diff --git a/deps_adapter/os_adapter/impl/src/linux/hc_file.c b/deps_adapter/os_adapter/impl/src/linux/hc_file.c index 1e7ffa3..4c0791a 100644 --- a/deps_adapter/os_adapter/impl/src/linux/hc_file.c +++ b/deps_adapter/os_adapter/impl/src/linux/hc_file.c @@ -19,9 +19,9 @@ #include #include #include -#include "securec.h" #include "hc_log.h" #include "hc_types.h" +#include "securec.h" #ifdef __cplusplus extern "C" { @@ -123,8 +123,8 @@ int HcFileRead(FileHandle file, void *dst, int dstSize) int total = 0; while (total < dstSize) { int readCount = fread(dstBuffer + total, 1, dstSize - total, fp); - if ((readCount < 0) || (readCount > (dstSize - total))) { - return -1; + if (ferror(fp) != 0) { + LOGE("read file error!"); } if (readCount == 0) { return total; @@ -146,8 +146,8 @@ int HcFileWrite(FileHandle file, const void *src, int srcSize) int total = 0; while (total < srcSize) { int writeCount = fwrite(srcBuffer + total, 1, srcSize - total, fp); - if (writeCount < 0 || writeCount > (srcSize - total)) { - return -1; + if (ferror(fp) != 0) { + LOGE("write file error!"); } total += writeCount; } @@ -196,6 +196,9 @@ void HcFileGetSubFileName(const char *path, StringVector *nameVec) DeleteString(&subFileName); } } + if (closedir(dir) < 0) { + LOGE("Failed to close file"); + } } #ifdef __cplusplus diff --git a/deps_adapter/os_adapter/impl/src/liteos/mini/hc_file.c b/deps_adapter/os_adapter/impl/src/liteos/mini/hc_file.c index d40b680..eced8f8 100644 --- a/deps_adapter/os_adapter/impl/src/liteos/mini/hc_file.c +++ b/deps_adapter/os_adapter/impl/src/liteos/mini/hc_file.c @@ -17,11 +17,11 @@ #include #include #include -#include #include #include #include "hal_error.h" #include "hc_log.h" +#include "securec.h" #include "utils_file.h" #define MAX_FOLDER_NAME_SIZE 128 @@ -136,8 +136,11 @@ void HcFileGetSubFileName(const char *path, StringVector *nameVec) continue; } if (nameVec->pushBackT(nameVec, subFileName) == NULL) { - LOGE("Failed to push path to pathVec!"); + LOGE("Failed to push name!"); DeleteString(&subFileName); } } + if (closedir(dir) < 0) { + LOGE("Failed to close file"); + } } \ No newline at end of file diff --git a/frameworks/deviceauth_lite/source/auth_info/add_auth_info.c b/frameworks/deviceauth_lite/source/auth_info/add_auth_info.c index 5354457..bba55a7 100644 --- a/frameworks/deviceauth_lite/source/auth_info/add_auth_info.c +++ b/frameworks/deviceauth_lite/source/auth_info/add_auth_info.c @@ -15,7 +15,7 @@ #include "add_auth_info.h" #include -#include +#include "securec.h" #include "log.h" #include "base.h" #include "mem_stat.h" @@ -192,7 +192,7 @@ int32_t import_signed_auth_info_hilink(const struct hichain *hichain, const stru uint32_t len = (data->length / BYTE_TO_HEX_OPER_LENGTH) + 1; uint8_t *receive_data = (uint8_t *)MALLOC(len); if (receive_data == NULL) { - LOGE("malloc inport signed auth info receive data failed"); + LOGE("malloc import signed auth info receive data failed"); return HC_MALLOC_FAILED; } (void)memset_s(receive_data, len, 0, len); diff --git a/frameworks/deviceauth_lite/source/auth_info/add_auth_info_client.c b/frameworks/deviceauth_lite/source/auth_info/add_auth_info_client.c index 900847a..19ee103 100755 --- a/frameworks/deviceauth_lite/source/auth_info/add_auth_info_client.c +++ b/frameworks/deviceauth_lite/source/auth_info/add_auth_info_client.c @@ -14,7 +14,7 @@ */ #include "add_auth_info_client.h" -#include +#include "securec.h" #include "huks_adapter.h" #include "log.h" #include "mem_stat.h" diff --git a/frameworks/deviceauth_lite/source/auth_info/auth_info.c b/frameworks/deviceauth_lite/source/auth_info/auth_info.c index 6064360..10e3ae3 100755 --- a/frameworks/deviceauth_lite/source/auth_info/auth_info.c +++ b/frameworks/deviceauth_lite/source/auth_info/auth_info.c @@ -14,7 +14,7 @@ */ #include "auth_info.h" -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "huks_adapter.h" @@ -78,7 +78,7 @@ int32_t encrypt_payload(const struct var_buffer *key, const struct uint8_buff *p struct aes_aad aes_aad; (void)memset_s(&aes_aad, sizeof(aes_aad), 0, sizeof(aes_aad)); if (strcpy_s((char *)aes_aad.aad, sizeof(aes_aad.aad), aad) != EOK) { - LOGE("What happened was that the probability was zero"); /* caller perceives memery error, no return */ + LOGE("What happened was that the probability was zero"); /* caller perceives memory error, no return */ } aes_aad.length = strlen(aad); int32_t ret = aes_gcm_encrypt((struct var_buffer *)key, plain, &aes_aad, payload); @@ -104,7 +104,7 @@ int32_t decrypt_payload(const struct var_buffer *key, const struct uint8_buff *p struct aes_aad aes_aad; (void)memset_s(&aes_aad, sizeof(aes_aad), 0, sizeof(aes_aad)); if (strcpy_s((char *)aes_aad.aad, sizeof(aes_aad.aad), aad) != EOK) { - LOGE("What happened was that the probability was zero"); /* caller perceives memery error, no return */ + LOGE("What happened was that the probability was zero"); /* caller perceives memory error, no return */ } aes_aad.length = strlen(aad); int32_t ret = aes_gcm_decrypt((struct var_buffer *)key, payload, &aes_aad, plain); diff --git a/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info.c b/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info.c index d57685c..21c460b 100755 --- a/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info.c +++ b/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info.c @@ -16,7 +16,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_) || defined(_CUT_EXCHANGE_) || defined(_CUT_EXCHANGE_SERVER_)) #include "exchange_auth_info.h" -#include +#include "securec.h" #include "log.h" #include "base.h" #include "mem_stat.h" diff --git a/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info_client.c b/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info_client.c index 90ce0e6..12c3c89 100755 --- a/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info_client.c +++ b/frameworks/deviceauth_lite/source/auth_info/exchange_auth_info_client.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_CLIENT_) || defined(_CUT_EXCHANGE_) || defined(_CUT_EXCHANGE_CLIENT_)) #include "exchange_auth_info_client.h" -#include +#include "securec.h" #include "log.h" #include "base.h" #include "mem_stat.h" diff --git a/frameworks/deviceauth_lite/source/auth_info/remove_auth_info_client.c b/frameworks/deviceauth_lite/source/auth_info/remove_auth_info_client.c index 60547a3..666707d 100755 --- a/frameworks/deviceauth_lite/source/auth_info/remove_auth_info_client.c +++ b/frameworks/deviceauth_lite/source/auth_info/remove_auth_info_client.c @@ -16,7 +16,7 @@ #include "remove_auth_info_client.h" #include #include -#include +#include "securec.h" #include "log.h" #include "base.h" #include "mem_stat.h" diff --git a/frameworks/deviceauth_lite/source/hichain.c b/frameworks/deviceauth_lite/source/hichain.c index 261aca7..ff7b638 100755 --- a/frameworks/deviceauth_lite/source/hichain.c +++ b/frameworks/deviceauth_lite/source/hichain.c @@ -13,7 +13,7 @@ * limitations under the License. */ -#include +#include "securec.h" #include "commonutil.h" #include "distribution.h" #include "log.h" @@ -242,7 +242,7 @@ int32_t init_center(const struct hc_package_name *package_name, const struct hc_ LOGE("Generate derived dek failed"); return ret; } - if (memcpy_s(dek, sizeof(struct hc_key_alias), &dek_alias, sizeof(struct hc_key_alias)) != HC_OK) { + if (memcpy_s(dek, sizeof(struct hc_key_alias), &dek_alias, sizeof(struct hc_key_alias)) != EOK) { return HC_INNER_ERROR; } @@ -1175,7 +1175,7 @@ static int32_t delete_public_key(hc_handle handle, struct service_id service_id, (void)memset_s(auth_id_list, length, 0, length); uint32_t peers_num = list_trust_peers(handle, user_type, NULL, &auth_id_list); - LOGI("peers_num %d", peers_num); + LOGI("peers_num %u", peers_num); for (uint32_t loop = 0; loop < peers_num; loop++) { struct hc_key_alias key_alias = generate_key_alias(&service_id, &auth_id_list[loop], user_type); if (key_alias.length == 0) { diff --git a/frameworks/deviceauth_lite/source/json/commonutil.c b/frameworks/deviceauth_lite/source/json/commonutil.c index 14bff63..6d04558 100755 --- a/frameworks/deviceauth_lite/source/json/commonutil.c +++ b/frameworks/deviceauth_lite/source/json/commonutil.c @@ -14,7 +14,7 @@ */ #include "commonutil.h" -#include +#include "securec.h" #include "base.h" #include "log.h" #include "mem_stat.h" @@ -22,7 +22,8 @@ char hex_to_char(uint8_t hex) { - return (hex > 9) ? hex + 0x37 : hex + 0x30; /* Convert to the corresponding character */ + /* Convert to the corresponding character, hex + 0x37 -> A-F, hex + 0x30 -> 0-9 */ + return (hex > 9) ? hex + 0x37 : hex + 0x30; } void byte_to_hex_string(const uint8_t *hex, int32_t hex_len, uint8_t *buf, int32_t buf_len) @@ -117,22 +118,6 @@ int32_t string_convert(json_pobject obj, const char *field, uint8_t *str, uint32 return HC_OK; } -void hex_string_convert(uint32_t length, const uint8_t *hex, const char *field, json_pobject parent) -{ - int32_t org_cha_len = length; - int32_t tmp_cha_data_hex_len = org_cha_len * BYTE_TO_HEX_OPER_LENGTH + 1; - uint8_t *tmp_cha_data_hex = (uint8_t *)MALLOC(tmp_cha_data_hex_len); - - if (tmp_cha_data_hex == NULL) { - return; - } - (void)memset_s(tmp_cha_data_hex, tmp_cha_data_hex_len, 0, tmp_cha_data_hex_len); - byte_to_hex_string(hex, org_cha_len, tmp_cha_data_hex, org_cha_len * BYTE_TO_HEX_OPER_LENGTH); - add_string_to_object(parent, field, (char *)tmp_cha_data_hex); - FREE(tmp_cha_data_hex); - tmp_cha_data_hex = NULL; -} - int32_t memory_copy_error(const char *fun, unsigned int line) { (void)fun; diff --git a/frameworks/deviceauth_lite/source/json/commonutil.h b/frameworks/deviceauth_lite/source/json/commonutil.h index fc88d0c..9356cea 100755 --- a/frameworks/deviceauth_lite/source/json/commonutil.h +++ b/frameworks/deviceauth_lite/source/json/commonutil.h @@ -28,7 +28,6 @@ void print_bytes(uint8_t *buf, int32_t buf_len); int32_t byte_convert(json_pobject obj, const char *field, uint8_t *hex, uint32_t *length, uint32_t max_len); int32_t string_convert(json_pobject obj, const char *field, uint8_t *str, uint32_t *length, uint32_t max_len); -void hex_string_convert(uint32_t length, const uint8_t *hex, const char *field, json_pobject parent); int32_t memory_copy_error(const char *fun, unsigned int line); diff --git a/frameworks/deviceauth_lite/source/json/jsonutil.c b/frameworks/deviceauth_lite/source/json/jsonutil.c index 9da8f34..1627507 100755 --- a/frameworks/deviceauth_lite/source/json/jsonutil.c +++ b/frameworks/deviceauth_lite/source/json/jsonutil.c @@ -27,10 +27,10 @@ json_handle parse_json(const char *data) return (void *)root; } -void free_json(json_handle hanlde) +void free_json(json_handle handle) { - if (hanlde != NULL) { - cJSON_Delete((cJSON *)hanlde); + if (handle != NULL) { + cJSON_Delete((cJSON *)handle); } } diff --git a/frameworks/deviceauth_lite/source/json/jsonutil.h b/frameworks/deviceauth_lite/source/json/jsonutil.h index 2ba362e..cf5fb9e 100755 --- a/frameworks/deviceauth_lite/source/json/jsonutil.h +++ b/frameworks/deviceauth_lite/source/json/jsonutil.h @@ -22,7 +22,7 @@ typedef void *json_handle; typedef void *json_pobject; json_handle parse_json(const char *data); -void free_json(json_handle hanlde); +void free_json(json_handle handle); json_pobject get_json_obj(json_pobject parent, const char *field); int32_t get_json_int(json_pobject obj, const char *field); diff --git a/frameworks/deviceauth_lite/source/key_agreement/key_agreement_server.c b/frameworks/deviceauth_lite/source/key_agreement/key_agreement_server.c index aff4f94..440eed6 100755 --- a/frameworks/deviceauth_lite/source/key_agreement/key_agreement_server.c +++ b/frameworks/deviceauth_lite/source/key_agreement/key_agreement_server.c @@ -62,7 +62,7 @@ int32_t send_start_response(void *handle, void *receive_data, void *send_data) } set_state(base, START_RESPONSE); set_last_time_sec(base); - DBG_OUT("Object %u receive start request data send start response data succcess", base->sn); + DBG_OUT("Object %u receive start request data send start response data success", base->sn); return HC_OK; } @@ -94,7 +94,7 @@ int32_t send_end_response(void *handle, void *receive_data, void *send_data) } set_state(base, PROTOCOL_FINISH); set_last_time_sec(base); - DBG_OUT("Object %u receive end request data send end response data succcess", base->sn); + DBG_OUT("Object %u receive end request data send end response data success", base->sn); return HC_OK; } #endif /* DESC */ diff --git a/frameworks/deviceauth_lite/source/key_agreement/pake_client.c b/frameworks/deviceauth_lite/source/key_agreement/pake_client.c index 62ba235..8a902e5 100644 --- a/frameworks/deviceauth_lite/source/key_agreement/pake_client.c +++ b/frameworks/deviceauth_lite/source/key_agreement/pake_client.c @@ -20,7 +20,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_CLIENT_)) #include -#include +#include "securec.h" #include "huks_adapter.h" #include "commonutil.h" diff --git a/frameworks/deviceauth_lite/source/key_agreement/pake_server.c b/frameworks/deviceauth_lite/source/key_agreement/pake_server.c index cd163c3..54e398d 100644 --- a/frameworks/deviceauth_lite/source/key_agreement/pake_server.c +++ b/frameworks/deviceauth_lite/source/key_agreement/pake_server.c @@ -18,7 +18,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_)) -#include +#include "securec.h" #include "huks_adapter.h" #include "mem_stat.h" diff --git a/frameworks/deviceauth_lite/source/key_agreement/sec_clone_server.c b/frameworks/deviceauth_lite/source/key_agreement/sec_clone_server.c index dfe76cb..5d57b0f 100755 --- a/frameworks/deviceauth_lite/source/key_agreement/sec_clone_server.c +++ b/frameworks/deviceauth_lite/source/key_agreement/sec_clone_server.c @@ -18,7 +18,7 @@ #include "sec_clone_server.h" #include #include -#include +#include "securec.h" #include "huks_adapter.h" #include "log.h" #include "commonutil.h" diff --git a/frameworks/deviceauth_lite/source/key_agreement/sts_client.c b/frameworks/deviceauth_lite/source/key_agreement/sts_client.c index f2515f7..4d52074 100755 --- a/frameworks/deviceauth_lite/source/key_agreement/sts_client.c +++ b/frameworks/deviceauth_lite/source/key_agreement/sts_client.c @@ -17,7 +17,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_CLIENT_)) #include -#include +#include "securec.h" #include "huks_adapter.h" #include "log.h" #include "commonutil.h" diff --git a/frameworks/deviceauth_lite/source/key_agreement/sts_server.c b/frameworks/deviceauth_lite/source/key_agreement/sts_server.c index cb5a90b..c5e4cf6 100755 --- a/frameworks/deviceauth_lite/source/key_agreement/sts_server.c +++ b/frameworks/deviceauth_lite/source/key_agreement/sts_server.c @@ -18,7 +18,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_)) -#include +#include "securec.h" #include "commonutil.h" #include "distribution.h" #include "mem_stat.h" diff --git a/frameworks/deviceauth_lite/source/log/log.c b/frameworks/deviceauth_lite/source/log/log.c index 34caa67..5df4cd5 100755 --- a/frameworks/deviceauth_lite/source/log/log.c +++ b/frameworks/deviceauth_lite/source/log/log.c @@ -16,7 +16,7 @@ #ifndef _HC_DEBUG_ #include "log.h" -#include +#include "securec.h" #include "base.h" #if defined(_WINDOWS) diff --git a/frameworks/deviceauth_lite/source/schedule/build_object.c b/frameworks/deviceauth_lite/source/schedule/build_object.c index 3c2794a..5db441a 100755 --- a/frameworks/deviceauth_lite/source/schedule/build_object.c +++ b/frameworks/deviceauth_lite/source/schedule/build_object.c @@ -14,7 +14,7 @@ */ #include "build_object.h" -#include +#include "securec.h" #include "log.h" #include "auth_info.h" diff --git a/frameworks/deviceauth_lite/source/schedule/distribution.c b/frameworks/deviceauth_lite/source/schedule/distribution.c index 380fa04..5ab7f95 100644 --- a/frameworks/deviceauth_lite/source/schedule/distribution.c +++ b/frameworks/deviceauth_lite/source/schedule/distribution.c @@ -14,7 +14,7 @@ */ #include "distribution.h" -#include +#include "securec.h" #include "log.h" #include "pake_client.h" #include "pake_server.h" diff --git a/frameworks/deviceauth_lite/source/struct/add_auth_info_data.c b/frameworks/deviceauth_lite/source/struct/add_auth_info_data.c index 245ebec..2ca7db6 100755 --- a/frameworks/deviceauth_lite/source/struct/add_auth_info_data.c +++ b/frameworks/deviceauth_lite/source/struct/add_auth_info_data.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_) || defined(_CUT_ADD_) || defined(_CUT_ADD_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/add_auth_info_request.c b/frameworks/deviceauth_lite/source/struct/add_auth_info_request.c index 6dab0f2..7f7fb56 100755 --- a/frameworks/deviceauth_lite/source/struct/add_auth_info_request.c +++ b/frameworks/deviceauth_lite/source/struct/add_auth_info_request.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_) || defined(_CUT_ADD_) || defined(_CUT_ADD_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/add_auth_info_response.c b/frameworks/deviceauth_lite/source/struct/add_auth_info_response.c index 34328f4..8bbb85a 100755 --- a/frameworks/deviceauth_lite/source/struct/add_auth_info_response.c +++ b/frameworks/deviceauth_lite/source/struct/add_auth_info_response.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_) || defined(_CUT_ADD_) || defined(_CUT_ADD_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/auth_ack_request.c b/frameworks/deviceauth_lite/source/struct/auth_ack_request.c index 14a4d18..3d52f1d 100755 --- a/frameworks/deviceauth_lite/source/struct/auth_ack_request.c +++ b/frameworks/deviceauth_lite/source/struct/auth_ack_request.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/auth_ack_response.c b/frameworks/deviceauth_lite/source/struct/auth_ack_response.c index a62fada..ed04366 100755 --- a/frameworks/deviceauth_lite/source/struct/auth_ack_response.c +++ b/frameworks/deviceauth_lite/source/struct/auth_ack_response.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/auth_start_request.c b/frameworks/deviceauth_lite/source/struct/auth_start_request.c index b34b371..dd749ae 100755 --- a/frameworks/deviceauth_lite/source/struct/auth_start_request.c +++ b/frameworks/deviceauth_lite/source/struct/auth_start_request.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" @@ -90,8 +90,8 @@ void free_auth_start_request(void *obj) } } -static char *make_requst_json_str(struct sts_start_request_data *auth_start_request, - struct sts_start_request_data_hex tmp_hex) +static char *make_request_json_str(struct sts_start_request_data *auth_start_request, + struct sts_start_request_data_hex tmp_hex) { char *tmp_str = (char *)MALLOC(RET_STR_LENGTH); if (tmp_str == NULL) { @@ -156,7 +156,7 @@ char *make_auth_start_request(void *data) FREE(tmp_hex.tmp_cha_data_hex); return NULL; } - char *ret_str = make_requst_json_str(auth_start_request, tmp_hex); + char *ret_str = make_request_json_str(auth_start_request, tmp_hex); FREE(tmp_hex.tmp_epk_data_hex); FREE(tmp_hex.tmp_cha_data_hex); FREE(tmp_hex.tmp_type_data_hex); diff --git a/frameworks/deviceauth_lite/source/struct/auth_start_response.c b/frameworks/deviceauth_lite/source/struct/auth_start_response.c index d84c64c..f977082 100755 --- a/frameworks/deviceauth_lite/source/struct/auth_start_response.c +++ b/frameworks/deviceauth_lite/source/struct/auth_start_response.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/exchange_auth_data.c b/frameworks/deviceauth_lite/source/struct/exchange_auth_data.c index dfc4167..9cc3efc 100755 --- a/frameworks/deviceauth_lite/source/struct/exchange_auth_data.c +++ b/frameworks/deviceauth_lite/source/struct/exchange_auth_data.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_) || defined(_CUT_EXCHANGE_) || defined(_CUT_EXCHANGE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/exchange_request.c b/frameworks/deviceauth_lite/source/struct/exchange_request.c index c1c8cbd..58c9dd5 100755 --- a/frameworks/deviceauth_lite/source/struct/exchange_request.c +++ b/frameworks/deviceauth_lite/source/struct/exchange_request.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_) || defined(_CUT_EXCHANGE_) || defined(_CUT_EXCHANGE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/exchange_response.c b/frameworks/deviceauth_lite/source/struct/exchange_response.c index 575b1c9..d85747e 100755 --- a/frameworks/deviceauth_lite/source/struct/exchange_response.c +++ b/frameworks/deviceauth_lite/source/struct/exchange_response.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_) || defined(_CUT_EXCHANGE_) || defined(_CUT_EXCHANGE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/import_add_auth_data.c b/frameworks/deviceauth_lite/source/struct/import_add_auth_data.c index 73c44d3..a319d57 100755 --- a/frameworks/deviceauth_lite/source/struct/import_add_auth_data.c +++ b/frameworks/deviceauth_lite/source/struct/import_add_auth_data.c @@ -13,7 +13,7 @@ * limitations under the License. */ -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/inform_message.c b/frameworks/deviceauth_lite/source/struct/inform_message.c index b183231..6af939a 100755 --- a/frameworks/deviceauth_lite/source/struct/inform_message.c +++ b/frameworks/deviceauth_lite/source/struct/inform_message.c @@ -13,7 +13,7 @@ * limitations under the License. */ -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/key_agreement_version.c b/frameworks/deviceauth_lite/source/struct/key_agreement_version.c index bb58849..bea483e 100755 --- a/frameworks/deviceauth_lite/source/struct/key_agreement_version.c +++ b/frameworks/deviceauth_lite/source/struct/key_agreement_version.c @@ -14,7 +14,7 @@ */ #include "key_agreement_version.h" -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/pake_client_confirm.c b/frameworks/deviceauth_lite/source/struct/pake_client_confirm.c index 7eefddf..d91e424 100755 --- a/frameworks/deviceauth_lite/source/struct/pake_client_confirm.c +++ b/frameworks/deviceauth_lite/source/struct/pake_client_confirm.c @@ -16,7 +16,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_)) #include -#include +#include "securec.h" #include "mem_stat.h" #include "jsonutil.h" #include "commonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/pake_request.c b/frameworks/deviceauth_lite/source/struct/pake_request.c index 16ae8f1..feb5269 100755 --- a/frameworks/deviceauth_lite/source/struct/pake_request.c +++ b/frameworks/deviceauth_lite/source/struct/pake_request.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/pake_response.c b/frameworks/deviceauth_lite/source/struct/pake_response.c index e70e039..fa828f1 100755 --- a/frameworks/deviceauth_lite/source/struct/pake_response.c +++ b/frameworks/deviceauth_lite/source/struct/pake_response.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/pake_server_confirm.c b/frameworks/deviceauth_lite/source/struct/pake_server_confirm.c index 42e5c3e..1a89df6 100755 --- a/frameworks/deviceauth_lite/source/struct/pake_server_confirm.c +++ b/frameworks/deviceauth_lite/source/struct/pake_server_confirm.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/parsedata.c b/frameworks/deviceauth_lite/source/struct/parsedata.c index 11ee46f..d8ef534 100755 --- a/frameworks/deviceauth_lite/source/struct/parsedata.c +++ b/frameworks/deviceauth_lite/source/struct/parsedata.c @@ -14,7 +14,7 @@ */ #include "parsedata.h" -#include +#include "securec.h" #include "mem_stat.h" #include "jsonutil.h" #include "log.h" diff --git a/frameworks/deviceauth_lite/source/struct/rmv_auth_info_data.c b/frameworks/deviceauth_lite/source/struct/rmv_auth_info_data.c index a9b8789..4769ea9 100755 --- a/frameworks/deviceauth_lite/source/struct/rmv_auth_info_data.c +++ b/frameworks/deviceauth_lite/source/struct/rmv_auth_info_data.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_) || defined(_CUT_REMOVE_) || defined(_CUT_REMOVE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/rmv_auth_info_request.c b/frameworks/deviceauth_lite/source/struct/rmv_auth_info_request.c index 5a9af29..eb73f3c 100755 --- a/frameworks/deviceauth_lite/source/struct/rmv_auth_info_request.c +++ b/frameworks/deviceauth_lite/source/struct/rmv_auth_info_request.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_) || defined(_CUT_REMOVE_) || defined(_CUT_REMOVE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/rmv_auth_info_response.c b/frameworks/deviceauth_lite/source/struct/rmv_auth_info_response.c index 36bace0..ef43b37 100755 --- a/frameworks/deviceauth_lite/source/struct/rmv_auth_info_response.c +++ b/frameworks/deviceauth_lite/source/struct/rmv_auth_info_response.c @@ -15,7 +15,7 @@ #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_) || defined(_CUT_REMOVE_) || defined(_CUT_REMOVE_SERVER_)) -#include +#include "securec.h" #include "log.h" #include "mem_stat.h" #include "jsonutil.h" diff --git a/frameworks/deviceauth_lite/source/struct/sec_clone_data.c b/frameworks/deviceauth_lite/source/struct/sec_clone_data.c index 4dbfd5d..15ce1c3 100755 --- a/frameworks/deviceauth_lite/source/struct/sec_clone_data.c +++ b/frameworks/deviceauth_lite/source/struct/sec_clone_data.c @@ -16,7 +16,7 @@ #if (defined(_SUPPORT_SEC_CLONE_) || defined(_SUPPORT_SEC_CLONE_SERVER_)) #include -#include +#include "securec.h" #include "jsonutil.h" #include "commonutil.h" #include "exchange_auth_info.h" diff --git a/frameworks/deviceauth_lite/unittest/deviceauth_test.cpp b/frameworks/deviceauth_lite/unittest/deviceauth_test.cpp index 81002a9..f42b3e6 100644 --- a/frameworks/deviceauth_lite/unittest/deviceauth_test.cpp +++ b/frameworks/deviceauth_lite/unittest/deviceauth_test.cpp @@ -15,7 +15,7 @@ #include "deviceauth_test.h" #include -#include +#include "securec.h" #include "hichain.h" #define LOG(format, ...) (printf(format"\n", ##__VA_ARGS__)) @@ -54,7 +54,7 @@ static void Transmit(const struct session_identity *identity, const void *data, LOG("--------Transmit--------"); LOG("identity session_id[%d] package_name[%s]", identity->session_id, identity->package_name.name); LOG("data[%s]", (char *)data); - LOG("length[%d]", length); + LOG("length[%u]", length); LOG("--------Transmit--------"); } diff --git a/frameworks/inc/lite/ipc_callback_stub.h b/frameworks/inc/lite/ipc_callback_stub.h index 76a438b..5fbdaeb 100755 --- a/frameworks/inc/lite/ipc_callback_stub.h +++ b/frameworks/inc/lite/ipc_callback_stub.h @@ -25,7 +25,7 @@ extern "C" { typedef struct { SvcIdentity stubIdentity; - bool registed; + bool registered; } StubDevAuthCb; int32_t CbStubOnRemoteRequest(const IpcContext *ctx, void *ipcMsg, IpcIo *data, void *arg); diff --git a/frameworks/src/lite/ipc_adapt.c b/frameworks/src/lite/ipc_adapt.c index 6ca50d8..3b873b1 100644 --- a/frameworks/src/lite/ipc_adapt.c +++ b/frameworks/src/lite/ipc_adapt.c @@ -1392,8 +1392,8 @@ void SetCbCtxToDataCtx(uintptr_t callCtx, int32_t cbIdx) ProxyDevAuthData *dataCache = NULL; const SvcIdentity *stubInfo = &g_sdkCbStub.stubIdentity; (void)cbIdx; - if (!g_sdkCbStub.registed) { - LOGW("SDK callback stub un-registed"); + if (!g_sdkCbStub.registered) { + LOGW("SDK callback stub un-registered"); return; } ShowIpcSvcInfo(stubInfo); @@ -1661,7 +1661,7 @@ int32_t InitProxyAdapt(void) LOGI("get proxy instance success"); } - if (!g_sdkCbStub.registed) { + if (!g_sdkCbStub.registered) { ret = RegisterIpcCallback(CbStubOnRemoteRequest, 0, IPC_WAIT_FOREVER, &(g_sdkCbStub.stubIdentity), NULL); if (ret != 0) { LOGE("register ipc cb failed"); @@ -1669,7 +1669,7 @@ int32_t InitProxyAdapt(void) } ShowIpcSvcInfo(&(g_sdkCbStub.stubIdentity)); LOGI("register ipc cb success"); - g_sdkCbStub.registed = true; + g_sdkCbStub.registered = true; } return HC_SUCCESS; } @@ -1680,7 +1680,7 @@ void UnInitProxyAdapt(void) if (UnregisterIpcCallback(g_sdkCbStub.stubIdentity)) { LOGW("un-register ipc cb failed"); } - g_sdkCbStub.registed = false; + g_sdkCbStub.registered = false; return; } diff --git a/frameworks/src/lite/ipc_dev_auth_stub.c b/frameworks/src/lite/ipc_dev_auth_stub.c index 995e01e..1157a40 100644 --- a/frameworks/src/lite/ipc_dev_auth_stub.c +++ b/frameworks/src/lite/ipc_dev_auth_stub.c @@ -66,7 +66,7 @@ static int32_t BinderLiteProcess(SvcIdentity **svc, int32_t procType) (void)BinderRelease((*svc)->ipcContext, (*svc)->handle); break; default: - LOGW("internal error: unknow processing type"); + LOGW("internal error: unknown processing type"); } #endif return (ret == 0) ? HC_SUCCESS : HC_ERROR; diff --git a/interfaces/innerkits/device_auth_defines.h b/interfaces/innerkits/device_auth_defines.h index cbb677c..538b50a 100644 --- a/interfaces/innerkits/device_auth_defines.h +++ b/interfaces/innerkits/device_auth_defines.h @@ -140,7 +140,7 @@ enum { BAD_PAYLOAD = 0xF000000B, ALGORITHM_UNSUPPORTED = 0xF000000C, PROOF_MISMATCH = 0xF000000D, - UNKOWN = 0xF0000000, + UNKNOWN = 0xF0000000, }; #endif diff --git a/services/authenticators/src/account_unrelated/das_module.c b/services/authenticators/src/account_unrelated/das_module.c index ec1ddca..8487003 100644 --- a/services/authenticators/src/account_unrelated/das_module.c +++ b/services/authenticators/src/account_unrelated/das_module.c @@ -61,7 +61,7 @@ bool IsDasMsgNeedIgnore(const CJson *in) return false; } - LOGI("The message needs to ignore, message: %u.", message); + LOGI("The message needs to ignore, message: %d.", message); return true; } diff --git a/services/authenticators/src/account_unrelated/das_task_common.c b/services/authenticators/src/account_unrelated/das_task_common.c index b9e4b1c..e4dcb2d 100644 --- a/services/authenticators/src/account_unrelated/das_task_common.c +++ b/services/authenticators/src/account_unrelated/das_task_common.c @@ -402,12 +402,12 @@ int32_t GetAndCheckAuthIdPeer(const CJson *in, const Uint8Buff *authIdSelf, cons return HC_ERR_CONVERT_FAILED; } if ((authIdSelf->length == authIdPeer->length) && - memcmp(authIdSelf->val, authIdPeer->val, authIdSelf->length) == 0) { + memcmp(authIdSelf->val, authIdPeer->val, authIdSelf->length) == EOK) { LOGE("Peer id can not be equal to self id."); HcFree(authIdPeerTmp); return HC_ERR_INVALID_PARAMS; } - if (memcmp(authIdPeer->val, authIdPeerTmp, authIdPeer->length) != 0) { + if (memcmp(authIdPeer->val, authIdPeerTmp, authIdPeer->length) != EOK) { LOGE("Peer authId does not match."); HcFree(authIdPeerTmp); return HC_ERR_INVALID_PARAMS; diff --git a/services/data_manager/src/data_manager.c b/services/data_manager/src/data_manager.c index 186ba74..6c15b3f 100644 --- a/services/data_manager/src/data_manager.c +++ b/services/data_manager/src/data_manager.c @@ -127,10 +127,7 @@ static bool EndWithZero(HcParcel *parcel) if (p == NULL) { return false; } - if (*p == '\0') { - return true; - } - return false; + return (*p == '\0'); } static bool LoadStringVectorFromParcel(StringVector *vec, HcParcel *parcel) @@ -201,7 +198,7 @@ static bool GetOsAccountInfoPath(int32_t osAccountId, char *infoPath, uint32_t p { const char *beginPath = GetStorageDirPath(); if (beginPath == NULL) { - LOGE("[DB]: Failed to get the stroage path dir!"); + LOGE("[DB]: Failed to get the storage path dir!"); return false; } int32_t ret; @@ -424,13 +421,13 @@ static bool ReadParcelFromFile(int32_t osAccountId, HcParcel *parcel) } int fileSize = HcFileSize(file); if (fileSize <= 0) { - LOGE("[DB]: The databse file size is invalid!"); + LOGE("[DB]: The database file size is invalid!"); HcFileClose(file); return false; } char *fileData = (char *)HcMalloc(fileSize, 0); if (fileData == NULL) { - LOGE("[DB]: Failed to allocate fileData memroy!"); + LOGE("[DB]: Failed to allocate fileData memory!"); HcFileClose(file); return false; } @@ -697,16 +694,25 @@ static TrustedDeviceEntry **QueryDeviceEntryPtrIfMatch(const DeviceEntryVec *vec static void PostGroupCreatedMsg(const TrustedGroupEntry *groupEntry) { + if (!IsBroadcastSupported()) { + return; + } GetBroadcaster()->postOnGroupCreated(groupEntry); } static void PostGroupDeletedMsg(const TrustedGroupEntry *groupEntry) { + if (!IsBroadcastSupported()) { + return; + } GetBroadcaster()->postOnGroupDeleted(groupEntry); } static void PostDeviceBoundMsg(OsAccountTrustedInfo *info, const TrustedDeviceEntry *deviceEntry) { + if (!IsBroadcastSupported()) { + return; + } QueryGroupParams groupParams = InitQueryGroupParams(); groupParams.groupId = StringGet(&deviceEntry->groupId); TrustedGroupEntry **groupEntryPtr = QueryGroupEntryPtrIfMatch(&info->groups, &groupParams); @@ -717,11 +723,21 @@ static void PostDeviceBoundMsg(OsAccountTrustedInfo *info, const TrustedDeviceEn static void PostDeviceUnBoundMsg(OsAccountTrustedInfo *info, const TrustedDeviceEntry *deviceEntry) { + if (!IsBroadcastSupported()) { + return; + } + const char *groupId = StringGet(&deviceEntry->groupId); + const char *udid = StringGet(&deviceEntry->udid); QueryGroupParams groupParams = InitQueryGroupParams(); - groupParams.groupId = StringGet(&deviceEntry->groupId); + groupParams.groupId = groupId; TrustedGroupEntry **groupEntryPtr = QueryGroupEntryPtrIfMatch(&info->groups, &groupParams); if (groupEntryPtr != NULL) { - GetBroadcaster()->postOnDeviceUnBound(StringGet(&deviceEntry->udid), *groupEntryPtr); + GetBroadcaster()->postOnDeviceUnBound(udid, *groupEntryPtr); + } + QueryDeviceParams deviceParams = InitQueryDeviceParams(); + deviceParams.udid = udid; + if (QueryDeviceEntryPtrIfMatch(&info->devices, &deviceParams) == NULL) { + GetBroadcaster()->postOnDeviceNotTrusted(udid); } } @@ -1021,7 +1037,7 @@ int32_t QueryGroups(int32_t osAccountId, const QueryGroupParams *params, GroupEn continue; } if (vec->pushBackT(vec, newEntry) == NULL) { - LOGE("[DB]: Faild to push entry to vec!"); + LOGE("[DB]: Failed to push entry to vec!"); DestroyGroupEntry(newEntry); } } @@ -1053,7 +1069,7 @@ int32_t QueryDevices(int32_t osAccountId, const QueryDeviceParams *params, Devic continue; } if (vec->pushBackT(vec, newEntry) == NULL) { - LOGE("[DB]: Faild to push entry to vec!"); + LOGE("[DB]: Failed to push entry to vec!"); DestroyDeviceEntry(newEntry); } } diff --git a/services/group_auth/src/session/auth_session/auth_session_util.c b/services/group_auth/src/session/auth_session/auth_session_util.c index 3122111..b4a1c97 100644 --- a/services/group_auth/src/session/auth_session/auth_session_util.c +++ b/services/group_auth/src/session/auth_session/auth_session_util.c @@ -90,7 +90,7 @@ int32_t GetInfoHash(const uint8_t *info, uint32_t infoLen, char *str, uint32_t s } int32_t res; do { - if (memcpy_s(message.val, message.length, info, infoLen) != HC_SUCCESS) { + if (memcpy_s(message.val, message.length, info, infoLen) != EOK) { LOGE("Failed to copy data!"); res = HC_ERR_ALLOC_MEMORY; break; diff --git a/services/group_manager/src/channel_manager/soft_bus_channel/soft_bus_channel.c b/services/group_manager/src/channel_manager/soft_bus_channel/soft_bus_channel.c index d260de9..e4aae3e 100644 --- a/services/group_manager/src/channel_manager/soft_bus_channel/soft_bus_channel.c +++ b/services/group_manager/src/channel_manager/soft_bus_channel/soft_bus_channel.c @@ -62,7 +62,7 @@ static int32_t AddChannelEntry(int64_t requestId, int64_t channelId) { int64_t tmpReqId = DEFAULT_REQUEST_ID; if (GetReqIdByChannelId(channelId, &tmpReqId) == HC_SUCCESS) { - LOGE("A request to use the channel alreay exists!"); + LOGE("A request to use the channel already exists!"); return HC_ERR_REQUEST_EXIST; } ChannelEntry entry = { @@ -149,7 +149,7 @@ static char *GenRecvData(int64_t channelId, const void *data, uint32_t dataLen, static bool IsServer(int sessionId) { - return (GetSessionSide(sessionId) == 0) ? true : false; + return GetSessionSide(sessionId) == 0; } static int OnChannelOpenedCb(int sessionId, int result) 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 117f124..491c843 100644 --- a/services/group_manager/src/group_operation/group_operation_common.c +++ b/services/group_manager/src/group_operation/group_operation_common.c @@ -998,7 +998,7 @@ int32_t ProcessKeyPair(int action, const CJson *jsonParams, const char *groupId) LOGE("Failed to allocate authIdBuff memory!"); return HC_ERR_ALLOC_MEMORY; } - if (memcpy_s(authIdBuff.val, authIdBuff.length, authId, authIdBuff.length) != HC_SUCCESS) { + if (memcpy_s(authIdBuff.val, authIdBuff.length, authId, authIdBuff.length) != EOK) { LOGE("Failed to copy authId!"); HcFree(authIdBuff.val); return HC_ERR_MEMORY_COPY;