marshal: remove the fake na member from TPMU

There is no need to add the fake members to TPMU. We can use the
first member of the union instead. That way we don't have to
polute the TPM types.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
diff --git a/include/sapi/tss2_tpm2_types.h b/include/sapi/tss2_tpm2_types.h
index 1086a34..be6cf18 100644
--- a/include/sapi/tss2_tpm2_types.h
+++ b/include/sapi/tss2_tpm2_types.h
@@ -1195,7 +1195,6 @@
 	BYTE	sha384[TPM2_SHA384_DIGEST_SIZE];	 /* all hashes  */
 	BYTE	sha512[TPM2_SHA512_DIGEST_SIZE];	 /* all hashes  */
 	BYTE	sm3_256[TPM2_SM3_256_DIGEST_SIZE];	 /* all hashes  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_HA;
 
 /* Table 71  Definition of TPMT_HA Structure <INOUT> */
@@ -1238,7 +1237,6 @@
 typedef	union {
 	TPMT_HA	digest;	 /* when the Name is a digest  */
 	TPM2_HANDLE	handle;	 /* when the Name is a handle  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_NAME;
 
 /* Table 83  Definition of TPM2B_NAME Structure */
@@ -1391,7 +1389,6 @@
 	TPML_TAGGED_PCR_PROPERTY	pcrProperties;	 /*   */
 	TPML_ECC_CURVE	eccCurves;	 /* TPM2_ALG_ECC  */
 	TPML_INTEL_PTT_PROPERTY	intelPttProperty;
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_CAPABILITIES;
 
 /* Table 108  Definition of TPMS_CAPABILITY_DATA Structure <OUT> */
@@ -1471,7 +1468,6 @@
 	TPMS_SESSION_AUDIT_INFO	sessionAudit;	 /*  */
 	TPMS_TIME_ATTEST_INFO	time;	 /*  */
 	TPMS_NV_CERTIFY_INFO	nv;	 /*  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_ATTEST;
 
 /* Table 120  Definition of TPMS_ATTEST Structure <OUT> */
@@ -1519,7 +1515,6 @@
 	TPMI_TPM2_CAMELLIA_KEY_BITS	camellia;	 /* all symmetric algorithms  */
 	TPM2_KEY_BITS	sym;	 /* when selector may be any of the symmetric block ciphers  */
 	TPMI_ALG_HASH	exclusiveOr;	 /* overload for using xorNOTE	TPM2_ALG_NULL is not allowed  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_SYM_KEY_BITS;
 
 /* Table 126  Definition of TPMU_SYM_MODE Union */
@@ -1528,7 +1523,6 @@
 	TPMI_ALG_SYM_MODE	sm4;	 /*   */
 	TPMI_ALG_SYM_MODE	camellia;	 /*   */
 	TPMI_ALG_SYM_MODE	sym;	 /* when selector may be any of the symmetric block ciphers  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_SYM_MODE;
 
 /* Table 128  Definition of TPMT_SYM_DEF Structure */
@@ -1592,7 +1586,6 @@
 typedef	union {
 	TPMS_SCHEME_HMAC	hmac;	 /* the signing scheme  */
 	TPMS_SCHEME_XOR	exclusiveOr;	 /* the obfuscation scheme  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_SCHEME_KEYEDHASH;
 
 /* Table 141  Definition of TPMT_KEYEDHASH_SCHEME Structure */
@@ -1621,7 +1614,6 @@
 	TPMS_SIG_SCHEME_ECSCHNORR	ecschnorr;	 /* all signing schemes including anonymous schemes  */
 	TPMS_SCHEME_HMAC	hmac;	 /* the HMAC scheme  */
 	TPMS_SCHEME_HASH	any;	 /* selector that allows access to digest for any signing scheme  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_SIG_SCHEME;
 
 /* Table 145  Definition of TPMT_SIG_SCHEME Structure */
@@ -1650,7 +1642,6 @@
 	TPMS_SCHEME_KDF1_SP800_56A	kdf1_sp800_56a;	 /*   */
 	TPMS_SCHEME_KDF2	kdf2;	 /*   */
 	TPMS_SCHEME_KDF1_SP800_108	kdf1_sp800_108;	 /*   */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_KDF_SCHEME;
 
 /* Table 150  Definition of TPMT_KDF_SCHEME Structure */
@@ -1675,7 +1666,6 @@
 	TPMS_ENC_SCHEME_RSAES	rsaes;	 /* schemes with no hash  */
 	TPMS_ENC_SCHEME_OAEP	oaep;	 /* schemes with no hash  */
 	TPMS_SCHEME_HASH	anySig;	 /*   */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_ASYM_SCHEME;
 
 /* Table 153  Definition of TPMT_ASYM_SCHEME Structure <> */
@@ -1783,7 +1773,6 @@
 	TPMS_SIGNATURE_ECSCHNORR	ecschnorr;	 /* all asymmetric signatures  */
 	TPMT_HA	hmac;	 /* HMAC signature required to be supported  */
 	TPMS_SCHEME_HASH	any;	 /* used to access the hash  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_SIGNATURE;
 
 /* Table 173  Definition of TPMT_SIGNATURE Structure */
@@ -1798,7 +1787,6 @@
 	BYTE	rsa[TPM2_MAX_RSA_KEY_BYTES];	 /*   */
 	BYTE	symmetric[sizeof(TPM2B_DIGEST)];	 /*   */
 	BYTE	keyedHash[sizeof(TPM2B_DIGEST)];	 /* Any symmetrically encrypted secret value will be limited to be no larger than a digest.  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_ENCRYPTED_SECRET;
 
 /* Table 175  Definition of TPM2B_ENCRYPTED_SECRET Structure */
@@ -1813,7 +1801,6 @@
 	TPM2B_DIGEST	sym;	 /*   */
 	TPM2B_PUBLIC_KEY_RSA	rsa;	 /*   */
 	TPMS_ECC_POINT	ecc;	 /*   */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_PUBLIC_ID;
 
 /* Table 178  Definition of TPMS_KEYEDHASH_PARMS Structure */
@@ -1850,7 +1837,6 @@
 	TPMS_RSA_PARMS	rsaDetail;	 /* decrypt + sign2  */
 	TPMS_ECC_PARMS	eccDetail;	 /* decrypt + sign2  */
 	TPMS_ASYM_PARMS	asymDetail;	 /* common scheme structure for RSA and ECC keys  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_PUBLIC_PARMS;
 
 /* Table 183  Definition of TPMT_PUBLIC_PARMS Structure */
@@ -1882,7 +1868,6 @@
 	TPM2B_SENSITIVE_DATA	bits;	 /* the private data  */
 	TPM2B_SYM_KEY	sym;	 /* the symmetric key  */
 	TPM2B_PRIVATE_VENDOR_SPECIFIC	any;	 /* vendorspecific size for key storage  */
-	char na;        /* Not used. Common TPMU member only for parsing */
 } TPMU_SENSITIVE_COMPOSITE;
 
 /* Table 188  Definition of TPMT_SENSITIVE Structure */
diff --git a/marshal/tpmu-types.c b/marshal/tpmu-types.c
index 9b45644..532abf3 100644
--- a/marshal/tpmu-types.c
+++ b/marshal/tpmu-types.c
@@ -135,7 +135,7 @@
 }
 
 
