• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*############################################################################
2 # Copyright 2017 Intel Corporation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 ############################################################################*/
16 /// TPM fixture class.
17 /*! \file */
18 #ifndef EPID_MEMBER_TPM2_UNITTESTS_TPM2_TESTHELPER_H_
19 #define EPID_MEMBER_TPM2_UNITTESTS_TPM2_TESTHELPER_H_
20 
21 #include <stdint.h>
22 #include <climits>
23 #include <vector>
24 
25 #include "epid/common-testhelper/epid_gtest-testhelper.h"
26 #include "epid/member/tpm2/unittests/tpm2_wrapper-testhelper.h"
27 #include "gtest/gtest.h"
28 
29 extern "C" {
30 #include "epid/common/bitsupplier.h"
31 #include "epid/common/src/hashsize.h"
32 #include "epid/member/tpm2/context.h"
33 }
34 
35 typedef struct FqElemStr FqElemStr;
36 typedef struct FpElemStr FpElemStr;
37 typedef struct G1ElemStr G1ElemStr;
38 
39 /// Test fixture class for Tpm
40 class EpidTpm2Test : public ::testing::Test {
41  public:
42   // tpm digest
43   static const std::vector<uint8_t> kTpmFfElemStrData;
44   static const G1ElemStr kEpidPointStr;
45   static const uint8_t kDigestSha256[EPID_SHA256_DIGEST_BITSIZE / CHAR_BIT];
46 
47   static const FpElemStr kMemberFValue;
48   static const G1ElemStr kP1Str;
49   static const G1ElemStr kg1Str;
50   static const std::vector<uint8_t> kS2Sha256;
51   static const FqElemStr kY2Sha256Str;
52   static const G1ElemStr kP2Sha256Str;
53   static const G1ElemStr kP2Sha256ExpF;
54   static const std::vector<uint8_t> kS2Sha384;
55   static const FqElemStr kY2Sha384Str;
56   static const G1ElemStr kP2Sha384Str;
57   static const G1ElemStr kP2Sha384ExpF;
58   static const std::vector<uint8_t> kS2Sha512;
59   static const FqElemStr kY2Sha512Str;
60   static const G1ElemStr kP2Sha512Str;
61   static const G1ElemStr kP2Sha512ExpF;
62   static const std::vector<uint8_t> kS2Sha512256;
63   static const FqElemStr kY2Sha512256Str;
64   static const G1ElemStr kP2Sha512256Str;
65   static const G1ElemStr kP2Sha512256ExpF;
66   /// setup called before each TEST_F starts
SetUp()67   virtual void SetUp() {}
68   /// teardown called after each TEST_F finishes
TearDown()69   virtual void TearDown() {}
70 };
71 
72 /// compares FpElemStr values
73 bool operator==(FpElemStr const& lhs, FpElemStr const& rhs);
74 
75 /// compares G1ElemStr values
76 bool operator==(G1ElemStr const& lhs, G1ElemStr const& rhs);
77 
78 #endif  // EPID_MEMBER_TPM2_UNITTESTS_TPM2_TESTHELPER_H_
79