nrprove_commitment.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 non-revoked proof helper APIs
  17. /*! \file */
  18. #ifndef EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
  19. #define EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
  20. #include <stddef.h>
  21. #include "epid/common/errors.h"
  22. #include "epid/common/types.h" // HashAlg, G1ElemStr
  23. /// \cond
  24. typedef struct FiniteField FiniteField;
  25. typedef struct FpElemStr FpElemStr;
  26. typedef struct SigRlEntry SigRlEntry;
  27. typedef struct NrProveCommitOutput NrProveCommitOutput;
  28. /// \endcond
  29. #pragma pack(1)
  30. /// Result of NrProve Commit
  31. typedef struct NrProveCommitOutput {
  32. G1ElemStr T; ///< T value for NrProof
  33. G1ElemStr R1; ///< Serialized G1 element
  34. G1ElemStr R2; ///< Serialized G1 element
  35. } NrProveCommitOutput;
  36. #pragma pack()
  37. /// Calculates commitment hash of NrProve commit
  38. /*!
  39. \param[in] Fp
  40. The finite field.
  41. \param[in] hash_alg
  42. The hash algorithm.
  43. \param[in] B_str
  44. The B value from the ::BasicSignature.
  45. \param[in] K_str
  46. The K value from the ::BasicSignature.
  47. \param[in] sigrl_entry
  48. The signature based revocation list entry corresponding to this
  49. proof.
  50. \param[in] commit_out
  51. The output from the NrProve commit.
  52. \param[in] msg
  53. The message.
  54. \param[in] msg_len
  55. The size of message in bytes.
  56. \param[out] c_str
  57. The resulting commitment hash.
  58. \returns ::EpidStatus
  59. */
  60. EpidStatus HashNrProveCommitment(FiniteField* Fp, HashAlg hash_alg,
  61. G1ElemStr const* B_str, G1ElemStr const* K_str,
  62. SigRlEntry const* sigrl_entry,
  63. NrProveCommitOutput const* commit_out,
  64. void const* msg, size_t msg_len,
  65. FpElemStr* c_str);
  66. #endif // EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_