diff --git a/device_attest_lite/framework/mini/src/attest_framework_client_mini.c b/device_attest_lite/framework/mini/src/attest_framework_client_mini.c index eee9b2e864af54b592940776a059e917ccfe3873..5ea5335d371dfb20e152dc13eb056b85089b6164 100644 --- a/device_attest_lite/framework/mini/src/attest_framework_client_mini.c +++ b/device_attest_lite/framework/mini/src/attest_framework_client_mini.c @@ -24,7 +24,7 @@ int32_t StartDevAttestTask(void) attr.stack_size = LITEOS_M_STACK_SIZE; attr.priority = osPriorityNormal; attr.name = ATTEST_TASK_THREAD_NAME; - if (osThreadNew((osThreadFunc_t)DevAttestTask, NULL, &attr) == NULL) { + if (osThreadNew((osThreadFunc_t)AttestTask, NULL, &attr) == NULL) { return DEVATTEST_FAIL; } return DEVATTEST_SUCCESS; diff --git a/device_attest_lite/framework/small/src/service/attest_framework_feature.c b/device_attest_lite/framework/small/src/service/attest_framework_feature.c index 840bf52a374a1f2cbe03051106fc2dd6e2232bb5..f6b415fb3601098e69c47d8e0adb99945ef8fee3 100644 --- a/device_attest_lite/framework/small/src/service/attest_framework_feature.c +++ b/device_attest_lite/framework/small/src/service/attest_framework_feature.c @@ -149,7 +149,7 @@ static int32_t Invoke(IServerProxy *iProxy, int funcId, void *origin, IpcIo *req int32_t ret = DEVATTEST_SUCCESS; switch (funcId) { case ATTEST_FRAMEWORK_MSG_PROC: - DevAttestTask(); + AttestTask(); WriteInt32(reply, DEVATTEST_SUCCESS); break; case ATTEST_FRAMEWORK_MSG_QUERY: diff --git a/device_attest_lite/services/core/adapter/attest_adapter_mock.c b/device_attest_lite/services/core/adapter/attest_adapter_mock.c index 7ac13f9249ca7ae9a17f51616ba4dad6f8d99ab6..a749e0cf22361881ce10bfec4dfa90eafc016548 100644 --- a/device_attest_lite/services/core/adapter/attest_adapter_mock.c +++ b/device_attest_lite/services/core/adapter/attest_adapter_mock.c @@ -64,7 +64,7 @@ int32_t SendChallMsgStub(ATTEST_ACTION_TYPE actionType, char** respMsg) return ret; } -int32_t SendAttestMsgStub(ATTEST_ACTION_TYPE actionType, char **respMsg) +int32_t SendDevAttestStub(ATTEST_ACTION_TYPE actionType, char **respMsg) { if (respMsg == NULL || actionType >= ATTEST_ACTION_MAX) { return ATTEST_ERR; diff --git a/device_attest_lite/services/core/attest/attest_service.c b/device_attest_lite/services/core/attest/attest_service.c index e5b40e6912c529a85c3e318a99092dc4a1bfe9ea..914d5bb263fdeb48bf2fc2c2b397ffad64ac79fa 100644 --- a/device_attest_lite/services/core/attest/attest_service.c +++ b/device_attest_lite/services/core/attest/attest_service.c @@ -30,6 +30,7 @@ #include "attest_service_challenge.h" #include "attest_network.h" #include "attest_service.h" +#include "attest_service_device.h" pthread_mutex_t g_mtxAttest = PTHREAD_MUTEX_INITIALIZER; @@ -153,7 +154,7 @@ static int32_t ActiveToken(AuthResult* authResult) ATTEST_LOG_ERROR("[ActiveToken] Invalid parameter"); return ATTEST_ERR; } - ATTEST_LOG_DEBUG("[ActiveToken] Flush token begin."); + int32_t ret = FlushToken(authResult); if (ret != ATTEST_OK) { ATTEST_LOG_ERROR("[ActiveToken] Flush Token failed, ret = %d.", ret); @@ -198,7 +199,7 @@ static int32_t ActiveToken(AuthResult* authResult) static int32_t ProcAttestImpl(void) { - ATTEST_LOG_DEBUG("[ProcAttestImpl] Proc begin."); + ATTEST_LOG_DEBUG("[ProcAttestImpl] Proc attest begin."); int32_t ret = InitSysData(); // 初始化系统参数 if (ret != ATTEST_OK) { @@ -269,7 +270,7 @@ static int32_t ProcAttestImpl(void) // 结果保存到启动子系统parameter,方便展示 ret = FlushAttestStatusPara(authResult->authStatus); if (ret != ATTEST_OK) { - ATTEST_LOG_ERROR("[ProcAttestImpl] Flush para failed, ret = %d.", ret); + ATTEST_LOG_ERROR("[ProcAttestImpl] Flush attest para failed, ret = %d.", ret); } ret = GetAttestStatusPara(); if (ret != ATTEST_OK) { @@ -318,7 +319,7 @@ int32_t ProcAttest(void) static int32_t QueryAttestStatusImpl(int32_t* authResult, int32_t* softwareResult, char** ticket) { - ATTEST_LOG_DEBUG("[QueryAttestStatusImpl] Query status begin."); + ATTEST_LOG_DEBUG("[QueryAttestStatusImpl] Query attest status begin."); if (authResult == NULL || softwareResult == NULL || ticket == NULL) { return ATTEST_ERR; } diff --git a/device_attest_lite/services/core/attest/attest_service_active.c b/device_attest_lite/services/core/attest/attest_service_active.c index aa60ebd3a8de79380c82ca4bca15924f1e7e8f09..5023bb6abea4f8d27d135e34d4c1f8bc197b9066 100644 --- a/device_attest_lite/services/core/attest/attest_service_active.c +++ b/device_attest_lite/services/core/attest/attest_service_active.c @@ -20,10 +20,10 @@ #include "attest_dfx.h" #include "attest_security.h" #include "attest_service_device.h" -#include "attest_security_token.h" #include "attest_network.h" #include "attest_adapter_mock.h" #include "attest_service_active.h" +#include "attest_security_token.h" int32_t GenActiveMsg(AuthResult* authResult, const ChallengeResult* challengeResult, DevicePacket** devPacket) { @@ -76,7 +76,7 @@ int32_t SendActiveMsg(const DevicePacket* devicePacket, char** respMsg) { ATTEST_LOG_DEBUG("[SendActiveMsg] Begin."); if (ATTEST_MOCK_NETWORK_STUB_FLAG) { - return SendAttestMsgStub(ATTEST_ACTION_ACTIVATE, respMsg); + return SendDevAttestStub(ATTEST_ACTION_ACTIVATE, respMsg); } if (devicePacket == NULL || respMsg == NULL) { ATTEST_LOG_ERROR("[SendActiveMsg] Input paramter is null."); @@ -85,7 +85,7 @@ int32_t SendActiveMsg(const DevicePacket* devicePacket, char** respMsg) char* recvMsg = NULL; uint32_t ret = SendAttestMsg(devicePacket, ATTEST_ACTION_ACTIVATE, &recvMsg); if (ret != ATTEST_OK) { - ATTEST_LOG_ERROR("[SendActiveMsg] Send Msg failed."); + ATTEST_LOG_ERROR("[SendActiveMsg] Send AttestMsg failed."); return ATTEST_ERR; } *respMsg = recvMsg; diff --git a/device_attest_lite/services/core/attest/attest_service_auth.c b/device_attest_lite/services/core/attest/attest_service_auth.c index 360a510122dbaaaff99d4d33f4987f21dcf24e5f..b0dff272cd183fc91422fd609f17febb9ceccfd1 100644 --- a/device_attest_lite/services/core/attest/attest_service_auth.c +++ b/device_attest_lite/services/core/attest/attest_service_auth.c @@ -369,7 +369,7 @@ int32_t CheckVersionChanged(AuthStatus* authStatus) } char* versionIdFromOs = AttestGetVersionId(); if (versionIdFromOs == NULL) { - ATTEST_LOG_ERROR("[CheckVersionChanged] GetVersionId fail"); + ATTEST_LOG_ERROR("[CheckVersionChanged] Attest GetVersionId is null"); return ATTEST_ERR; } @@ -710,7 +710,7 @@ int32_t SendAuthMsg(const DevicePacket* devicePacket, char** respMsg) { ATTEST_LOG_DEBUG("[SendAuthMsg] Begin."); if (ATTEST_MOCK_NETWORK_STUB_FLAG) { - return SendAttestMsgStub(ATTEST_ACTION_AUTHORIZE, respMsg); + return SendDevAttestStub(ATTEST_ACTION_AUTHORIZE, respMsg); } if (devicePacket == NULL || respMsg == NULL) { ATTEST_LOG_ERROR("[SendAuthMsg] Invalid parameter"); @@ -719,7 +719,7 @@ int32_t SendAuthMsg(const DevicePacket* devicePacket, char** respMsg) char* recvMsg = NULL; uint32_t ret = SendAttestMsg(devicePacket, ATTEST_ACTION_AUTHORIZE, &recvMsg); if (ret != ATTEST_OK) { - ATTEST_LOG_ERROR("[SendAuthMsg] Send Msg failed"); + ATTEST_LOG_ERROR("[SendAuthMsg] Send AttestMsg failed"); return ATTEST_ERR; } *respMsg = recvMsg; diff --git a/device_attest_lite/services/core/attest/attest_service_challenge.c b/device_attest_lite/services/core/attest/attest_service_challenge.c index 2215ca97938c52caea03661882bfaf7064fe0fa1..205b5c5190db68d7038555618d0bb0048f2f038f 100644 --- a/device_attest_lite/services/core/attest/attest_service_challenge.c +++ b/device_attest_lite/services/core/attest/attest_service_challenge.c @@ -72,7 +72,7 @@ static int32_t SendChallMsg(const DevicePacket* devicePacket, char** respMsg, AT char* recvMsg = NULL; uint32_t ret = SendAttestMsg(devicePacket, ATTEST_ACTION_CHALLENGE, &recvMsg); if (ret != ATTEST_OK) { - ATTEST_LOG_ERROR("[SendChallMsg] Send Msg failed"); + ATTEST_LOG_ERROR("[SendChallMsg] Send AttestMsg failed"); return ATTEST_ERR; } *respMsg = recvMsg; diff --git a/device_attest_lite/services/core/attest/attest_service_reset.c b/device_attest_lite/services/core/attest/attest_service_reset.c index 886348fbc3cd1e5212fd010ae04b3aa8d0a7cfe6..23fefaebce972dd9d621ee944f02f1f3d85bb9c8 100644 --- a/device_attest_lite/services/core/attest/attest_service_reset.c +++ b/device_attest_lite/services/core/attest/attest_service_reset.c @@ -63,7 +63,7 @@ int32_t SendResetMsg(const DevicePacket* devicePacket, char** respMsg) { ATTEST_LOG_DEBUG("[SendResetMsg] Begin."); if (ATTEST_MOCK_NETWORK_STUB_FLAG) { - return SendAttestMsgStub(ATTEST_ACTION_RESET, respMsg); + return SendDevAttestStub(ATTEST_ACTION_RESET, respMsg); } if (devicePacket == NULL || respMsg == NULL) { ATTEST_LOG_ERROR("[SendResetMsg] Invalid parameter"); @@ -72,7 +72,7 @@ int32_t SendResetMsg(const DevicePacket* devicePacket, char** respMsg) char* recvMsg = NULL; uint32_t ret = SendAttestMsg(devicePacket, ATTEST_ACTION_RESET, &recvMsg); if (ret != ATTEST_OK) { - ATTEST_LOG_ERROR("[SendResetMsg] Send Msg failed"); + ATTEST_LOG_ERROR("[SendResetMsg] Send AttestMsg failed"); return ATTEST_ERR; } *respMsg = recvMsg; diff --git a/device_attest_lite/services/core/attest_entry.c b/device_attest_lite/services/core/attest_entry.c index ea4eab3dc9cd181d7a3198b814353e01caf92ec7..412514dd8ff7b0090574df14d886fea0c6fb13d6 100644 --- a/device_attest_lite/services/core/attest_entry.c +++ b/device_attest_lite/services/core/attest_entry.c @@ -39,7 +39,7 @@ static int CreateAttestThread(void(*run)(void *), void *argv, const char *name, return ATTEST_OK; } -static void AttestTask(void *argv) +static void AttestTaskThread(void *argv) { AttestTaskCallback cb = (AttestTaskCallback)argv; cb(); @@ -57,7 +57,7 @@ static void AttestAuthCallBack(void *argv) } g_ProcAttestTimerId = NULL; } - if (CreateAttestThread(AttestTask, (void *)ProcAttest, ATTEST_CALLBACK_THREAD_NAME, g_ProcAttestTimerId) != ATTEST_OK) { + if (CreateAttestThread(AttestTaskThread, (void *)ProcAttest, ATTEST_CALLBACK_THREAD_NAME, g_ProcAttestTimerId) != ATTEST_OK) { ATTEST_LOG_ERROR("[AttestAuthCallBack] CreateAttestThread return failed"); } return; @@ -74,24 +74,21 @@ static void AttestAuthCallBack(void *argv) } #endif - -int32_t DevAttestTask(void) +int32_t AttestTask(void) { - ATTEST_LOG_INFO("[DevAttestTask] Begin."); - + ATTEST_LOG_INFO("[AttestTask] Begin."); // 执行主流程代码 int32_t ret = ProcAttest(); if (ret != ATTEST_OK) { - ATTEST_LOG_ERROR("[DevAttestTask] Proc failed ret = %d.", ret); + ATTEST_LOG_ERROR("[AttestTask] Proc failed ret = %d.", ret); } // 创建主流程定时器 ret = AttestCreateTimerTask(ATTEST_TIMER_TYPE_PERIOD, EXPIRED_INTERVAL, &AttestAuthCallBack, NULL, &g_ProcAttestTimerId); - if (ret != ATTEST_OK) { - ATTEST_LOG_ERROR("[DevAttestTask] Create Periodic TimerTask return ret = %d.", ret); + ATTEST_LOG_ERROR("[AttestTask] Create Periodic TimerTask return ret = %d.", ret); } - ATTEST_LOG_INFO("[DevAttestTask] End."); + ATTEST_LOG_INFO("[AttestTask] End."); return ret; } diff --git a/device_attest_lite/services/core/attest_entry.h b/device_attest_lite/services/core/attest_entry.h index 941eade4f3f5b55af2fc413018d117b7570b8c16..3545e0ec883ed9679b36d7babec7e467f4291038 100644 --- a/device_attest_lite/services/core/attest_entry.h +++ b/device_attest_lite/services/core/attest_entry.h @@ -34,7 +34,7 @@ extern "C" { #define ATTEST_CALLBACK_THREAD_NAME "AttestAuth" -int32_t DevAttestTask(void); +int32_t AttestTask(void); int32_t QueryAttest(int32_t* authResult, int32_t* softwareResult, char** ticket); diff --git a/device_attest_lite/services/core/include/adapter/attest_adapter_mock.h b/device_attest_lite/services/core/include/adapter/attest_adapter_mock.h index 5e16844131b54f75829f1937c22d3683f1ef5cfd..012a3308ada877a04c236e1cf793fa313bdaf8c9 100644 --- a/device_attest_lite/services/core/include/adapter/attest_adapter_mock.h +++ b/device_attest_lite/services/core/include/adapter/attest_adapter_mock.h @@ -16,8 +16,6 @@ #ifndef ATTEST_ADAPTER_MOCK_H #define ATTEST_ADAPTER_MOCK_H -#include "attest_type.h" - #ifdef __cplusplus #if __cplusplus extern "C" { @@ -52,7 +50,7 @@ extern "C" { int32_t SendChallMsgStub(ATTEST_ACTION_TYPE actionType, char** respMsg); -int32_t SendAttestMsgStub(ATTEST_ACTION_TYPE actionType, char** respMsg); +int32_t SendDevAttestStub(ATTEST_ACTION_TYPE actionType, char** respMsg); char* OsGetVersionIdStub(void); diff --git a/device_attest_lite/services/core/include/attest_error_code.h b/device_attest_lite/services/core/include/attest_error.h similarity index 100% rename from device_attest_lite/services/core/include/attest_error_code.h rename to device_attest_lite/services/core/include/attest_error.h diff --git a/device_attest_lite/services/core/include/attest_type.h b/device_attest_lite/services/core/include/attest_type.h index c84d46066de2e4f52b4b7711783651dbd19dfd5b..7f0589060ffe45a2a718f7a39b6f53e4933af334 100644 --- a/device_attest_lite/services/core/include/attest_type.h +++ b/device_attest_lite/services/core/include/attest_type.h @@ -27,7 +27,7 @@ #include "cJSON.h" #include "limits.h" #include "securec.h" -#include "attest_error_code.h" +#include "attest_error.h" #ifdef __cplusplus #if __cplusplus diff --git a/device_attest_lite/services/core/include/utils/attest_utils_log.h b/device_attest_lite/services/core/include/utils/attest_utils_log.h index 73ebcfe1752ed557694857d66ce44c92cc988cef..c9e8f93afd7a2fc162515dc835bcfd37f6d883bb 100644 --- a/device_attest_lite/services/core/include/utils/attest_utils_log.h +++ b/device_attest_lite/services/core/include/utils/attest_utils_log.h @@ -34,7 +34,7 @@ typedef enum { #define ATTEST_LOG_STR_LEM 256 -#define ATTESTLOG_LABEL "ATTEST" +#define ATTESTLOG_LABEL "DEVATTEST" void AttestLog(AttestLogLevel logLevel, const char* fmt, ...); diff --git a/device_attest_lite/services/core/network/attest_tls.c b/device_attest_lite/services/core/network/attest_tls.c index a1e3e6e828291d5a3b4b04d29c86698ba8c7364b..fd5db072c40800a9fce0d5433887fa069123d929 100644 --- a/device_attest_lite/services/core/network/attest_tls.c +++ b/device_attest_lite/services/core/network/attest_tls.c @@ -14,7 +14,7 @@ */ #include "attest_utils_log.h" -#include "attest_error_code.h" +#include "attest_error.h" #include "attest_tls.h" const unsigned char GLOBALSIGN_ROOT_CA_R3_DER[] = { diff --git a/device_attest_lite/services/core/security/attest_security.c b/device_attest_lite/services/core/security/attest_security.c index 9d94d62d2c4f3a9a818168e744329d75cabdadad..296135580743d420a2bf0e7b2545969559431461 100644 --- a/device_attest_lite/services/core/security/attest_security.c +++ b/device_attest_lite/services/core/security/attest_security.c @@ -15,7 +15,7 @@ #include #include "securec.h" -#include "attest_error_code.h" +#include "attest_error.h" #include "attest_adapter.h" #include "attest_utils.h" #include "attest_utils_log.h" @@ -78,6 +78,9 @@ void GetSalt(uint8_t* salt, uint32_t saltLen) } // temp右移8bits salt[i] = (uint8_t)((temp >> ((i % randomNumBytes) * offsetBits)) & 0xff); + if (salt[i] == 0) { + salt[i]++; + } } } diff --git a/device_attest_lite/services/core/security/attest_security_ticket.c b/device_attest_lite/services/core/security/attest_security_ticket.c index ce36d5ddff924acf5c3d7b49785868e23422035e..8633067be52197650db96050532b4f0c0ad8e771 100644 --- a/device_attest_lite/services/core/security/attest_security_ticket.c +++ b/device_attest_lite/services/core/security/attest_security_ticket.c @@ -15,7 +15,7 @@ #include #include "securec.h" -#include "attest_error_code.h" +#include "attest_error.h" #include "attest_adapter.h" #include "attest_utils_log.h" #include "attest_security.h" diff --git a/device_attest_lite/services/core/security/attest_security_token.c b/device_attest_lite/services/core/security/attest_security_token.c index 8d726dcf1765c9c58ed122fd573d2006fae8bd12..e133145ff7c67edaac1bb8ac16e9c7bf52adcedb 100644 --- a/device_attest_lite/services/core/security/attest_security_token.c +++ b/device_attest_lite/services/core/security/attest_security_token.c @@ -15,7 +15,7 @@ #include #include "securec.h" -#include "attest_error_code.h" +#include "attest_error.h" #include "attest_adapter.h" #include "attest_utils_log.h" #include "attest_dfx.h" diff --git a/device_attest_lite/services/core/utils/attest_utils.c b/device_attest_lite/services/core/utils/attest_utils.c index 590e89c2793ee4c8147a8b185963bea4c7e32e2a..6b75e8b86b421eddf5698a47293d3c21fe24ddff 100644 --- a/device_attest_lite/services/core/utils/attest_utils.c +++ b/device_attest_lite/services/core/utils/attest_utils.c @@ -23,7 +23,6 @@ #include "attest_utils_memleak.h" #include "attest_utils.h" -#define HEX_LEN_PER_BYTE 2 // 16进制1字节占用长度 #define DEV_BUF_LENGTH 3 #define HASH_LENGTH 32 diff --git a/device_attest_lite/services/core/utils/attest_utils_file.c b/device_attest_lite/services/core/utils/attest_utils_file.c index f13d8ad010269d32fe5113a7cd9f3dd043830fb9..413b8215a143f295d461d388657a62ec64df7ad4 100644 --- a/device_attest_lite/services/core/utils/attest_utils_file.c +++ b/device_attest_lite/services/core/utils/attest_utils_file.c @@ -182,18 +182,18 @@ int32_t GetFileSize(const char* path, const char* fileName, uint32_t* result) char* formatPath = realpath(filePath, NULL); ATTEST_MEM_FREE(filePath); if (formatPath == NULL) { - ATTEST_LOG_ERROR("[GetFileSize] Invalid path"); + ATTEST_LOG_ERROR("[GetFileSize] Invalid path of %s", path); return ATTEST_ERR; } FILE* fp = fopen(formatPath, "r"); if (fp == NULL) { - ATTEST_LOG_ERROR("[GetFileSize] open file failed"); + ATTEST_LOG_ERROR("[GetFileSize] open file %s failed", formatPath); free(formatPath); return ATTEST_ERR; } if (fseek(fp, 0, SEEK_END) < 0) { - ATTEST_LOG_ERROR("[GetFileSize] seek file failed"); + ATTEST_LOG_ERROR("[GetFileSize] seek file %s failed", formatPath); free(formatPath); (void)fclose(fp); return ATTEST_ERR; @@ -220,13 +220,13 @@ int32_t WriteFile(const char* path, const char* fileName, const char* data, uint char* formatPath = realpath(filePath, NULL); ATTEST_MEM_FREE(filePath); if (formatPath == NULL) { - ATTEST_LOG_ERROR("[WriteFile] Invalid path"); + ATTEST_LOG_ERROR("[WriteFile] Invalid path of %s", path); return ATTEST_ERR; } FILE* fp = fopen(formatPath, "wb+"); if (fp == NULL) { - ATTEST_LOG_ERROR("[WriteFile] open file failed"); + ATTEST_LOG_ERROR("[WriteFile] open file %s failed", formatPath); free(formatPath); return ATTEST_ERR; } @@ -236,7 +236,7 @@ int32_t WriteFile(const char* path, const char* fileName, const char* data, uint return ATTEST_ERR; } if (fwrite(data, dataLen, 1, fp) != 1) { - ATTEST_LOG_ERROR("[WriteFile] write file failed"); + ATTEST_LOG_ERROR("[WriteFile] write file %s failed", formatPath); free(formatPath); (void)fclose(fp); return ATTEST_ERR; @@ -268,18 +268,18 @@ int32_t ReadFile(const char* path, const char* fileName, char* buffer, uint32_t char* formatPath = realpath(filePath, NULL); ATTEST_MEM_FREE(filePath); if (formatPath == NULL) { - ATTEST_LOG_ERROR("[ReadFile] Invalid path or file not exist"); + ATTEST_LOG_ERROR("[ReadFile] Invalid path of %s or file %s not exist", path, fileName); return ATTEST_ERR; } FILE* fp = fopen(formatPath, "rb"); if (fp == NULL) { - ATTEST_LOG_ERROR("[ReadFile] open file failed"); + ATTEST_LOG_ERROR("[ReadFile] open file %s failed", formatPath); free(formatPath); return ATTEST_ERR; } if (fread(buffer, fileSize, 1, fp) != 1) { - ATTEST_LOG_ERROR("[ReadFile] read file data from device failed"); + ATTEST_LOG_ERROR("[ReadFile] read file %s data from device failed", formatPath); free(formatPath); (void)fclose(fp); return ATTEST_ERR; @@ -297,7 +297,7 @@ int32_t CreateFile(const char* path, const char* fileName) char* formatPath = realpath(path, NULL); if (formatPath == NULL) { - ATTEST_LOG_ERROR("[CreateFile] Invalid path or file not exist"); + ATTEST_LOG_ERROR("[CreateFile] Invalid path of %s or file %s not exist", path, fileName); return ATTEST_ERR; } uint32_t realPathLen = strlen(formatPath) + 1 + strlen(fileName) + 1; @@ -326,22 +326,20 @@ int32_t CreateFile(const char* path, const char* fileName) return ATTEST_OK; } -bool IsFileExist(const char* path, const char* fileName) +bool IsFileExist(const char* path, const char* fileName) { if (path == NULL || fileName == NULL) { return false; } - char* filePath = GenFilePath(path, fileName); if (filePath == NULL) { ATTEST_LOG_ERROR("[IsFileExist] Generate file path failed"); return false; } - char* formatPath = realpath(filePath, NULL); ATTEST_MEM_FREE(filePath); if (formatPath == NULL) { - ATTEST_LOG_ERROR("[IsFileExist] Invalid path or file not exist"); + ATTEST_LOG_ERROR("[IsFileExist] Invalid path of %s or file %s not exist", path, fileName); return false; } diff --git a/device_attest_lite/services/core/utils/attest_utils_list.c b/device_attest_lite/services/core/utils/attest_utils_list.c index 27555dceb1b700c815146384bb9619b1372ec918..7408e02f2d9970457f0fe03d4ac9bbfd4b8d8ac1 100644 --- a/device_attest_lite/services/core/utils/attest_utils_list.c +++ b/device_attest_lite/services/core/utils/attest_utils_list.c @@ -16,7 +16,7 @@ #include #include #include "string.h" -#include "attest_error_code.h" +#include "attest_error.h" #include "attest_utils.h" #include "attest_utils_list.h" diff --git a/device_attest_lite/services/core/utils/attest_utils_log.c b/device_attest_lite/services/core/utils/attest_utils_log.c index d4c62e6bedcf20e1fbb46ef9ac08ed693e6aca38..54b2f3ba68838dfd05d59e1f7a34cf624aed8215 100644 --- a/device_attest_lite/services/core/utils/attest_utils_log.c +++ b/device_attest_lite/services/core/utils/attest_utils_log.c @@ -106,7 +106,7 @@ void AttestLogAnonyStr(AttestLogLevel logLevel, const char* fmt, const char* str ret = sprintf_s(outStr, sizeof(outStr), fmt, strDup); ATTEST_MEM_FREE(strDup); if (ret < 0) { - AttestLogPrint(logLevel, "[AttestLogAnonyStr] anony str length error."); + AttestLogPrint(logLevel, "[AttestLogAnonyStr] Attest anony str length error."); return; } AttestLogPrint(logLevel, outStr); diff --git a/device_attest_lite/test/data/tokenA b/device_attest_lite/test/data/tokenA new file mode 100644 index 0000000000000000000000000000000000000000..a2582ff028d1012c48c433b44f02cd9576c0f6c3 --- /dev/null +++ b/device_attest_lite/test/data/tokenA @@ -0,0 +1 @@ +6PkCJZDsUfuqqdvxTLv8ZH+FqASsUInUV4y9IPLHtPyJt0v0RrwtVaLHpEunfMjD,yCbOb5Y3M4sgXEqhyTqIXwDl4JEWTmEfWr3Vov0NamgsBmzMCHXsM4xH3pNT+ZMd,XXoIPrlEu6EV+/rI,1000 \ No newline at end of file