blob: 21088f0be341b414ea5f45106010eb93607606d1 [file] [log] [blame]
Vadim Bendeburyb86371b2015-05-27 18:16:19 -07001/*
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
10UINT16 Common_Marshal(void *source, BYTE **buffer, INT32 *size,
11 UINT16 type_size);
12TPM_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
Vadim Bendebury3743ac12015-05-29 22:44:14 -070023MARSHAL_WRAPPER(TPM2B_DIGEST)
Vadim Bendeburyfe7bde42015-06-01 10:55:46 -070024MARSHAL_WRAPPER(TPM2B_IV)
Vadim Bendebury55567c82015-06-01 14:42:10 -070025MARSHAL_WRAPPER(TPMA_LOCALITY)
Vadim Bendeburyda725062015-05-31 14:41:18 -070026MARSHAL_WRAPPER(TPMI_ST_COMMAND_TAG)
Vadim Bendeburyb86371b2015-05-27 18:16:19 -070027MARSHAL_WRAPPER(TPMS_ATTEST)
Vadim Bendeburyfe7bde42015-06-01 10:55:46 -070028MARSHAL_WRAPPER(TPMS_CREATION_DATA)
Vadim Bendebury6bb41ff2015-05-29 22:43:25 -070029MARSHAL_WRAPPER(TPMS_ECC_POINT)
Vadim Bendebury6c73a9e2015-05-31 16:06:18 -070030MARSHAL_WRAPPER(TPMS_NV_PUBLIC)
Vadim Bendebury5f320632015-06-01 10:20:42 -070031MARSHAL_WRAPPER(TPMT_PUBLIC)
Vadim Bendeburyfe7bde42015-06-01 10:55:46 -070032MARSHAL_WRAPPER(TPMT_SENSITIVE)
Vadim Bendeburyda725062015-05-31 14:41:18 -070033MARSHAL_WRAPPER(TPM_CC)
Vadim Bendeburyb86371b2015-05-27 18:16:19 -070034MARSHAL_WRAPPER(TPM_HANDLE)
Vadim Bendeburyda725062015-05-31 14:41:18 -070035MARSHAL_WRAPPER(TPM_RC)
36MARSHAL_WRAPPER(TPM_ST)
Vadim Bendeburyfe7bde42015-06-01 10:55:46 -070037MARSHAL_WRAPPER(UINT16)
Vadim Bendeburyda725062015-05-31 14:41:18 -070038MARSHAL_WRAPPER(UINT32)
Vadim Bendeburyb86371b2015-05-27 18:16:19 -070039
Vadim Bendeburyfe7bde42015-06-01 10:55:46 -070040UINT16 TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *x, BYTE **y,
41 INT32 *z, TPMI_ALG_PUBLIC type);
42
Vadim Bendeburyb86371b2015-05-27 18:16:19 -070043#endif // __TPM2_MARSHAL_FP_H