-static TSS2_RC marshal_null(char const *src, uint8_t buffer[],
+static TSS2_RC marshal_null(void const *src, uint8_t buffer[],
                             size_t buffer_size, size_t *offset)
 {
     return TSS2_RC_SUCCESS;
@@ -234,8 +234,8 @@
     return unmarshal_tab(buffer, buffer_size, offset, dest, sizeof(TPM2B_DIGEST));
 }
 
-static TSS2_RC unmashal_null(uint8_t const buffer[], size_t buffer_size,
-                             size_t *offset, char *dest)
+static TSS2_RC unmarshal_null(uint8_t const buffer[], size_t buffer_size,
+                              size_t *offset, void *dest)
 {
     return TSS2_RC_SUCCESS;
 }
@@ -243,21 +243,20 @@
 /* In order to marshal TPM Union types, which differ in number of members,
  * their types, and don't have any common pattern, Variadic Macros will be used.
  * It allows the macros to accept variable number of arguments.
- * Every TPMU type gets a new "char na;" member, which will the one common
- * member every union has. Then an intermediate TPMU_(UN)MARSHAL2(...)
- * macro is defined, which can be called with any number of params,
- * (upto 34, which is the max needed). The intermediate macro then calls
- * the real TPMU_(UN)MARSHAL() macro, passing the number of parameters
- * required for given type and filling the gap with the fake member 'na' and
- * fake selector -1, -2, etc. That way the <TYPE>_Marshal functions generated
- * can handle up to 11 mamebers, but only the first required cases for
- * a given <TYPE> are valid  and the rest is filled with the fake member (na),
- * fake selectors, and a fake function (un)marshal_null().
+ * An intermediate TPMU_(UN)MARSHAL2(...) macro is defined, which can be
+ * called with any number of params, (upto 34, which is the max needed).
+ * The intermediate macro then calls the real TPMU_(UN)MARSHAL() macro,
+ * passing the number of parameters required for given type and filling
+ * the gap with the first member and fake selector -1, -2, etc.
+ * That way the <TYPE>_Marshal functions generated can handle up to 11
+ * mamebers, but only the first required cases for a given <TYPE> are valid
+ * and the rest is filled with the fisrt member, fake selectors, and a fake
+ * function (un)marshal_null().
  */
-
 #define TPMU_MARSHAL(type, sel, op, m, fn, sel2, op2, m2, fn2, sel3, op3, m3, fn3, \
-                     sel4, op4, m4, fn4, sel5, op5, m5, fn5, sel6, op6, m6, fn6, sel7, op7, m7, fn7, \
-                     sel8, op8, m8, fn8, sel9, op9, m9, fn9, sel10, op10, m10, fn10, sel11, op11, m11, fn11, ...) \
+                     sel4, op4, m4, fn4, sel5, op5, m5, fn5, sel6, op6, m6, fn6, \
+                     sel7, op7, m7, fn7, sel8, op8, m8, fn8, sel9, op9, m9, fn9, \
+                     sel10, op10, m10, fn10, sel11, op11, m11, fn11, ...) \
 TSS2_RC Tss2_MU_##type##_Marshal(type const *src, uint32_t selector, uint8_t buffer[], \
                                  size_t buffer_size, size_t *offset) \
 { \
@@ -308,10 +307,12 @@
     return ret; \
 }
 
