commit.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /// SDK TPM Commit API.
  17. /*! \file */
  18. #ifndef EPID_MEMBER_TPM2_COMMIT_H_
  19. #define EPID_MEMBER_TPM2_COMMIT_H_
  20. #include <stddef.h>
  21. #include "epid/common/errors.h"
  22. #include "epid/common/stdtypes.h"
  23. /// \cond
  24. typedef struct Tpm2Ctx Tpm2Ctx;
  25. typedef struct FfElement FfElement;
  26. typedef struct EcPoint EcPoint;
  27. /// \endcond
  28. /*!
  29. \addtogroup Tpm2Module tpm2
  30. \ingroup EpidMemberModule
  31. @{
  32. */
  33. /// Performs TPM2_Commit TPM operation.
  34. /*!
  35. Generates random r and compute K, L and E points.
  36. \param[in] ctx
  37. The TPM context.
  38. \param[in] p1
  39. A point P1 on G1 curve.
  40. \param[in] s2
  41. Octet array used to derive x-coordinate of a point P2.
  42. \param[in] s2_len
  43. Length of s2 buffer.
  44. \param[in] y2
  45. y coordinate of the point associated with s2.
  46. \param[out] k
  47. Result of G1.exp(P2, private key f).
  48. \param[out] l
  49. Result of G1.exp(P2, random r).
  50. \param[out] e
  51. Result of G1.exp(P1, random r).
  52. \param[out] counter
  53. A value associated with the random r. Should be initialized with zero.
  54. \returns ::EpidStatus
  55. \see Tpm2CreateContext
  56. */
  57. EpidStatus Tpm2Commit(Tpm2Ctx* ctx, EcPoint const* p1, void const* s2,
  58. size_t s2_len, FfElement const* y2, EcPoint* k,
  59. EcPoint* l, EcPoint* e, uint16_t* counter);
  60. /*! @} */
  61. #endif // EPID_MEMBER_TPM2_COMMIT_H_