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 17 /*! 18 * \file 19 * \brief Intel(R) EPID 1.1 Pairing interface. 20 */ 21 22 #ifndef EPID_COMMON_MATH_TATEPAIRING_H_ 23 #define EPID_COMMON_MATH_TATEPAIRING_H_ 24 25 #include "epid/common/errors.h" 26 #include "epid/common/math/ecgroup.h" 27 #include "epid/common/math/finitefield.h" 28 #include "epid/common/types.h" 29 30 /// Intel(R) EPID 1.1 pairing operations 31 /*! 32 33 \defgroup Epid11PairingPrimitives Intel(R) EPID 1.1 specific pairing 34 Provides APIs for defining and using a pairing relationship between two 35 Elliptic curve groups. 36 37 These pairing operations are intended to support Intel(R) EPID 38 1.1 verification. 39 40 \ingroup PairingPrimitives 41 \see <a href="group___epid11_verifier_module.html#details"><b>Intel(R) EPID 42 1.1 43 support</b></a> 44 @{ 45 */ 46 47 /// A pairing 48 typedef struct Epid11PairingState Epid11PairingState; 49 50 /// Constructs a new Tate pairing state. 51 /*! 52 Allocates memory and creates a new pairing state for Tate pairing. 53 54 Use DeleteEpid11PairingState() to free memory. 55 56 This pairing operation is intended to support Intel(R) EPID 57 1.1 verification. 58 59 \param[in] ga 60 The EcGroup from which the first parameter of the pairing will be taken. 61 \param[in] gb 62 The EcGroup from which the second parameter of the pairing will be taken. 63 \param[in] ff 64 The result finite field. Must be a Fq12 field. 65 \param[out] ps 66 Newly constructed pairing state. 67 68 \returns ::EpidStatus 69 70 \attention It is the responsibility of the caller to ensure that ga, gb, and 71 ff exist for the entire lifetime of the new Epid11PairingState. 72 73 \see DeleteEpid11PairingState 74 \see <a href="group___epid11_verifier_module.html#details"><b>Intel(R) EPID 1.1 75 support</b></a> 76 */ 77 EpidStatus NewEpid11PairingState(EcGroup const* ga, EcGroup const* gb, 78 FiniteField const* ff, 79 Epid11PairingState** ps); 80 81 /// Frees a previously allocated by Epid11PairingState. 82 /*! 83 Frees memory pointed to by pairing state. Nulls the pointer. 84 85 This pairing operation is intended to support Intel(R) EPID 86 1.1 verification. 87 88 \param[in] ps 89 The pairing state. Can be NULL. 90 91 \see NewEpid11PairingState 92 \see <a href="group___epid11_verifier_module.html#details"><b>Intel(R) EPID 1.1 93 support</b></a> 94 */ 95 void DeleteEpid11PairingState(Epid11PairingState** ps); 96 97 /// Computes a Tate Pairing for two parameters. 98 /*! 99 This pairing operation is intended to support Intel(R) EPID 100 1.1 verification. It frees memory pointed to by an Intel(R) EPID 101 1.1 pairing state. 102 103 \param[in] ps 104 The pairing state. 105 \param[in] a 106 The first value to pair. Must be in ga. 107 \param[in] b 108 The second value to pair. Must be in gb. 109 \param[out] d 110 The result of the pairing. Must be in ff. 111 112 \returns ::EpidStatus 113 114 \see <a href="group___epid11_verifier_module.html#details"><b>Intel(R) EPID 1.1 115 support</b></a> 116 */ 117 EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a, 118 EcPoint const* b, FfElement* d); 119 120 /*! 121 @} 122 */ 123 124 #endif // EPID_COMMON_MATH_TATEPAIRING_H_ 125