• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*############################################################################
2   # Copyright 2016-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 #ifndef EPID_COMMON_SRC_EPID2PARAMS_H_
17 #define EPID_COMMON_SRC_EPID2PARAMS_H_
18 /*!
19  * \file
20  * \brief Intel(R) EPID 2.0 constant parameters interface.
21  * \addtogroup EpidCommon
22  * @{
23  */
24 #include "epid/common/math/bignum.h"
25 #include "epid/common/math/ecgroup.h"
26 #include "epid/common/math/finitefield.h"
27 #include "epid/common/math/pairing.h"
28 
29 /// Internal representation of Epid2Params
30 typedef struct Epid2Params_ {
31   BigNum* p;      ///< a prime
32   BigNum* q;      ///< a prime
33   FfElement* b;   ///< an integer between [0, q-1]
34   BigNum* t;      ///< an integer
35   bool neg;       ///< a boolean
36   FfElement* xi;  ///< array of integers between [0, q-1]
37   EcPoint* g1;    ///<  a generator (an element) of G1
38   EcPoint* g2;    ///<  a generator (an element) of G2
39 
40   FiniteField* Fp;  ///< Finite field Fp
41 
42   FiniteField* Fq;   ///< Finite field Fq
43   FiniteField* Fq2;  ///< Finite field Fq2
44   FiniteField* Fq6;  ///< Finite field Fq6
45   FiniteField* GT;   ///< Finite field GT(Fq12 )
46 
47   EcGroup* G1;  ///< Elliptic curve group over finite field Fq
48   EcGroup* G2;  ///< Elliptic curve group over finite field Fq2
49 
50   PairingState* pairing_state;  ///< Pairing state
51 } Epid2Params_;
52 
53 /// Constructs the internal representation of Epid2Params
54 /*!
55   Allocates memory for the internal representation of Epid2Params. Initialize
56   the Epid2Params. Use DeleteEpid2Params() to deallocate memory.
57 
58   \param[in,out] params
59   Internal Epid2Params
60 
61   \returns ::EpidStatus
62   \see DeleteEpid2Params
63 */
64 EpidStatus CreateEpid2Params(Epid2Params_** params);
65 /// Deallocates storage for internal representation of Epid2Params
66 /*!
67   Frees the memory and nulls the pointer.
68 
69   \param[in,out] epid_params
70   params to be deallocated
71 
72   \see CreateEpid2Params
73 */
74 void DeleteEpid2Params(Epid2Params_** epid_params);
75 /*! @} */
76 #endif  // EPID_COMMON_SRC_EPID2PARAMS_H_
77