Vadim Bendebury | b86371b | 2015-05-27 18:16:19 -0700 | [diff] [blame] | 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 | |
Vadim Bendebury | 3743ac1 | 2015-05-29 22:44:14 -0700 | [diff] [blame] | 23 | MARSHAL_WRAPPER(TPM2B_DIGEST) |
Vadim Bendebury | fe7bde4 | 2015-06-01 10:55:46 -0700 | [diff] [blame] | 24 | MARSHAL_WRAPPER(TPM2B_IV) |
Vadim Bendebury | 55567c8 | 2015-06-01 14:42:10 -0700 | [diff] [blame^] | 25 | MARSHAL_WRAPPER(TPMA_LOCALITY) |
Vadim Bendebury | da72506 | 2015-05-31 14:41:18 -0700 | [diff] [blame] | 26 | MARSHAL_WRAPPER(TPMI_ST_COMMAND_TAG) |
Vadim Bendebury | b86371b | 2015-05-27 18:16:19 -0700 | [diff] [blame] | 27 | MARSHAL_WRAPPER(TPMS_ATTEST) |
Vadim Bendebury | fe7bde4 | 2015-06-01 10:55:46 -0700 | [diff] [blame] | 28 | MARSHAL_WRAPPER(TPMS_CREATION_DATA) |
Vadim Bendebury | 6bb41ff | 2015-05-29 22:43:25 -0700 | [diff] [blame] | 29 | MARSHAL_WRAPPER(TPMS_ECC_POINT) |
Vadim Bendebury | 6c73a9e | 2015-05-31 16:06:18 -0700 | [diff] [blame] | 30 | MARSHAL_WRAPPER(TPMS_NV_PUBLIC) |
Vadim Bendebury | 5f32063 | 2015-06-01 10:20:42 -0700 | [diff] [blame] | 31 | MARSHAL_WRAPPER(TPMT_PUBLIC) |
Vadim Bendebury | fe7bde4 | 2015-06-01 10:55:46 -0700 | [diff] [blame] | 32 | MARSHAL_WRAPPER(TPMT_SENSITIVE) |
Vadim Bendebury | da72506 | 2015-05-31 14:41:18 -0700 | [diff] [blame] | 33 | MARSHAL_WRAPPER(TPM_CC) |
Vadim Bendebury | b86371b | 2015-05-27 18:16:19 -0700 | [diff] [blame] | 34 | MARSHAL_WRAPPER(TPM_HANDLE) |
Vadim Bendebury | da72506 | 2015-05-31 14:41:18 -0700 | [diff] [blame] | 35 | MARSHAL_WRAPPER(TPM_RC) |
| 36 | MARSHAL_WRAPPER(TPM_ST) |
Vadim Bendebury | fe7bde4 | 2015-06-01 10:55:46 -0700 | [diff] [blame] | 37 | MARSHAL_WRAPPER(UINT16) |
Vadim Bendebury | da72506 | 2015-05-31 14:41:18 -0700 | [diff] [blame] | 38 | MARSHAL_WRAPPER(UINT32) |
Vadim Bendebury | b86371b | 2015-05-27 18:16:19 -0700 | [diff] [blame] | 39 | |
Vadim Bendebury | fe7bde4 | 2015-06-01 10:55:46 -0700 | [diff] [blame] | 40 | UINT16 TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *x, BYTE **y, |
| 41 | INT32 *z, TPMI_ALG_PUBLIC type); |
| 42 | |
Vadim Bendebury | b86371b | 2015-05-27 18:16:19 -0700 | [diff] [blame] | 43 | #endif // __TPM2_MARSHAL_FP_H |