sign_commitment.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /// Host signing helper APIs
  17. /*! \file */
  18. #ifndef EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
  19. #define EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
  20. #include <stddef.h>
  21. #include "epid/common/errors.h"
  22. #include "epid/common/types.h" // HashAlg
  23. #pragma pack(1)
  24. /// Result of Sign Commit
  25. typedef struct SignCommitOutput {
  26. G1ElemStr B; ///< B value for signature
  27. G1ElemStr K; ///< K value for signature
  28. G1ElemStr T; ///< T value for signature
  29. G1ElemStr R1; ///< Serialized G1 element
  30. GtElemStr R2; ///< Serialized GT element
  31. } SignCommitOutput;
  32. #pragma pack()
  33. typedef struct SignCommitOutput SignCommitOutput;
  34. /// \cond
  35. typedef struct FiniteField FiniteField;
  36. typedef struct FpElemStr FpElemStr;
  37. /// \endcond
  38. /// Calculates commitment hash of sign commit
  39. /*!
  40. \param[in] Fp
  41. The finite field.
  42. \param[in] hash_alg
  43. The hash algorithm.
  44. \param[in] commit_out
  45. The output from the sign commit.
  46. \param[in] msg
  47. The message.
  48. \param[in] msg_len
  49. The size of message in bytes.
  50. \param[out] c_str
  51. The resulting commitment hash.
  52. \returns ::EpidStatus
  53. */
  54. EpidStatus HashSignCommitment(FiniteField* Fp, HashAlg hash_alg,
  55. GroupPubKey const* pub_key,
  56. SignCommitOutput const* commit_out,
  57. void const* msg, size_t msg_len,
  58. FpElemStr* c_str);
  59. #endif // EPID_MEMBER_SRC_SIGN_COMMITMENT_H_