diff --git a/security_lite/huks/common/hks_test_cipher.c b/security_lite/huks/common/hks_test_cipher.c index 7d6d57ff22e50ff5eed6528ca9de0c2ab1036975..4a3e23c409c7925c6407ccf2448825eeffcd7d5c 100644 --- a/security_lite/huks/common/hks_test_cipher.c +++ b/security_lite/huks/common/hks_test_cipher.c @@ -593,7 +593,7 @@ int32_t BaseTestCipher(uint32_t times, uint32_t index, uint32_t performTimes) g_testCipherParams[index].genKeyParamSetParams.keyStorageFlag == HKS_STORAGE_TEMP) { ret = GenerateLocalRandomKey(&keyAlias, &g_testCipherParams[index].localKeyParams); } else { - ret = GenerateKey(&keyAlias, &g_testCipherParams[index].keyAliasParams, + ret = HuksGenerateKey(&keyAlias, &g_testCipherParams[index].keyAliasParams, &g_testCipherParams[index].genKeyParamSetParams, &g_testCipherParams[index].genKeyParamSetParamsOut); } HKS_TEST_ASSERT(ret == 0); @@ -648,7 +648,7 @@ int32_t BaseTestEncrypt(uint32_t times, uint32_t index, uint32_t performTimes) ret = GenerateLocalRandomKey(&keyAlias, &g_testEncryptParams[index].localKeyParams); } else { if (g_testEncryptParams[index].keyAliasParams.blobExist) { - ret = GenerateKey(&keyAlias, &g_testEncryptParams[index].keyAliasParams, + ret = HuksGenerateKey(&keyAlias, &g_testEncryptParams[index].keyAliasParams, &g_testEncryptParams[index].genKeyParamSetParams, NULL); } else { ret = TestConstuctBlob(&keyAlias, @@ -700,7 +700,7 @@ int32_t BaseTestDecrypt(uint32_t times, uint32_t index, uint32_t performTimes) ret = GenerateLocalRandomKey(&keyAlias, &g_testDecryptParams[index].localKeyParams); } else { if (g_testDecryptParams[index].keyAliasParams.blobExist) { - ret = GenerateKey(&keyAlias, &g_testDecryptParams[index].keyAliasParams, + ret = HuksGenerateKey(&keyAlias, &g_testDecryptParams[index].keyAliasParams, &g_testDecryptParams[index].genKeyParamSetParams, NULL); } else { ret = TestConstuctBlob(&keyAlias, diff --git a/security_lite/huks/common/hks_test_common.c b/security_lite/huks/common/hks_test_common.c index 208c962254e22fc3ceb0242e9863251ae12edc77..0201c60c81b469999c7686769a1564d2b918728b 100644 --- a/security_lite/huks/common/hks_test_common.c +++ b/security_lite/huks/common/hks_test_common.c @@ -551,7 +551,7 @@ int32_t TestConstructHashParamSet( return ret; } -int32_t GenerateKey(struct HksBlob **keyAlias, const struct HksTestBlobParams *keyAliasParams, +int32_t HuksGenerateKey(struct HksBlob **keyAlias, const struct HksTestBlobParams *keyAliasParams, const struct HksTestGenKeyParamsParamSet *genKeyParamSetParams, const struct HksTestGenKeyParamsParamSetOut *genKeyParamSetParamsOut) { diff --git a/security_lite/huks/common/hks_test_file_operator.c b/security_lite/huks/common/hks_test_file_operator.c index 178ebc6a25893877a6bbf80522297ae0ce0ce4d5..7883562d65c4e5d3f84bf2b029066b0a74225446 100644 --- a/security_lite/huks/common/hks_test_file_operator.c +++ b/security_lite/huks/common/hks_test_file_operator.c @@ -185,7 +185,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui { /* now offset is 0, but we maybe extend hi1131 file interfaces in the future */ if (offset != 0) { - return HKS_ERROR_INVALID_ARGUMENT; + return (uint32_t)HKS_ERROR_INVALID_ARGUMENT; } unsigned int fileSize; @@ -206,7 +206,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui return 0; } - ret = UtilsFileRead(fd, buf, len); + ret = UtilsFileRead(fd, (char *)buf, len); UtilsFileClose(fd); if (ret < 0) { HKS_TEST_LOG_E("failed to read file, errno = 0x%x", ret); @@ -229,7 +229,7 @@ static int32_t FileWrite(const char *fileName, uint32_t offset, const uint8_t *b return HKS_ERROR_OPEN_FILE_FAIL; } - int32_t ret = UtilsFileWrite(fd, buf, len); + int32_t ret = UtilsFileWrite(fd, (char const *)buf, len); if (ret < 0) { HKS_TEST_LOG_E("failed to write key file, errno = 0x%x\n", ret); ret = HKS_ERROR_WRITE_FILE_FAIL; diff --git a/security_lite/huks/liteos_a_adapter/hks_derive_test.cpp b/security_lite/huks/liteos_a_adapter/hks_derive_test.cpp index 2f0f33a8fabec402ea5825e4b2457ddade5395ce..feb8f21a674bf57b2416619118d3a73050083436 100644 --- a/security_lite/huks/liteos_a_adapter/hks_derive_test.cpp +++ b/security_lite/huks/liteos_a_adapter/hks_derive_test.cpp @@ -154,7 +154,7 @@ static int32_t BaseTestDerive(uint32_t index) ret = GenerateLocalRandomKey(&keyAlias, &g_testDeriveParams[index].localKeyParams); } else { if (g_testDeriveParams[index].keyAliasParams.blobExist) { - ret = GenerateKey(&keyAlias, &g_testDeriveParams[index].keyAliasParams, + ret = HuksGenerateKey(&keyAlias, &g_testDeriveParams[index].keyAliasParams, &g_testDeriveParams[index].genKeyParamSetParams, NULL); } else { ret = TestConstuctBlob(&keyAlias, diff --git a/security_lite/huks/liteos_a_adapter/hks_mac_test.cpp b/security_lite/huks/liteos_a_adapter/hks_mac_test.cpp index 30f5fa6b7acbd743e1969b887464594c0aacdc6b..7b60bf077a057e43c5a504bebc4138bd16e12b95 100644 --- a/security_lite/huks/liteos_a_adapter/hks_mac_test.cpp +++ b/security_lite/huks/liteos_a_adapter/hks_mac_test.cpp @@ -142,7 +142,7 @@ static int32_t BaseTestMac(uint32_t index) g_testMacParams[index].keyParams.blobDataSize); } else { if (g_testMacParams[index].keyAliasParams.blobExist) { - ret = GenerateKey(&key, &(g_testMacParams[index].keyAliasParams), + ret = HuksGenerateKey(&key, &(g_testMacParams[index].keyAliasParams), &g_testMacParams[index].genKeyParamSetParams, NULL); } else { ret = TestConstuctBlob(&key, diff --git a/security_lite/huks/liteos_m_adapter/BUILD.gn b/security_lite/huks/liteos_m_adapter/BUILD.gn index f73d2a65f328caa06333f0992f896ca11b3b0e2d..698f9ff9bde0adf022872e8029446a777c8e607d 100644 --- a/security_lite/huks/liteos_m_adapter/BUILD.gn +++ b/security_lite/huks/liteos_m_adapter/BUILD.gn @@ -39,6 +39,7 @@ hctest_suite("ActsHuksHalFunctionTest") { include_dirs = [ "//base/security/huks/interfaces/innerkits/huks_standard/main/include", "//base/iothardware/peripheral/interfaces/inner_api", + "//base/security/huks/frameworks/huks_standard/main/common/include", "../common/include", ] diff --git a/security_lite/huks/liteos_m_adapter/hks_aes_test.c b/security_lite/huks/liteos_m_adapter/hks_aes_test.c index dc110242f1598cc401df605425bd999d55b76d7f..a56271783e6a763665a4edc1dcd636ffb26e95d0 100644 --- a/security_lite/huks/liteos_m_adapter/hks_aes_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_aes_test.c @@ -17,10 +17,13 @@ #include "hks_api.h" #include "hks_param.h" +#include "hks_test_aes.h" #include "securec.h" #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define TEST_TASK_STACK_SIZE 0x2000 #define WAIT_TO_TEST_DONE 4 diff --git a/security_lite/huks/liteos_m_adapter/hks_agreement_test.c b/security_lite/huks/liteos_m_adapter/hks_agreement_test.c index 9b9f8d9b96dfa8cee7447640c9862b0fcff2d638..55cb1a5f894175c95ad0136874f38744e4d33f29 100644 --- a/security_lite/huks/liteos_m_adapter/hks_agreement_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_agreement_test.c @@ -26,6 +26,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define TMP_SIZE 512 #define X25519_KEY_SIZE 32 #define TEST_TASK_STACK_SIZE 0x2000 diff --git a/security_lite/huks/liteos_m_adapter/hks_bn_exp_mod_test.c b/security_lite/huks/liteos_m_adapter/hks_bn_exp_mod_test.c index 98bcd7a1460565fbcdde1010780a03ecbdfcd8dd..f2fc9d9256bd19a9e0513708904337dbc5478af0 100644 --- a/security_lite/huks/liteos_m_adapter/hks_bn_exp_mod_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_bn_exp_mod_test.c @@ -28,6 +28,8 @@ #define TEST_TASK_STACK_SIZE 0x2000 #define WAIT_TO_TEST_DONE 4 +#include + static osPriority_t g_setPriority; /* diff --git a/security_lite/huks/liteos_m_adapter/hks_cipher_test.c b/security_lite/huks/liteos_m_adapter/hks_cipher_test.c index 8d73f9522f66d2f7408243cf3d40e51ffecb74a5..3d06929df3ccb4adc808787b483137dfa4ef6fa4 100644 --- a/security_lite/huks/liteos_m_adapter/hks_cipher_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_cipher_test.c @@ -24,6 +24,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define TEST_INDEX_0 0 #define TEST_INDEX_1 1 #define TEST_INDEX_2 2 diff --git a/security_lite/huks/liteos_m_adapter/hks_delete_test.c b/security_lite/huks/liteos_m_adapter/hks_delete_test.c index 3aaadc411a5ac79ca20a2fbd96415492269cb4bc..5a32370b31bd9e9aafff6d31b14bb6037f4ce49a 100644 --- a/security_lite/huks/liteos_m_adapter/hks_delete_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_delete_test.c @@ -27,6 +27,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define TEST_TASK_STACK_SIZE 0x2000 #define WAIT_TO_TEST_DONE 4 diff --git a/security_lite/huks/liteos_m_adapter/hks_derive_test.c b/security_lite/huks/liteos_m_adapter/hks_derive_test.c index af2fca799cd25fb792cbb3e0112c6251d07f2ca4..aff1512e38a3fe3c22d0445b326dfa83015ff65c 100644 --- a/security_lite/huks/liteos_m_adapter/hks_derive_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_derive_test.c @@ -26,6 +26,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define DEFAULT_DERIVE_SIZE 32 #define DEFAULT_INFO_SIZE 55 #define DEFAULT_SALT_SIZE 16 diff --git a/security_lite/huks/liteos_m_adapter/hks_exist_test.c b/security_lite/huks/liteos_m_adapter/hks_exist_test.c index ac981aa9af2b25d284d85dc9f861e10a6b9cfbd3..a1e524b48d8e2bbf1cb6ca64aec0b560da99313d 100644 --- a/security_lite/huks/liteos_m_adapter/hks_exist_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_exist_test.c @@ -27,6 +27,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define TEST_TASK_STACK_SIZE 0x2000 #define WAIT_TO_TEST_DONE 4 diff --git a/security_lite/huks/liteos_m_adapter/hks_generate_key_test.c b/security_lite/huks/liteos_m_adapter/hks_generate_key_test.c index 7675d495f9648764c7e0e226b28f51fa5ce80ec2..f5c721a84de4db251b0e1299f67a9ee43c99f24c 100644 --- a/security_lite/huks/liteos_m_adapter/hks_generate_key_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_generate_key_test.c @@ -27,6 +27,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define DEFAULT_X25519_PARAM_SET_OUT 104 #define TEST_TASK_STACK_SIZE 0x2000 #define WAIT_TO_TEST_DONE 4 diff --git a/security_lite/huks/liteos_m_adapter/hks_generate_random_test.c b/security_lite/huks/liteos_m_adapter/hks_generate_random_test.c index d79bea696dd5fefeedf050325aff17ac9610291e..68777fd95112ea3ca33b7e097910588a077852de 100644 --- a/security_lite/huks/liteos_m_adapter/hks_generate_random_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_generate_random_test.c @@ -26,6 +26,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define TEST_TASK_STACK_SIZE 0x2000 #define WAIT_TO_TEST_DONE 4 diff --git a/security_lite/huks/liteos_m_adapter/hks_hash_test.c b/security_lite/huks/liteos_m_adapter/hks_hash_test.c index 2e4fc76381772c48e65116675357d825f8c9e1c4..4c1f5aed884a76398434cecd66a824a7221e199d 100644 --- a/security_lite/huks/liteos_m_adapter/hks_hash_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_hash_test.c @@ -28,6 +28,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define DEFAULT_SRC_DATA_SIZE 200 #define DIGEST_SHA256_HASH_SIZE 32 #define TEST_TASK_STACK_SIZE 0x2000 diff --git a/security_lite/huks/liteos_m_adapter/hks_mac_test.c b/security_lite/huks/liteos_m_adapter/hks_mac_test.c index 199c7273e1cbc11e8ac78e13036988efab008f1d..9ecf72bc4cc635c40af0bc92259b8c45c1e3a345 100644 --- a/security_lite/huks/liteos_m_adapter/hks_mac_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_mac_test.c @@ -26,6 +26,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define HKS_TEST_MAC_REE_KEY_SIZE_32 32 #define HKS_DEFAULT_MAC_SRCDATA_SIZE 253 #define HKS_DEFAULT_MAC_SHA256_SIZE 32 diff --git a/security_lite/huks/liteos_m_adapter/hks_modify_key_test.c b/security_lite/huks/liteos_m_adapter/hks_modify_key_test.c index f91657283483d8f8e4f062aa7660931484abe124..d9b1937ea1b57f5cec5fd864559b8b90c822c281 100644 --- a/security_lite/huks/liteos_m_adapter/hks_modify_key_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_modify_key_test.c @@ -30,6 +30,8 @@ #include "cmsis_os2.h" #include "ohos_types.h" +#include + #define DEFAULT_AES_CIPHER_PLAIN_SIZE 1000 #define AES_DEFAULT_GCM_NONCE_LENGTH 12 #define AES_DEFAULT_AAD_LEN 4 diff --git a/security_lite/huks/liteos_m_adapter/hks_others_test.c b/security_lite/huks/liteos_m_adapter/hks_others_test.c index a807208e024df3fdc23725784fe899ab8d73f177..d88f8eb441aa9d80982680528f6068a55b9c5bb5 100644 --- a/security_lite/huks/liteos_m_adapter/hks_others_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_others_test.c @@ -18,6 +18,7 @@ #include "hks_others_test.h" #include +#include #include "hks_api.h" #include "hks_param.h" diff --git a/security_lite/huks/liteos_m_adapter/hks_safe_compare_key_test.c b/security_lite/huks/liteos_m_adapter/hks_safe_compare_key_test.c index 6e721f421da7ef932f5059c7a5ac5176dabfabe1..1da2f4ad66ec364bdae56412564f4734354ff1ce 100644 --- a/security_lite/huks/liteos_m_adapter/hks_safe_compare_key_test.c +++ b/security_lite/huks/liteos_m_adapter/hks_safe_compare_key_test.c @@ -16,9 +16,9 @@ #ifndef _CUT_AUTHENTICATE_ #include "hks_safe_compare_key_test.h" - +#include "hks_mem.h" #include - +#include #include "hks_api.h" #include "hks_param.h" #include "hks_test_api_performance.h" @@ -197,13 +197,13 @@ static int32_t CompareKeyData(struct HksBlob *keyAliasOne, struct HksBlob *keyAl g_storageImageBuffer.size = sizeOne; int32_t offset1; - int ret = GetKeyOffsetByKeyAlias(keyAliasOne, &offset1); + int ret = GetKeyOffsetByKeyAlias(keyAliasOne, (uint32_t *)(&offset1)); TEST_ASSERT_TRUE(ret == 0); struct HksStoreKeyInfo *keyInfo1 = (struct HksStoreKeyInfo *)(g_storageImageBuffer.data + offset1); int32_t offset2; - ret = GetKeyOffsetByKeyAlias(keyAliasTwo, &offset2); + ret = GetKeyOffsetByKeyAlias(keyAliasTwo, (uint32_t *)(&offset2)); TEST_ASSERT_TRUE(ret == 0); struct HksStoreKeyInfo *keyInfo2 = (struct HksStoreKeyInfo *)(g_storageImageBuffer.data + offset2);