提交 8280c55a 编写于 作者: O openharmony_ci 提交者: Gitee

!1216 设备认证依赖算法测试用例

Merge pull request !1216 from code4lala/master
......@@ -38,6 +38,7 @@ DEVICEAUTH_BASIC_DEPS_CPP_SOURCE = [
"${DEVICEAUTH_BASIC_DEPS_CPP_DIR}/hc_file_iot_flash_test.cpp",
"${DEVICEAUTH_BASIC_DEPS_CPP_DIR}/hc_time_test.cpp",
"${DEVICEAUTH_BASIC_DEPS_CPP_DIR}/hc_file_common.cpp",
"${DEVICEAUTH_BASIC_DEPS_CPP_DIR}/hc_alg_test.cpp",
]
ohos_moduletest_suite("ActsDeviceAuthBasicDepsTest") {
......@@ -84,5 +85,14 @@ ohos_moduletest_suite("ActsDeviceAuthBasicDepsTest") {
"UTILS_FILE_IMPLEMENTED=0",
"TEST_PTHREAD_CREATE_DETACHED=1",
"TEST_HC_FILE_OPEN_SERIES=1",
"TEST_HKDF_WITH_KEY_ALIAS_TRUE=1",
"TEST_IMPORT_ASYMMETRIC_KEY=0",
"TEST_COMPUTEHMAC_WITH_ISALIAS_TRUE=0",
"TEST_HASH_TO_POINT=1",
"TEST_GENERATE_KEY_PAIR_WITH_STORAGE=1",
"TEST_AGREE_SHARED_SECRET_WITH_STORAGE=1",
"TEST_AGREE_SHARED_SECRET=1",
"TEST_BIG_NUM_EXP_MOD=1",
]
}
......@@ -21,6 +21,7 @@
#include <cstring>
#include <ctime>
#include "hc_alg_test.h"
#include "hc_condition_test.h"
#include "hc_dev_info_test.h"
#include "hc_file_f_test.h"
......@@ -186,4 +187,16 @@ HWTEST_F(DeviceAuthTest, TestCaseHcTime, TestSize.Level1)
TestHcTime();
LOGI("++++++++++++++++++++++++++++++++++++++++\n");
}
/**
* @tc.name: DeviceAuthTest.TestCaseHcAlg
* @tc.desc:
* @tc.type: FUNC
*/
HWTEST_F(DeviceAuthTest, TestCaseHcAlg, TestSize.Level1)
{
LOGI("++++++++++++++++++++++++++++++++++++++++\n");
TestHcAlg();
LOGI("++++++++++++++++++++++++++++++++++++++++\n");
}
} // namespace
../../../security_lite/deviceauth_basic_deps/hc_alg_test.c
\ No newline at end of file
......@@ -24,6 +24,9 @@
#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) \
EXPECT_THAT(std::vector<uint8_t>((actual), (actual) + (num_elements)), \
::testing::ElementsAreArray((expected), (num_elements)))
#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) \
EXPECT_THAT(std::vector<uint8_t>((actual), (actual) + (num_elements)), \
::testing::ElementsAreArray((expected), (num_elements))) << (message)
#define TEST_ASSERT_EQUAL(expected, actual) EXPECT_EQ((actual), (expected))
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) EXPECT_EQ((actual), (expected)) << (message)
#define TEST_ASSERT_EQUAL_STRING(expected, actual) EXPECT_STREQ((actual), (expected))
......@@ -35,6 +38,7 @@
#define TEST_ASSERT_NOT_EQUAL(expected, actual) EXPECT_NE((actual), (expected))
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) EXPECT_NE((actual), (expected)) << (message)
#define TEST_ASSERT_NOT_NULL(pointer) EXPECT_NE((pointer), nullptr)
#define TEST_ASSERT_NULL(pointer) EXPECT_EQ((pointer), nullptr)
#define TEST_ASSERT_TRUE(condition) EXPECT_TRUE((condition))
#define TEST_ASSERT_TRUE_MESSAGE(condition, message) EXPECT_TRUE((condition)) << (message)
......
......@@ -50,9 +50,21 @@ hctest_suite("ActsSecurityHichainBasicDeps") {
"UTILS_FILE_IMPLEMENTED=1",
"TEST_PTHREAD_CREATE_DETACHED=0",
"TEST_HC_FILE_OPEN_SERIES=1",
"TEST_HKDF_WITH_KEY_ALIAS_TRUE=1",
"TEST_IMPORT_ASYMMETRIC_KEY=1",
"TEST_COMPUTEHMAC_WITH_ISALIAS_TRUE=1",
"TEST_HASH_TO_POINT=1",
"TEST_GENERATE_KEY_PAIR_WITH_STORAGE=1",
"TEST_AGREE_SHARED_SECRET_WITH_STORAGE=1",
"TEST_AGREE_SHARED_SECRET=1",
"TEST_BIG_NUM_EXP_MOD=1",
]
if (defined(ohos_lite)) {
include_dirs += [
"//base/security/deviceauth/deps_adapter/os_adapter/interfaces/liteos",
]
if (ohos_kernel_type == "liteos_m") {
# liteos m
include_dirs += [ "//base/startup/syspara_lite/interfaces/kits" ]
......@@ -72,6 +84,22 @@ hctest_suite("ActsSecurityHichainBasicDeps") {
}
if (board_name == "hispark_pegasus") {
# 3861
defines -= [
"TEST_HKDF_WITH_KEY_ALIAS_TRUE=1",
"TEST_HASH_TO_POINT=1",
"TEST_GENERATE_KEY_PAIR_WITH_STORAGE=1",
"TEST_AGREE_SHARED_SECRET_WITH_STORAGE=1",
"TEST_AGREE_SHARED_SECRET=1",
"TEST_BIG_NUM_EXP_MOD=1",
]
defines += [
"TEST_HKDF_WITH_KEY_ALIAS_TRUE=0",
"TEST_HASH_TO_POINT=0",
"TEST_GENERATE_KEY_PAIR_WITH_STORAGE=0",
"TEST_AGREE_SHARED_SECRET_WITH_STORAGE=0",
"TEST_AGREE_SHARED_SECRET=0",
"TEST_BIG_NUM_EXP_MOD=0",
]
}
} else {
#liteos a or L1 linux
......
......@@ -27,9 +27,16 @@ DEVICEAUTH_BASIC_DEPS_SOURCE = [
"${DEVICEAUTH_BASIC_DEPS_DIR}/hc_file_iot_flash_test.c",
"${DEVICEAUTH_BASIC_DEPS_DIR}/hc_time_test.c",
"${DEVICEAUTH_BASIC_DEPS_DIR}/hc_file_common.c",
"${DEVICEAUTH_BASIC_DEPS_DIR}/hc_alg_test.c",
]
DEVICEAUTH_BASIC_DEPS_INC = [
"//base/iot_hardware/peripheral/interfaces/kits",
"//utils/native/lite/include", # utils_file.h
"//utils/native/lite/include", # utils_file.h ohos_types.h
# alg test
"//base/security/deviceauth/deps_adapter/key_management_adapter/interfaces",
"//base/security/deviceauth/deps_adapter/os_adapter/interfaces",
"//base/security/deviceauth/common_lib/interfaces",
"//base/security/deviceauth/interfaces/innerkits",
]
此差异已折叠。
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef HC_ALG_TEST_H
#define HC_ALG_TEST_H
#ifdef __cplusplus
extern "C" {
#endif
void TestHcAlg(void);
#ifdef __cplusplus
}
#endif
#endif // HC_ALG_TEST_H
此差异已折叠。
......@@ -22,6 +22,7 @@
#include <string.h>
#include <time.h>
#include "hc_alg_test.h"
#include "hc_condition_test.h"
#include "hc_dev_info_test.h"
#include "hc_file_f_test.h"
......@@ -169,4 +170,16 @@ LITE_TEST_CASE(DeviceAuthBasicDepsTestSuite, TestCaseHcTime, Function | SmallTes
LOGI("++++++++++++++++++++++++++++++++++++++++\n");
}
/**
* @tc.name: DeviceAuthBasicDepsTestSuite.TestCaseHcAlg
* @tc.desc:
* @tc.type: FUNC
*/
LITE_TEST_CASE(DeviceAuthBasicDepsTestSuite, TestCaseHcAlg, Function | SmallTest | Level1)
{
LOGI("++++++++++++++++++++++++++++++++++++++++\n");
TestHcAlg();
LOGI("++++++++++++++++++++++++++++++++++++++++\n");
}
RUN_TEST_SUITE(DeviceAuthBasicDepsTestSuite)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册