-#define TPMU_MARSHAL2(...) TPMU_MARSHAL(__VA_ARGS__, -1, ADDR, na, marshal_null, -2, ADDR, na, marshal_null,\
-                                        -3, ADDR, na, marshal_null, -4, ADDR, na, marshal_null, -5, ADDR, na, marshal_null, \
-                                        -6, ADDR, na, marshal_null, -7, ADDR, na, marshal_null, -8, ADDR, na, marshal_null, \
-                                        -9, ADDR, na, marshal_null, -10, ADDR, na, marshal_null)
+#define TPMU_MARSHAL2(type, sel, op, m, fn, ...) \
+    TPMU_MARSHAL(type, sel, op, m, fn, __VA_ARGS__, -1, ADDR, m, marshal_null, \
+                 -2, ADDR, m, marshal_null, -3, ADDR, m, marshal_null, \
+                 -4, ADDR, m, marshal_null, -5, ADDR, m, marshal_null, \
+                 -6, ADDR, m, marshal_null, -7, ADDR, m, marshal_null, \
+                 -8, ADDR, m, marshal_null, -9, ADDR, m, marshal_null)
 
 #define TPMU_UNMARSHAL(type, sel, m, fn, sel2, m2, fn2, sel3, m3, fn3, \
                        sel4, m4, fn4, sel5, m5, fn5, sel6, m6, fn6, sel7, m7, fn7, \
@@ -361,10 +362,11 @@
     return ret; \
 }
 
-#define TPMU_UNMARSHAL2(...) TPMU_UNMARSHAL(__VA_ARGS__, -1, na, unmashal_null, -2, na, unmashal_null,\
-                                            -3, na, unmashal_null, -4, na, unmashal_null, -5, na, unmashal_null, \
-                                            -6, na, unmashal_null, -7, na, unmashal_null, -8, na, unmashal_null, \
-                                            -9, na, unmashal_null, -10, na, unmashal_null)
+#define TPMU_UNMARSHAL2(type, sel, m, fn, ...) \
+    TPMU_UNMARSHAL(type, sel, m, fn, __VA_ARGS__, -1, m, unmarshal_null, \
+            -2, m, unmarshal_null, -3, m, unmarshal_null, -4, m, unmarshal_null, \
+            -5, m, unmarshal_null, -6, m, unmarshal_null, -7, m, unmarshal_null, \
+            -8, m, unmarshal_null, -9, m, unmarshal_null)
 
 TPMU_MARSHAL2(TPMU_HA, TPM2_ALG_SHA1, ADDR, sha1[0], marshal_hash_sha,
               TPM2_ALG_SHA256, ADDR, sha256[0], marshal_hash_sha256, TPM2_ALG_SHA384, ADDR, sha384[0], marshal_hash_sha384,