1 /*
2 * Copyright (C) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17
18 #include "hks_aes_test.h"
19
20 #include "hks_api.h"
21 #include "hks_param.h"
22 #include "hks_test_aes.h"
23
24 using namespace testing::ext;
25 namespace {
26 class HksAesTest : public testing::Test {
27 public:
28 static void SetUpTestCase(void);
29
30 static void TearDownTestCase(void);
31
32 void SetUp();
33
34 void TearDown();
35 };
36
SetUpTestCase(void)37 void HksAesTest::SetUpTestCase(void)
38 {
39 }
40
TearDownTestCase(void)41 void HksAesTest::TearDownTestCase(void)
42 {
43 }
44
SetUp()45 void HksAesTest::SetUp()
46 {
47 EXPECT_EQ(HksInitialize(), 0);
48 }
49
TearDown()50 void HksAesTest::TearDown()
51 {
52 }
53
54 #ifndef _CUT_AUTHENTICATE_
55 /**
56 * @tc.name: HksCipherTest.HksCipherTest001
57 * @tc.desc: The static function will return true;
58 * @tc.type: FUNC
59 */
60 HWTEST_F(HksAesTest, HksAesTest001, TestSize.Level0)
61 {
62 ASSERT_TRUE(TestAes256ByAgree() == 0);
63 }
64
65 /**
66 * @tc.name: HksCipherTest.HksCipherTest002
67 * @tc.desc: The static function will return true;
68 * @tc.type: FUNC
69 */
70 HWTEST_F(HksAesTest, HksAesTest002, TestSize.Level0)
71 {
72 ASSERT_TRUE(TestAes256ByAgree1() == 0);
73 }
74
75 /**
76 * @tc.name: HksCipherTest.HksCipherTest003
77 * @tc.desc: The static function will return true;
78 * @tc.type: FUNC
79 */
80 HWTEST_F(HksAesTest, HksAesTest003, TestSize.Level0)
81 {
82 ASSERT_TRUE(TestAes256ByAgree2() == 0);
83 }
84 #endif /* _CUT_AUTHENTICATE_ */
85
86 /**
87 * @tc.name: HksCipherTest.HksCipherTest003
88 * @tc.desc: The static function will return true;
89 * @tc.type: FUNC
90 */
91 HWTEST_F(HksAesTest, HksAesTest004, TestSize.Level0)
92 {
93 ASSERT_EQ(TestAes256ByLocal(), 0);
94 }
95 }
96