tatepairing.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. * \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/math/ecgroup.h"
  24. #include "epid/common/math/finitefield.h"
  25. #include "epid/common/types.h"
  26. /// Intel(R) EPID 1.1 pairing operations
  27. /*!
  28. \defgroup Epid11PairingPrimitives Intel(R) 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>Intel(R) EPID
  35. 1.1
  36. support</b></a>
  37. @{
  38. */
  39. /// A pairing
  40. typedef struct Epid11PairingState Epid11PairingState;
  41. /// Constructs a new Tate pairing state.
  42. /*!
  43. Allocates memory and creates a new pairing state for Tate pairing.
  44. Use DeleteEpid11PairingState() to free memory.
  45. This pairing operation is intended to support Intel(R) EPID
  46. 1.1 verification.
  47. \param[in] ga
  48. The EcGroup from which the first parameter of the pairing will be taken.
  49. \param[in] gb
  50. The EcGroup from which the second parameter of the pairing will be taken.
  51. \param[in] ff
  52. The result finite field. Must be a Fq12 field.
  53. \param[out] ps
  54. Newly constructed pairing state.
  55. \returns ::EpidStatus
  56. \attention It is the responsibility of the caller to ensure that ga, gb, and
  57. ff exist for the entire lifetime of the new Epid11PairingState.
  58. \see DeleteEpid11PairingState
  59. \see <a href="group___epid11_verifier_module.html#details"><b>Intel(R) EPID 1.1
  60. support</b></a>
  61. */
  62. EpidStatus NewEpid11PairingState(EcGroup const* ga, EcGroup const* gb,
  63. FiniteField const* ff,
  64. Epid11PairingState** ps);
  65. /// Frees a previously allocated by Epid11PairingState.
  66. /*!
  67. Frees memory pointed to by pairing state. Nulls the pointer.
  68. This pairing operation is intended to support Intel(R) EPID
  69. 1.1 verification.
  70. \param[in] ps
  71. The pairing state. Can be NULL.
  72. \see NewEpid11PairingState
  73. \see <a href="group___epid11_verifier_module.html#details"><b>Intel(R) EPID 1.1
  74. support</b></a>
  75. */
  76. void DeleteEpid11PairingState(Epid11PairingState** ps);
  77. /// Computes a Tate Pairing for two parameters.
  78. /*!
  79. This pairing operation is intended to support Intel(R) EPID
  80. 1.1 verification. It frees memory pointed to by an Intel(R) EPID
  81. 1.1 pairing state.
  82. \param[in] ps
  83. The pairing state.
  84. \param[in] a
  85. The first value to pair. Must be in ga.
  86. \param[in] b
  87. The second value to pair. Must be in gb.
  88. \param[out] d
  89. The result of the pairing. Must be in ff.
  90. \returns ::EpidStatus
  91. \see <a href="group___epid11_verifier_module.html#details"><b>Intel(R) EPID 1.1
  92. support</b></a>
  93. */
  94. EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
  95. EcPoint const* b, FfElement* d);
  96. /*!
  97. @}
  98. */
  99. #endif // EPID_COMMON_MATH_TATEPAIRING_H_