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 /// Types in the native format
17 /*! \file */
18 #ifndef EPID_MEMBER_TINY_SRC_NATIVE_TYPES_H_
19 #define EPID_MEMBER_TINY_SRC_NATIVE_TYPES_H_
20 
21 #include "epid/common/types.h"
22 #include "epid/member/tiny/math/mathtypes.h"
23 
24 /// Group public key in unserialized format
25 typedef struct NativeGroupPubKey {
26   GroupId gid;    ///< group ID
27   EccPointFq h1;  ///< an element in G1
28   EccPointFq h2;  ///< an element in G1
29   EccPointFq2 w;  ///< an element in G2
30 } NativeGroupPubKey;
31 
32 /// Membership credential in unserialized format
33 typedef struct NativeMembershipCredential {
34   GroupId gid;   ///< group ID
35   EccPointFq A;  ///< an element in G1
36   FpElem x;      ///< an integer between [0, p-1]
37 } NativeMembershipCredential;
38 
39 /// Private key in unserialized format
40 typedef struct NativePrivKey {
41   NativeMembershipCredential cred;  ///< membership credential
42   FpElem f;                         ///< an integer between [0, p-1]
43 } NativePrivKey;
44 
45 /// Precomputed pairing values
46 typedef struct NativeMemberPrecomp {
47   Fq12Elem e12;  ///< an element in GT
48   Fq12Elem e22;  ///< an element in GT
49   Fq12Elem e2w;  ///< an element in GT
50   Fq12Elem ea2;  ///< an element in GT
51 } NativeMemberPrecomp;
52 
53 /// Intel(R) EPID Basic Signature
54 typedef struct NativeBasicSignature {
55   EccPointFq B;  ///< an element in G1
56   EccPointFq K;  ///< an element in G1
57   EccPointFq T;  ///< an element in G1
58   FpElem c;      ///< an integer between [0, p-1]
59   FpElem sx;     ///< an integer between [0, p-1]
60   FpElem sf;     ///< an integer between [0, p-1]
61   FpElem sa;     ///< an integer between [0, p-1]
62   FpElem sb;     ///< an integer between [0, p-1]
63 } NativeBasicSignature;
64 #endif  // EPID_MEMBER_TINY_SRC_NATIVE_TYPES_H_
65