storage.h 2.2 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. /// Member credentials storage helper API
  17. /*! \file */
  18. #ifndef EPID_MEMBER_SRC_STORAGE_H_
  19. #define EPID_MEMBER_SRC_STORAGE_H_
  20. #include <stdint.h>
  21. #include "epid/common/errors.h"
  22. /// \cond
  23. typedef struct Tpm2Ctx Tpm2Ctx;
  24. typedef struct GroupPubKey GroupPubKey;
  25. typedef struct MembershipCredential MembershipCredential;
  26. /// \endcond
  27. /// Write membership credential to TPM non-volatile memory.
  28. /*!
  29. Allocates TPM non volatile memory for nv_index for membership credentials.
  30. Write group public key and member private key parameters A and x into
  31. space allocated.
  32. \param[in] ctx
  33. The TPM context.
  34. \param[in] pub_key
  35. Group public key.
  36. \param[in] credential
  37. Membership credential.
  38. \param[in] nv_index
  39. Handle of the data area to be defined.
  40. \returns ::EpidStatus
  41. \see EpidNvReadMembershipCredential
  42. */
  43. EpidStatus EpidNvWriteMembershipCredential(
  44. Tpm2Ctx* ctx, GroupPubKey const* pub_key,
  45. MembershipCredential const* credential, uint32_t nv_index);
  46. /// Read membership credential from TPM non-volatile memory.
  47. /*!
  48. \param[in] ctx
  49. The TPM context.
  50. \param[in] nv_index
  51. Handle of the data area.
  52. \param[out] pub_key
  53. Group public key.
  54. \param[out] credential
  55. Membership credential.
  56. \returns ::EpidStatus
  57. \see EpidNvWriteMembershipCredential
  58. */
  59. EpidStatus EpidNvReadMembershipCredential(Tpm2Ctx* ctx, uint32_t nv_index,
  60. GroupPubKey* pub_key,
  61. MembershipCredential* credential);
  62. #endif // EPID_MEMBER_SRC_STORAGE_H_