提交 279b86e8 编写于 作者: O openharmony_ci 提交者: Gitee

!150 huks测试套增加宏,适配开发功能裁剪

Merge pull request !150 from aaronwangjun/dev2
......@@ -12,6 +12,7 @@
# limitations under the License.
import("//test/xts/tools/lite/build/suite_lite.gni")
import("//base/security/huks/build/config.gni")
hctest_suite("ActsSecurityDataTest") {
suite_name = "acts"
......@@ -22,7 +23,9 @@ hctest_suite("ActsSecurityDataTest") {
"src/security_data_huks_gen_del_test.c",
"src/security_data_huks_sign_verify_test.c",
]
if (disable_authenticate == true) {
defines = [ "_CUT_AUTHENTICATE_" ]
}
include_dirs = [
"src",
"//base/security/huks/interfaces/innerkits/huks_lite/",
......
......@@ -53,7 +53,7 @@ static BOOL SecurityDataHuksExportHashRandomHmacTestSuiteTearDown(void)
printf("-++++++++++++++++++++++++++++++++++++++++++++-\n");
return TRUE;
}
#ifndef _CUT_AUTHENTICATE_
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Export Public key
// begin++++++++++++++++++++++++++++++++++++++++++++++1000-1090
......@@ -326,7 +326,9 @@ securityDataExportPublicKey1090, Function | MediumTest | Level2)
TEST_ASSERT_EQUAL_INT(NUM1010, status);
HksBlobDestroyT1(&publicKey1);
}
#endif
#ifndef _CUT_AUTHENTICATE_
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Export Public key
// end++++++++++++++++++++++++++++++++++++++++++++++++1000-1090
......@@ -545,7 +547,7 @@ LITE_TEST_CASE(SecurityDataHuksExportHashRandomHmacTestSuite, securityDataHash11
HksBlobDestroyT1(&hash);
TEST_ASSERT_EQUAL_INT(NUM1007, status);
}
#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Hash
// end+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++1100-1190
......
......@@ -54,6 +54,7 @@ void HksBlobDestroyT1(struct hks_blob *blob)
}
int TestSecShuksGenerateKeyNormal(void)
{
#ifndef _CUT_AUTHENTICATE_
char testFileName[] = "keyalias1";
char testFileName1[] = "key_auth_id1";
struct hks_blob keyAlias;
......@@ -72,10 +73,12 @@ int TestSecShuksGenerateKeyNormal(void)
keyParam.key_pad = 0;
int32_t status = hks_generate_key(&keyAlias, &keyParam);
TEST_ASSERT_EQUAL_INT(0, status);
#endif
return 0;
}
int TestSecShuksDeleteKeyNormal(void)
{
#ifndef _CUT_AUTHENTICATE_
char testFileName[] = "keyalias1";
struct hks_blob keyAlias = { 0 };
......@@ -85,12 +88,15 @@ int TestSecShuksDeleteKeyNormal(void)
int32_t status = hks_delete_key(&keyAlias);
TEST_ASSERT_EQUAL_INT(0, status);
#endif
return 0;
}
int TestSecShuksExportPublicNormal(struct hks_blob *keyAlias, struct hks_blob *publicKey1)
{
#ifndef _CUT_AUTHENTICATE_
int32_t status = hks_export_public_key(keyAlias, publicKey1);
TEST_ASSERT_EQUAL_INT(0, status);
#endif
return 0;
}
void BuildBlobData(struct hks_blob *param, const char *str, uint8_t type, uint32_t size, uint8_t isDataNull)
......@@ -171,6 +177,7 @@ void TestInitKeyParam1(struct hks_key_param *keyParam, uint32_t keyType, uint32_
int TestSecShuksImportPublicNormal(void)
{
#ifndef _CUT_AUTHENTICATE_
char testFileName[] = "keyalias1";
struct hks_key_param keyParam1 = { 0 };
......@@ -196,6 +203,7 @@ int TestSecShuksImportPublicNormal(void)
TEST_ASSERT_EQUAL_INT(0, status);
HksBlobDestroyT1(&publicKey1);
#endif
return 0;
}
......@@ -240,6 +248,7 @@ static BOOL SecurityDataHuksGenDelTestSuiteTearDown(void)
* @tc.name : Generate key, normal input parameters keyAlias and keyParam
* @tc.desc : [C- SECURITY -1400]
*/
#ifndef _CUT_AUTHENTICATE_
LITE_TEST_CASE(SecurityDataHuksGenDelTestSuite, securityDataGenerateKey0000, Function | MediumTest | Level1)
{
char testFileName[] = "keyalias1";
......@@ -831,5 +840,5 @@ LITE_TEST_CASE(SecurityDataHuksGenDelTestSuite, securityDataDeleteKey0190, Funct
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Delete key
// end+++++++++++++++++++++++++++++++++++++++++++++++++++++++0130-0190
#endif
RUN_TEST_SUITE(SecurityDataHuksGenDelTestSuite);
......@@ -53,7 +53,7 @@ static BOOL SecurityDataHuksSignVerifyTestSuiteTearDown(void)
printf("-++++++++++++++++++++++++++++++++++++++++++++-\n");
return TRUE;
}
#ifndef _CUT_AUTHENTICATE_
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Sign key
// begin+++++++++++++++++++++++++++++++++++++++++++++++++++++++0200-0340
......@@ -1267,7 +1267,7 @@ LITE_TEST_CASE(SecurityDataHuksSignVerifyTestSuite, securityDataAsymmetricVerify
status = hks_asymmetric_verify(&keyAlias, &keyParam, &hash, &signature);
TEST_ASSERT_EQUAL_INT(NUM135, status);
}
#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Verify key
// end+++++++++++++++++++++++++++++++++++++++++++++++++++++++0350-0510
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册