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 /// Definition of de/serialize functionality. 17 18 #ifndef EPID_MEMBER_TINY_SRC_SERIALIZE_H_ 19 #define EPID_MEMBER_TINY_SRC_SERIALIZE_H_ 20 21 /// \cond 22 typedef struct BasicSignature BasicSignature; 23 typedef struct NativeBasicSignature NativeBasicSignature; 24 25 typedef struct GroupPubKey GroupPubKey; 26 typedef struct NativeGroupPubKey NativeGroupPubKey; 27 28 typedef struct PrivKey PrivKey; 29 typedef struct NativePrivKey NativePrivKey; 30 31 typedef struct MembershipCredential MembershipCredential; 32 typedef struct NativeMembershipCredential NativeMembershipCredential; 33 34 typedef struct MemberPrecomp MemberPrecomp; 35 typedef struct NativeMemberPrecomp NativeMemberPrecomp; 36 /// \endcond 37 38 /// Write a basic signature to a portable buffer 39 /*! 40 \param[out] dest target buffer 41 \param [in] src source data 42 \result pointer to next byte after final data written to dest 43 */ 44 void* BasicSignatureSerialize(BasicSignature* dest, 45 NativeBasicSignature const* src); 46 47 /// Read a basic signature from a portable buffer 48 /*! 49 \param[out] dest target buffer 50 \param [in] src source data 51 \result pointer to next byte after final data read from to src 52 */ 53 void const* BasicSignatureDeserialize(NativeBasicSignature* dest, 54 BasicSignature const* src); 55 56 /// Write a group public key to a portable buffer 57 /*! 58 \param[out] dest target buffer 59 \param [in] src source data 60 \result pointer to next byte after final data written to dest 61 */ 62 void* GroupPubKeySerialize(GroupPubKey* dest, NativeGroupPubKey const* src); 63 64 /// Read a group public key from a portable buffer 65 /*! 66 \param[out] dest target buffer 67 \param [in] src source data 68 \result pointer to next byte after final data read from to src 69 */ 70 void const* GroupPubKeyDeserialize(NativeGroupPubKey* dest, 71 GroupPubKey const* src); 72 73 /// Read a member private key from a portable buffer 74 /*! 75 \param[out] dest target buffer 76 \param [in] src source data 77 \result pointer to next byte after final data read from to src 78 */ 79 void const* PrivKeyDeserialize(NativePrivKey* dest, PrivKey const* src); 80 81 /// Read pairing pre-computation data from a portable buffer 82 /*! 83 \param[out] dest target buffer 84 \param [in] src source data 85 \result pointer to next byte after final data read from to src 86 */ 87 void const* PreCompDeserialize(NativeMemberPrecomp* dest, 88 MemberPrecomp const* src); 89 90 /// Read a membership credential from a portable buffer 91 /*! 92 \param[out] dest target buffer 93 \param [in] src source data 94 \result pointer to next byte after final data read from to src 95 */ 96 void const* MembershipCredentialDeserialize(NativeMembershipCredential* dest, 97 MembershipCredential const* src); 98 #endif // EPID_MEMBER_TINY_SRC_SERIALIZE_H_ 99