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 "securec.h"
21
22 #include "hks_api.h"
23 #include "hks_param.h"
24 #include "hks_test_aes.h"
25
26 using namespace testing::ext;
27 namespace {
28 class HksAesTest : public testing::Test {
29 public:
30 static void SetUpTestCase(void);
31
32 static void TearDownTestCase(void);
33
34 void SetUp();
35
36 void TearDown();
37 };
38
SetUpTestCase(void)39 void HksAesTest::SetUpTestCase(void)
40 {
41 }
42
TearDownTestCase(void)43 void HksAesTest::TearDownTestCase(void)
44 {
45 }
46
SetUp()47 void HksAesTest::SetUp()
48 {
49 EXPECT_EQ(HksInitialize(), 0);
50 }
51
TearDown()52 void HksAesTest::TearDown()
53 {
54 }
55
56 #ifndef _CUT_AUTHENTICATE_
57 /**
58 * @tc.name: HksCipherTest.HksCipherTest001
59 * @tc.desc: The static function will return true;
60 * @tc.type: FUNC
61 */
62 HWTEST_F(HksAesTest, HksAesTest001, TestSize.Level1)
63 {
64 ASSERT_TRUE(TestAes256ByAgree() == 0);
65 }
66
67 /**
68 * @tc.name: HksCipherTest.HksCipherTest002
69 * @tc.desc: The static function will return true;
70 * @tc.type: FUNC
71 */
72 HWTEST_F(HksAesTest, HksAesTest002, TestSize.Level1)
73 {
74 ASSERT_TRUE(TestAes256ByAgree1() == 0);
75 }
76
77 /**
78 * @tc.name: HksCipherTest.HksCipherTest003
79 * @tc.desc: The static function will return true;
80 * @tc.type: FUNC
81 */
82 HWTEST_F(HksAesTest, HksAesTest003, TestSize.Level1)
83 {
84 ASSERT_TRUE(TestAes256ByAgree2() == 0);
85 }
86 #endif /* _CUT_AUTHENTICATE_ */
87
88 /**
89 * @tc.name: HksCipherTest.HksCipherTest003
90 * @tc.desc: The static function will return true;
91 * @tc.type: FUNC
92 */
93 HWTEST_F(HksAesTest, HksAesTest004, TestSize.Level1)
94 {
95 ASSERT_EQ(TestAes256ByLocal(), 0);
96 }
97 }
98