tatepairing.h 3.5 KB

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