1 /* 2 * Copyright 2015 The Chromium OS Authors. All rights reserved. 3 * Use of this source code is governed by a BSD-style license that can be 4 * found in the LICENSE file. 5 */ 6 7 #ifndef __TPM2_MARSHAL_FP_H 8 #define __TPM2_MARSHAL_FP_H 9 10 UINT16 Common_Marshal(void *source, BYTE **buffer, INT32 *size, 11 UINT16 type_size); 12 TPM_RC Common_Unmarshal(void *source, BYTE **buffer, INT32 *size, 13 UINT16 type_size); 14 15 #define MARSHAL_WRAPPER(name) \ 16 static inline UINT16 name##_Marshal(void *x, BYTE **y, INT32 *z) { \ 17 return Common_Marshal(x, y, z, sizeof(name)); \ 18 } \ 19 static inline TPM_RC name##_Unmarshal(void *x, BYTE **y, INT32 *z) { \ 20 return Common_Unmarshal(x, y, z, sizeof(name)); \ 21 } 22 23 MARSHAL_WRAPPER(SESSION) 24 MARSHAL_WRAPPER(TPM2B_AUTH) 25 MARSHAL_WRAPPER(TPM2B_DIGEST) 26 MARSHAL_WRAPPER(TPM2B_IV) 27 MARSHAL_WRAPPER(TPM2B_NONCE) 28 MARSHAL_WRAPPER(TPMA_LOCALITY) 29 MARSHAL_WRAPPER(TPMA_SESSION) 30 MARSHAL_WRAPPER(TPMI_SH_AUTH_SESSION) 31 MARSHAL_WRAPPER(TPMI_ST_COMMAND_TAG) 32 MARSHAL_WRAPPER(TPML_PCR_SELECTION) 33 MARSHAL_WRAPPER(TPMS_ATTEST) 34 MARSHAL_WRAPPER(TPMS_CREATION_DATA) 35 MARSHAL_WRAPPER(TPMS_ECC_POINT) 36 MARSHAL_WRAPPER(TPMS_NV_PUBLIC) 37 MARSHAL_WRAPPER(TPMS_TIME_INFO) 38 MARSHAL_WRAPPER(TPMT_PUBLIC) 39 MARSHAL_WRAPPER(TPMT_SENSITIVE) 40 MARSHAL_WRAPPER(TPM_CC) 41 MARSHAL_WRAPPER(TPM_GENERATED) 42 MARSHAL_WRAPPER(TPM_HANDLE) 43 MARSHAL_WRAPPER(TPM_RC) 44 MARSHAL_WRAPPER(TPM_ST) 45 MARSHAL_WRAPPER(UINT16) 46 MARSHAL_WRAPPER(UINT32) 47 48 UINT16 TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *x, BYTE **y, INT32 *z, 49 TPMI_ALG_PUBLIC type); 50 51 #endif // __TPM2_MARSHAL_FP_H 52