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