aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTadeusz Struk <tadeusz.struk@intel.com>2017-07-31 13:31:48 -0700
committerTadeusz Struk <tadeusz.struk@intel.com>2017-08-08 14:16:59 -0700
commitcd4b960563ed0ce296f05a3e3337fb7a78591283 (patch)
tree5b7f34a25f952b2ac9f27c78e4abe3323feec1e4 /include
parent1552d219e99f3291a8deb4325b95285ae056ad98 (diff)
downloadtpm2-tss-cd4b960563ed0ce296f05a3e3337fb7a78591283.tar.gz
Marshal: Add marshal/unmarshal for TPMU types
Add marshalling and unmarshalling functions for TPMU types as described in TCG TSS 2.0 Marshalling/Unmarshalling API Specification Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/sapi/marshal.h192
-rw-r--r--include/sapi/tss2_tpm2_types.h15
2 files changed, 207 insertions, 0 deletions
diff --git a/include/sapi/marshal.h b/include/sapi/marshal.h
index 487d7e1c..eb09e7e7 100644
--- a/include/sapi/marshal.h
+++ b/include/sapi/marshal.h
@@ -1043,6 +1043,198 @@ TPML_TAGGED_TPM_PROPERTY_Unmarshal (
size_t *offset,
TPML_TAGGED_TPM_PROPERTY *dest);
+TSS2_RC
+TPMU_HA_Marshal (
+ TPMU_HA const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_HA_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_HA *dest);
+
+TSS2_RC
+TPMU_CAPABILITIES_Marshal (
+ TPMU_CAPABILITIES const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_CAPABILITIES_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_CAPABILITIES *dest);
+
+TSS2_RC
+TPMU_ATTEST_Marshal (
+ TPMU_ATTEST const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_ATTEST_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_ATTEST *dest);
+
+TSS2_RC
+TPMU_SYM_KEY_BITS_Marshal (
+ TPMU_SYM_KEY_BITS const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_SYM_KEY_BITS_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_SYM_KEY_BITS *dest);
+
+TSS2_RC
+TPMU_SYM_MODE_Marshal (
+ TPMU_SYM_MODE const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_SYM_MODE_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_SYM_MODE *dest);
+
+TSS2_RC
+TPMU_SIG_SCHEME_Marshal (
+ TPMU_SIG_SCHEME const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_SIG_SCHEME_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_SIG_SCHEME *dest);
+
+TSS2_RC
+TPMU_KDF_SCHEME_Marshal (
+ TPMU_KDF_SCHEME const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_KDF_SCHEME_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_KDF_SCHEME *dest);
+
+TSS2_RC
+TPMU_ASYM_SCHEME_Marshal (
+ TPMU_ASYM_SCHEME const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_ASYM_SCHEME_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_ASYM_SCHEME *dest);
+
+TSS2_RC
+TPMU_SCHEME_KEYEDHASH_Marshal (
+ TPMU_SCHEME_KEYEDHASH const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_SCHEME_KEYEDHASH_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_SCHEME_KEYEDHASH *dest);
+
+TSS2_RC
+TPMU_SIGNATURE_Marshal (
+ TPMU_SIGNATURE const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_SIGNATURE_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_SIGNATURE *dest);
+
+TSS2_RC
+TPMU_SENSITIVE_COMPOSITE_Marshal (
+ TPMU_SENSITIVE_COMPOSITE const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_SENSITIVE_COMPOSITE_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_SENSITIVE_COMPOSITE *dest);
+
+TSS2_RC
+TPMU_ENCRYPTED_SECRET_Marshal (
+ TPMU_ENCRYPTED_SECRET const *src,
+ uint32_t selector_value,
+ uint8_t buffer[],
+ size_t buffer_size,
+ size_t *offset);
+
+TSS2_RC
+TPMU_ENCRYPTED_SECRET_Unmarshal (
+ uint8_t const buffer[],
+ size_t buffer_size,
+ size_t *offset,
+ uint32_t selector_value,
+ TPMU_ENCRYPTED_SECRET *dest);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/sapi/tss2_tpm2_types.h b/include/sapi/tss2_tpm2_types.h
index 2ba253e3..23093497 100644
--- a/include/sapi/tss2_tpm2_types.h
+++ b/include/sapi/tss2_tpm2_types.h
@@ -981,6 +981,7 @@ typedef union {
BYTE sha384[SHA384_DIGEST_SIZE]; /* all hashes */
BYTE sha512[SHA512_DIGEST_SIZE]; /* all hashes */
BYTE sm3_256[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> */
@@ -1023,6 +1024,7 @@ TPM2B_TYPE1( IV, MAX_SYM_BLOCK_SIZE, buffer );
typedef union {
TPMT_HA digest; /* when the Name is a digest */
TPM_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 */
@@ -1168,6 +1170,7 @@ typedef union {
TPML_TAGGED_TPM_PROPERTY tpmProperties; /* */
TPML_TAGGED_PCR_PROPERTY pcrProperties; /* */
TPML_ECC_CURVE eccCurves; /* TPM_ALG_ECC */
+ char na; /* Not used. Common TPMU member only for parsing */
} TPMU_CAPABILITIES;
/* Table 108 Definition of TPMS_CAPABILITY_DATA Structure <OUT> */
@@ -1247,6 +1250,7 @@ typedef union {
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> */
@@ -1294,6 +1298,7 @@ typedef union {
TPMI_CAMELLIA_KEY_BITS camellia; /* all symmetric algorithms */
TPM_KEY_BITS sym; /* when selector may be any of the symmetric block ciphers */
TPMI_ALG_HASH exclusiveOr; /* overload for using xorNOTE TPM_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 */
@@ -1302,6 +1307,7 @@ typedef union {
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 */
@@ -1365,6 +1371,7 @@ typedef struct {
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 */
@@ -1393,6 +1400,7 @@ typedef union {
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 */
@@ -1421,6 +1429,7 @@ typedef union {
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 */
@@ -1445,6 +1454,7 @@ typedef union {
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 <> */
@@ -1552,6 +1562,7 @@ typedef union {
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 */
@@ -1566,6 +1577,7 @@ typedef union {
BYTE rsa[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 */
@@ -1580,6 +1592,7 @@ typedef union {
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 */
@@ -1616,6 +1629,7 @@ typedef union {
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 */
@@ -1647,6 +1661,7 @@ typedef union {
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 */