1 // This file was extracted from the TCG Published 2 // Trusted Platform Module Library 3 // Part 4: Supporting Routines 4 // Family "2.0" 5 // Level 00 Revision 01.16 6 // October 30, 2014 7 8 #ifndef _TPMB_H 9 #define _TPMB_H 10 // 11 // This macro helps avoid having to type in the structure in order to create a new TPM2B type that is used in 12 // a function. 13 // 14 #define TPM2B_TYPE(name, bytes) \ 15 typedef union { \ 16 struct { \ 17 UINT16 size; \ 18 BYTE buffer[(bytes)]; \ 19 } t; \ 20 TPM2B b; \ 21 } TPM2B_##name 22 // 23 // Macro to instance and initialize a TPM2B value 24 // 25 #define TPM2B_INIT(TYPE, name) \ 26 TPM2B_##TYPE name = {sizeof(name.t.buffer), {0}} 27 #define TPM2B_BYTE_VALUE(bytes) TPM2B_TYPE(bytes##_BYTE_VALUE, bytes) 28 #endif 29