提交 2b44c8ee 编写于 作者: Q qiaozzzh

huks用例mini挑单

Signed-off-by: Nqiaozzzh <qiaozhang@huawei.com>
Change-Id: I776803dd5ee33e38c656510b3d47a48f485f96d7
上级 b397f047
...@@ -593,7 +593,7 @@ int32_t BaseTestCipher(uint32_t times, uint32_t index, uint32_t performTimes) ...@@ -593,7 +593,7 @@ int32_t BaseTestCipher(uint32_t times, uint32_t index, uint32_t performTimes)
g_testCipherParams[index].genKeyParamSetParams.keyStorageFlag == HKS_STORAGE_TEMP) { g_testCipherParams[index].genKeyParamSetParams.keyStorageFlag == HKS_STORAGE_TEMP) {
ret = GenerateLocalRandomKey(&keyAlias, &g_testCipherParams[index].localKeyParams); ret = GenerateLocalRandomKey(&keyAlias, &g_testCipherParams[index].localKeyParams);
} else { } else {
ret = GenerateKey(&keyAlias, &g_testCipherParams[index].keyAliasParams, ret = HuksGenerateKey(&keyAlias, &g_testCipherParams[index].keyAliasParams,
&g_testCipherParams[index].genKeyParamSetParams, &g_testCipherParams[index].genKeyParamSetParamsOut); &g_testCipherParams[index].genKeyParamSetParams, &g_testCipherParams[index].genKeyParamSetParamsOut);
} }
HKS_TEST_ASSERT(ret == 0); HKS_TEST_ASSERT(ret == 0);
...@@ -648,7 +648,7 @@ int32_t BaseTestEncrypt(uint32_t times, uint32_t index, uint32_t performTimes) ...@@ -648,7 +648,7 @@ int32_t BaseTestEncrypt(uint32_t times, uint32_t index, uint32_t performTimes)
ret = GenerateLocalRandomKey(&keyAlias, &g_testEncryptParams[index].localKeyParams); ret = GenerateLocalRandomKey(&keyAlias, &g_testEncryptParams[index].localKeyParams);
} else { } else {
if (g_testEncryptParams[index].keyAliasParams.blobExist) { 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); &g_testEncryptParams[index].genKeyParamSetParams, NULL);
} else { } else {
ret = TestConstuctBlob(&keyAlias, ret = TestConstuctBlob(&keyAlias,
...@@ -700,7 +700,7 @@ int32_t BaseTestDecrypt(uint32_t times, uint32_t index, uint32_t performTimes) ...@@ -700,7 +700,7 @@ int32_t BaseTestDecrypt(uint32_t times, uint32_t index, uint32_t performTimes)
ret = GenerateLocalRandomKey(&keyAlias, &g_testDecryptParams[index].localKeyParams); ret = GenerateLocalRandomKey(&keyAlias, &g_testDecryptParams[index].localKeyParams);
} else { } else {
if (g_testDecryptParams[index].keyAliasParams.blobExist) { 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); &g_testDecryptParams[index].genKeyParamSetParams, NULL);
} else { } else {
ret = TestConstuctBlob(&keyAlias, ret = TestConstuctBlob(&keyAlias,
......
...@@ -551,7 +551,7 @@ int32_t TestConstructHashParamSet( ...@@ -551,7 +551,7 @@ int32_t TestConstructHashParamSet(
return ret; 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 HksTestGenKeyParamsParamSet *genKeyParamSetParams,
const struct HksTestGenKeyParamsParamSetOut *genKeyParamSetParamsOut) const struct HksTestGenKeyParamsParamSetOut *genKeyParamSetParamsOut)
{ {
......
...@@ -188,7 +188,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui ...@@ -188,7 +188,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 */ /* now offset is 0, but we maybe extend hi1131 file interfaces in the future */
if (offset != 0) { if (offset != 0) {
return HKS_ERROR_INVALID_ARGUMENT; return (uint32_t)HKS_ERROR_INVALID_ARGUMENT;
} }
unsigned int fileSize; unsigned int fileSize;
...@@ -209,7 +209,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui ...@@ -209,7 +209,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui
return 0; return 0;
} }
ret = UtilsFileRead(fd, buf, len); ret = UtilsFileRead(fd, (char *)buf, len);
UtilsFileClose(fd); UtilsFileClose(fd);
if (ret < 0) { if (ret < 0) {
HKS_TEST_LOG_E("failed to read file, errno = 0x%x", ret); HKS_TEST_LOG_E("failed to read file, errno = 0x%x", ret);
...@@ -232,7 +232,7 @@ static int32_t FileWrite(const char *fileName, uint32_t offset, const uint8_t *b ...@@ -232,7 +232,7 @@ static int32_t FileWrite(const char *fileName, uint32_t offset, const uint8_t *b
return HKS_ERROR_OPEN_FILE_FAIL; 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) { if (ret < 0) {
HKS_TEST_LOG_E("failed to write key file, errno = 0x%x\n", ret); HKS_TEST_LOG_E("failed to write key file, errno = 0x%x\n", ret);
ret = HKS_ERROR_WRITE_FILE_FAIL; ret = HKS_ERROR_WRITE_FILE_FAIL;
......
...@@ -412,7 +412,7 @@ int32_t TestConstructHashParamSet( ...@@ -412,7 +412,7 @@ int32_t TestConstructHashParamSet(
bool paramSetExist, bool paramSetExist,
bool setDigest, uint32_t digest); bool setDigest, uint32_t digest);
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 HksTestGenKeyParamsParamSet *genKeyParamSetParams,
const struct HksTestGenKeyParamsParamSetOut *genKeyParamSetParamsOut); const struct HksTestGenKeyParamsParamSetOut *genKeyParamSetParamsOut);
......
...@@ -154,7 +154,7 @@ static int32_t BaseTestDerive(uint32_t index) ...@@ -154,7 +154,7 @@ static int32_t BaseTestDerive(uint32_t index)
ret = GenerateLocalRandomKey(&keyAlias, &g_testDeriveParams[index].localKeyParams); ret = GenerateLocalRandomKey(&keyAlias, &g_testDeriveParams[index].localKeyParams);
} else { } else {
if (g_testDeriveParams[index].keyAliasParams.blobExist) { 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); &g_testDeriveParams[index].genKeyParamSetParams, NULL);
} else { } else {
ret = TestConstuctBlob(&keyAlias, ret = TestConstuctBlob(&keyAlias,
......
...@@ -142,7 +142,7 @@ static int32_t BaseTestMac(uint32_t index) ...@@ -142,7 +142,7 @@ static int32_t BaseTestMac(uint32_t index)
g_testMacParams[index].keyParams.blobDataSize); g_testMacParams[index].keyParams.blobDataSize);
} else { } else {
if (g_testMacParams[index].keyAliasParams.blobExist) { 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); &g_testMacParams[index].genKeyParamSetParams, NULL);
} else { } else {
ret = TestConstuctBlob(&key, ret = TestConstuctBlob(&key,
......
...@@ -84,7 +84,7 @@ HWTEST_F(HksOthersTest, HksOthersTest002, TestSize.Level1) ...@@ -84,7 +84,7 @@ HWTEST_F(HksOthersTest, HksOthersTest002, TestSize.Level1)
HWTEST_F(HksOthersTest, HksOthersTest003, TestSize.Level1) HWTEST_F(HksOthersTest, HksOthersTest003, TestSize.Level1)
{ {
int32_t ret = HksAttestKey(NULL, NULL, NULL); int32_t ret = HksAttestKey(NULL, NULL, NULL);
ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
} }
/** /**
...@@ -95,7 +95,7 @@ HWTEST_F(HksOthersTest, HksOthersTest003, TestSize.Level1) ...@@ -95,7 +95,7 @@ HWTEST_F(HksOthersTest, HksOthersTest003, TestSize.Level1)
HWTEST_F(HksOthersTest, HksOthersTest004, TestSize.Level1) HWTEST_F(HksOthersTest, HksOthersTest004, TestSize.Level1)
{ {
int32_t ret = HksGetCertificateChain(NULL, NULL, NULL); int32_t ret = HksGetCertificateChain(NULL, NULL, NULL);
ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
} }
/** /**
...@@ -106,7 +106,7 @@ HWTEST_F(HksOthersTest, HksOthersTest004, TestSize.Level1) ...@@ -106,7 +106,7 @@ HWTEST_F(HksOthersTest, HksOthersTest004, TestSize.Level1)
HWTEST_F(HksOthersTest, HksOthersTest005, TestSize.Level1) HWTEST_F(HksOthersTest, HksOthersTest005, TestSize.Level1)
{ {
int32_t ret = HksWrapKey(NULL, NULL, NULL, NULL); int32_t ret = HksWrapKey(NULL, NULL, NULL, NULL);
ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
} }
/** /**
...@@ -117,7 +117,7 @@ HWTEST_F(HksOthersTest, HksOthersTest005, TestSize.Level1) ...@@ -117,7 +117,7 @@ HWTEST_F(HksOthersTest, HksOthersTest005, TestSize.Level1)
HWTEST_F(HksOthersTest, HksOthersTest006, TestSize.Level1) HWTEST_F(HksOthersTest, HksOthersTest006, TestSize.Level1)
{ {
int32_t ret = HksUnwrapKey(NULL, NULL, NULL, NULL); int32_t ret = HksUnwrapKey(NULL, NULL, NULL, NULL);
ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
} }
/** /**
......
...@@ -56,7 +56,29 @@ void HksSafeCipherKeyTest::TearDown() ...@@ -56,7 +56,29 @@ void HksSafeCipherKeyTest::TearDown()
{ {
} }
const char *g_storePath = "/storage/maindata/hks_client/key";
const char *g_testEd25519 = "test_ed25519"; const char *g_testEd25519 = "test_ed25519";
static int32_t CompareTwoKey(const struct HksBlob *keyAliasOne, const struct HksBlob *keyAliasTwo)
{
uint32_t sizeOne = HksTestFileSize(g_storePath, (char *)keyAliasOne->data);
uint8_t *bufOne = (uint8_t *)HksTestMalloc(sizeOne);
if (bufOne == NULL) {
return HKS_ERROR_MALLOC_FAIL;
}
uint32_t sizeRead = HksTestFileRead(g_storePath, (char *)keyAliasOne->data, 0, bufOne, sizeOne);
uint32_t sizeTwo = HksTestFileSize(g_storePath, (char *)keyAliasTwo->data);
uint8_t *bufTwo = (uint8_t *)HksTestMalloc(sizeTwo);
if (bufTwo == NULL) {
HksTestFree(bufOne);
return HKS_ERROR_MALLOC_FAIL;
}
sizeRead = HksTestFileRead(g_storePath, (char *)keyAliasTwo->data, 0, bufTwo, sizeOne);
int32_t ret = memcmp(bufOne, bufTwo, sizeRead);
HksTestFree(bufOne);
HksTestFree(bufTwo);
return ret;
}
/** /**
* @tc.name: HksSafeCipherKeyTest.HksSafeCipherKeyTest001 * @tc.name: HksSafeCipherKeyTest.HksSafeCipherKeyTest001
...@@ -83,21 +105,13 @@ HWTEST_F(HksSafeCipherKeyTest, HksSafeCipherKeyTest001, TestSize.Level1) ...@@ -83,21 +105,13 @@ HWTEST_F(HksSafeCipherKeyTest, HksSafeCipherKeyTest001, TestSize.Level1)
ret = TestImportEd25519(newAliasTwo, &pubKeyInfo); ret = TestImportEd25519(newAliasTwo, &pubKeyInfo);
EXPECT_EQ(ret, 0); EXPECT_EQ(ret, 0);
struct HksBlob X25519PubKey1 = { .size = HKS_CURVE25519_KEY_SIZE_256, .data = nullptr}; ret = CompareTwoKey(&newAliasOne, &newAliasTwo);
struct HksBlob X25519PubKey2 = { .size = HKS_CURVE25519_KEY_SIZE_256, .data = nullptr};
X25519PubKey1.data = (uint8_t *)malloc(X25519PubKey1.size);
X25519PubKey2.data = (uint8_t *)malloc(X25519PubKey2.size);
ret = HksExportPublicKey(&newAliasOne, nullptr, &X25519PubKey1);
EXPECT_EQ(ret, 0)<<"export alies1 fail";
ret = HksExportPublicKey(&newAliasTwo, nullptr, &X25519PubKey2);
EXPECT_EQ(ret, 0)<<"export alies2 fail";
ret = memcmp(X25519PubKey1.data, X25519PubKey2.data, HKS_CURVE25519_KEY_SIZE_256);
EXPECT_NE(ret, 0); EXPECT_NE(ret, 0);
ret = HksDeleteKey(&newAliasOne, nullptr); ret = HksDeleteKey(&newAliasOne, NULL);
EXPECT_EQ(ret, 0); EXPECT_EQ(ret, 0);
ret = HksDeleteKey(&newAliasTwo, nullptr); ret = HksDeleteKey(&newAliasTwo, NULL);
EXPECT_EQ(ret, 0); EXPECT_EQ(ret, 0);
} }
#endif /* _CUT_AUTHENTICATE_ */ #endif /* _CUT_AUTHENTICATE_ */
......
...@@ -39,6 +39,7 @@ hctest_suite("ActsHuksHalFunctionTest") { ...@@ -39,6 +39,7 @@ hctest_suite("ActsHuksHalFunctionTest") {
include_dirs = [ include_dirs = [
"//base/security/huks/interfaces/innerkits/huks_standard/main/include", "//base/security/huks/interfaces/innerkits/huks_standard/main/include",
"//base/iothardware/peripheral/interfaces/inner_api", "//base/iothardware/peripheral/interfaces/inner_api",
"//base/security/huks/frameworks/huks_standard/main/common/include",
"../common/include", "../common/include",
] ]
......
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
#include "hks_api.h" #include "hks_api.h"
#include "hks_param.h" #include "hks_param.h"
#include "hks_test_aes.h"
#include "securec.h" #include "securec.h"
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4 #define WAIT_TO_TEST_DONE 4
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define TMP_SIZE 512 #define TMP_SIZE 512
#define X25519_KEY_SIZE 32 #define X25519_KEY_SIZE 32
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4 #define WAIT_TO_TEST_DONE 4
#include <unistd.h>
static osPriority_t g_setPriority; static osPriority_t g_setPriority;
/* /*
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define TEST_INDEX_0 0 #define TEST_INDEX_0 0
#define TEST_INDEX_1 1 #define TEST_INDEX_1 1
#define TEST_INDEX_2 2 #define TEST_INDEX_2 2
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4 #define WAIT_TO_TEST_DONE 4
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_DERIVE_SIZE 32 #define DEFAULT_DERIVE_SIZE 32
#define DEFAULT_INFO_SIZE 55 #define DEFAULT_INFO_SIZE 55
#define DEFAULT_SALT_SIZE 16 #define DEFAULT_SALT_SIZE 16
...@@ -180,7 +181,7 @@ static int32_t BaseTestDerive(uint32_t index) ...@@ -180,7 +181,7 @@ static int32_t BaseTestDerive(uint32_t index)
ret = GenerateLocalRandomKey(&keyAlias, &g_testDeriveParams[index].localKeyParams); ret = GenerateLocalRandomKey(&keyAlias, &g_testDeriveParams[index].localKeyParams);
} else { } else {
if (g_testDeriveParams[index].keyAliasParams.blobExist) { 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); &g_testDeriveParams[index].genKeyParamSetParams, NULL);
} else { } else {
ret = TestConstuctBlob(&keyAlias, ret = TestConstuctBlob(&keyAlias,
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4 #define WAIT_TO_TEST_DONE 4
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_X25519_PARAM_SET_OUT 104 #define DEFAULT_X25519_PARAM_SET_OUT 104
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4 #define WAIT_TO_TEST_DONE 4
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4 #define WAIT_TO_TEST_DONE 4
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_SRC_DATA_SIZE 200 #define DEFAULT_SRC_DATA_SIZE 200
#define DIGEST_SHA256_HASH_SIZE 32 #define DIGEST_SHA256_HASH_SIZE 32
#define TEST_TASK_STACK_SIZE 0x2000 #define TEST_TASK_STACK_SIZE 0x2000
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define HKS_TEST_MAC_REE_KEY_SIZE_32 32 #define HKS_TEST_MAC_REE_KEY_SIZE_32 32
#define HKS_DEFAULT_MAC_SRCDATA_SIZE 253 #define HKS_DEFAULT_MAC_SRCDATA_SIZE 253
#define HKS_DEFAULT_MAC_SHA256_SIZE 32 #define HKS_DEFAULT_MAC_SHA256_SIZE 32
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "ohos_types.h" #include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_AES_CIPHER_PLAIN_SIZE 1000 #define DEFAULT_AES_CIPHER_PLAIN_SIZE 1000
#define AES_DEFAULT_GCM_NONCE_LENGTH 12 #define AES_DEFAULT_GCM_NONCE_LENGTH 12
#define AES_DEFAULT_AAD_LEN 4 #define AES_DEFAULT_AAD_LEN 4
...@@ -291,7 +292,7 @@ int32_t BaseTestCipherProcess(const struct HksBlob *keyAlias, uint32_t index) ...@@ -291,7 +292,7 @@ int32_t BaseTestCipherProcess(const struct HksBlob *keyAlias, uint32_t index)
} }
/* 3. decrypt */ /* 3. decrypt */
struct CipherDecryptStructure testDecryptStruct = { struct CipherDecryptStructure testDecryptStruct = {
keyAlias, &g_testCipherParams[index], cipherData, (struct HksBlob *)(keyAlias), &g_testCipherParams[index], cipherData,
&decryptedData, ivData, nonceData, aadData, 1 &decryptedData, ivData, nonceData, aadData, 1
}; };
ret = DecryptCipher(&testDecryptStruct); ret = DecryptCipher(&testDecryptStruct);
...@@ -330,6 +331,7 @@ int32_t __attribute__((weak)) HksStoreKeyBlob(const struct HksBlob *processName, ...@@ -330,6 +331,7 @@ int32_t __attribute__((weak)) HksStoreKeyBlob(const struct HksBlob *processName,
(void)keyAlias; (void)keyAlias;
(void)storageType; (void)storageType;
(void)keyBlob; (void)keyBlob;
return HKS_SUCCESS;
} }
static void ExecHksModifyKeyTest001(void const *argument) static void ExecHksModifyKeyTest001(void const *argument)
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "hks_others_test.h" #include "hks_others_test.h"
#include <hctest.h> #include <hctest.h>
#include <unistd.h>
#include "hks_api.h" #include "hks_api.h"
#include "hks_param.h" #include "hks_param.h"
...@@ -101,7 +102,7 @@ static void ExcHksOthersTest003(void const *argument) ...@@ -101,7 +102,7 @@ static void ExcHksOthersTest003(void const *argument)
{ {
LiteTestPrint("HksOthersTest003 Begin!\n"); LiteTestPrint("HksOthersTest003 Begin!\n");
int32_t ret = HksAttestKey(NULL, NULL, NULL); int32_t ret = HksAttestKey(NULL, NULL, NULL);
TEST_ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); TEST_ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
LiteTestPrint("HksOthersTest003 End!\n"); LiteTestPrint("HksOthersTest003 End!\n");
osThreadExit(); osThreadExit();
} }
...@@ -110,7 +111,7 @@ static void ExcHksOthersTest004(void const *argument) ...@@ -110,7 +111,7 @@ static void ExcHksOthersTest004(void const *argument)
{ {
LiteTestPrint("HksOthersTest004 Begin!\n"); LiteTestPrint("HksOthersTest004 Begin!\n");
int32_t ret = HksGetCertificateChain(NULL, NULL, NULL); int32_t ret = HksGetCertificateChain(NULL, NULL, NULL);
TEST_ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); TEST_ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
LiteTestPrint("HksOthersTest004 End!\n"); LiteTestPrint("HksOthersTest004 End!\n");
osThreadExit(); osThreadExit();
} }
...@@ -119,7 +120,7 @@ static void ExcHksOthersTest005(void const *argument) ...@@ -119,7 +120,7 @@ static void ExcHksOthersTest005(void const *argument)
{ {
LiteTestPrint("HksOthersTest005 Begin!\n"); LiteTestPrint("HksOthersTest005 Begin!\n");
int32_t ret = HksGetCertificateChain(NULL, NULL, NULL); int32_t ret = HksGetCertificateChain(NULL, NULL, NULL);
TEST_ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); TEST_ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
LiteTestPrint("HksOthersTest005 End!\n"); LiteTestPrint("HksOthersTest005 End!\n");
osThreadExit(); osThreadExit();
} }
...@@ -128,7 +129,7 @@ static void ExcHksOthersTest006(void const *argument) ...@@ -128,7 +129,7 @@ static void ExcHksOthersTest006(void const *argument)
{ {
LiteTestPrint("HksOthersTest006 Begin!\n"); LiteTestPrint("HksOthersTest006 Begin!\n");
int32_t ret = HksUnwrapKey(NULL, NULL, NULL, NULL); int32_t ret = HksUnwrapKey(NULL, NULL, NULL, NULL);
TEST_ASSERT_TRUE(ret == HKS_ERROR_API_NOT_SUPPORTED); TEST_ASSERT_TRUE(ret == HKS_ERROR_NOT_SUPPORTED);
LiteTestPrint("HksOthersTest006 End!\n"); LiteTestPrint("HksOthersTest006 End!\n");
osThreadExit(); osThreadExit();
} }
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#ifndef _CUT_AUTHENTICATE_ #ifndef _CUT_AUTHENTICATE_
#include "hks_safe_compare_key_test.h" #include "hks_safe_compare_key_test.h"
#include "hks_mem.h"
#include <hctest.h> #include <hctest.h>
#include <unistd.h>
#include "hks_api.h" #include "hks_api.h"
#include "hks_param.h" #include "hks_param.h"
#include "hks_test_api_performance.h" #include "hks_test_api_performance.h"
...@@ -61,7 +61,7 @@ static void ExecHksInitialize(void const *argument) ...@@ -61,7 +61,7 @@ static void ExecHksInitialize(void const *argument)
static BOOL HksSafeCompareKeyTestSetUp() static BOOL HksSafeCompareKeyTestSetUp()
{ {
LiteTestPrint("setup\n"); LiteTestPrint("setup\n");
osThreadId_t id; osThreadId_t id;
osThreadAttr_t attr; osThreadAttr_t attr;
g_setPriority = osPriorityAboveNormal6; g_setPriority = osPriorityAboveNormal6;
...@@ -197,13 +197,13 @@ static int32_t CompareKeyData(struct HksBlob *keyAliasOne, struct HksBlob *keyAl ...@@ -197,13 +197,13 @@ static int32_t CompareKeyData(struct HksBlob *keyAliasOne, struct HksBlob *keyAl
g_storageImageBuffer.size = sizeOne; g_storageImageBuffer.size = sizeOne;
int32_t offset1; int32_t offset1;
int ret = GetKeyOffsetByKeyAlias(keyAliasOne, &offset1); int ret = GetKeyOffsetByKeyAlias(keyAliasOne, (uint32_t *)(&offset1));
TEST_ASSERT_TRUE(ret == 0); TEST_ASSERT_TRUE(ret == 0);
struct HksStoreKeyInfo *keyInfo1 = (struct HksStoreKeyInfo *)(g_storageImageBuffer.data + offset1); struct HksStoreKeyInfo *keyInfo1 = (struct HksStoreKeyInfo *)(g_storageImageBuffer.data + offset1);
int32_t offset2; int32_t offset2;
ret = GetKeyOffsetByKeyAlias(keyAliasTwo, &offset2); ret = GetKeyOffsetByKeyAlias(keyAliasTwo, (uint32_t *)(&offset2));
TEST_ASSERT_TRUE(ret == 0); TEST_ASSERT_TRUE(ret == 0);
struct HksStoreKeyInfo *keyInfo2 = (struct HksStoreKeyInfo *)(g_storageImageBuffer.data + offset2); struct HksStoreKeyInfo *keyInfo2 = (struct HksStoreKeyInfo *)(g_storageImageBuffer.data + offset2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册