From 64d9cb59340e23457de63345517276599b71c8b4 Mon Sep 17 00:00:00 2001 From: aaronwangjun Date: Fri, 16 Apr 2021 19:53:33 +0800 Subject: [PATCH] fix failed testcases Change-Id: I1fe6d28cafd2d1bc5ba0038dd7ba33fd969a542e --- security_lite/datahuks_hal/BUILD.gn | 5 ++++- .../src/security_data_huks_export_hash_random_test.c | 6 ++++-- .../src/security_data_huks_gen_del_test.c | 11 ++++++++++- .../src/security_data_huks_sign_verify_test.c | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/security_lite/datahuks_hal/BUILD.gn b/security_lite/datahuks_hal/BUILD.gn index d16cc683f..8f779440c 100755 --- a/security_lite/datahuks_hal/BUILD.gn +++ b/security_lite/datahuks_hal/BUILD.gn @@ -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/", diff --git a/security_lite/datahuks_hal/src/security_data_huks_export_hash_random_test.c b/security_lite/datahuks_hal/src/security_data_huks_export_hash_random_test.c index 82594b112..daf7db678 100755 --- a/security_lite/datahuks_hal/src/security_data_huks_export_hash_random_test.c +++ b/security_lite/datahuks_hal/src/security_data_huks_export_hash_random_test.c @@ -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 diff --git a/security_lite/datahuks_hal/src/security_data_huks_gen_del_test.c b/security_lite/datahuks_hal/src/security_data_huks_gen_del_test.c index bd0e029af..e5563540c 100755 --- a/security_lite/datahuks_hal/src/security_data_huks_gen_del_test.c +++ b/security_lite/datahuks_hal/src/security_data_huks_gen_del_test.c @@ -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); diff --git a/security_lite/datahuks_hal/src/security_data_huks_sign_verify_test.c b/security_lite/datahuks_hal/src/security_data_huks_sign_verify_test.c index f209bd309..aedc6983f 100755 --- a/security_lite/datahuks_hal/src/security_data_huks_sign_verify_test.c +++ b/security_lite/datahuks_hal/src/security_data_huks_sign_verify_test.c @@ -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 -- GitLab