summaryrefslogtreecommitdiff
path: root/src/include/tss
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/tss')
-rw-r--r--src/include/tss/TSP.idl762
-rw-r--r--src/include/tss/compat11b.h200
-rw-r--r--src/include/tss/platform.h46
-rw-r--r--src/include/tss/tcpa_defines.h7
-rw-r--r--src/include/tss/tcpa_error.h7
-rw-r--r--src/include/tss/tcpa_struct.h7
-rw-r--r--src/include/tss/tcpa_typedef.h7
-rw-r--r--src/include/tss/tcs.h1129
-rw-r--r--src/include/tss/tcs_defines.h28
-rw-r--r--src/include/tss/tcs_error.h56
-rw-r--r--src/include/tss/tcs_structs.h40
-rw-r--r--src/include/tss/tcs_typedef.h32
-rw-r--r--src/include/tss/tddl_error.h51
-rw-r--r--src/include/tss/tddlapi_error.h54
-rw-r--r--src/include/tss/tddli.h94
-rw-r--r--src/include/tss/tpm.h1663
-rw-r--r--src/include/tss/tpm_error.h963
-rw-r--r--src/include/tss/tpm_ordinal.h151
-rw-r--r--src/include/tss/tspi.h1198
-rw-r--r--src/include/tss/tss_defines.h1288
-rw-r--r--src/include/tss/tss_error.h687
-rw-r--r--src/include/tss/tss_error_basics.h59
-rw-r--r--src/include/tss/tss_structs.h653
-rw-r--r--src/include/tss/tss_typedef.h48
24 files changed, 9230 insertions, 0 deletions
diff --git a/src/include/tss/TSP.idl b/src/include/tss/TSP.idl
new file mode 100644
index 0000000..40f95b7
--- /dev/null
+++ b/src/include/tss/TSP.idl
@@ -0,0 +1,762 @@
+/*++
+
++++TSP.idl
+
+ Interface declarations for the TSS Service Provider
+ - COM interface for Windows based platforms
+
+--*/
+import "oaidl.idl"; // include ODL base types
+import "ocidl.idl";
+
+//import the header files from TSS v1.2
+import "tss_typedef.h";
+import "tss_structs.h";
+
+// forward declaration
+interface ITCPAPolicy;
+interface ITCPAKey;
+
+/*
+Missing:
+TSS_RESULT Tspi_Context_Create
+TSS_RESULT Tspi_Context_Close
+TSS_RESULT Tspi_Context_FreeMemory
+*/
+
+ //ITCPAAttrib Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C2E-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAAttrib Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAAttrib : IUnknown
+ {
+ [helpstring("method SetAttribUint32")]
+ HRESULT SetAttribUint32([in] TSS_FLAG attribFlag,
+ [in] TSS_FLAG subFlags,
+ [in] UINT32 ulAttrib);
+
+ [helpstring("method GetAttribUint32")]
+ HRESULT GetAttribUint32([in] TSS_FLAG attribFlag,
+ [in] TSS_FLAG subFlags,
+ [out] UINT32* pulAttrib);
+
+ [helpstring("method SetAttribData")]
+ HRESULT SetAttribData([in] TSS_FLAG attribFlag,
+ [in] TSS_FLAG subFlags,
+ [in] UINT32 ulAttribDataSize,
+ [in, ptr, size_is(ulAttribDataSize)] BYTE* pbAttribData);
+
+ [helpstring("method GetAttribData")]
+ HRESULT GetAttribData([in] TSS_FLAG attribFlag,
+ [in] TSS_FLAG subFlags,
+ [out] UINT32* pulAttribDataSize,
+ [out, size_is(, *pulAttribDataSize)] BYTE** ppbAttribData);
+ }
+
+ //ITCPAAuth Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C2F-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAAuth Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAAuth : IUnknown
+ {
+ [helpstring("method GetPolicyObject")]
+ HRESULT GetPolicyObject([in] TSS_FLAG PolicyType,
+ [out] ITCPAPolicy** ppPolicyObject);
+
+ [helpstring("method ChangeAuth")]
+ HRESULT ChangeAuth([in] IUnknown* PpParentObject,
+ [in] ITCPAPolicy* PpNewPolicy);
+
+// HRESULT ChangeAuthAsym
+
+ };
+
+ [
+ object,
+ uuid(FBCD9C2D-72CB-47BB-99DD-2317551491DE),
+ helpstring("ITCPAPcrs Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAPcrs : IUnknown
+ {
+ [helpstring("method SetPcrValue")]
+ HRESULT SetPcrValue([in] UINT32 ulPCRIndex,
+ [in] UINT32 ulPcrValueLength,
+ [in, size_is(ulPcrValueLength)] BYTE* pbPcrValue);
+
+ [helpstring("method GetPcrValue")]
+ HRESULT GetPcrValue([in] UINT32 ulPCRIndex,
+ [out] UINT32* pulPcrValueLength,
+ [out, size_is(, *pulPcrValueLength)] BYTE** ppbPcrValue);
+
+ [helpstring("method SelectPcrIndex")]
+ HRESULT SelectPcrIndex([in] UINT32 ulPCRIndex);
+
+ };
+
+ //ITCPAKey Interface
+ [
+ object,
+ uuid(FBCD9C27-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAKey Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAKey : IUnknown
+ {
+ [helpstring("method LoadKey")]
+ HRESULT LoadKey([in] ITCPAKey* pUnwrappingKey);
+
+ [helpstring("method CreateKey")]
+ HRESULT CreateKey([in] ITCPAKey* pUnwrappingKey,
+ [in] ITCPAPcrs* pPcrComosite);
+
+ [helpstring("method WrapKey")]
+ HRESULT WrapKey([in] ITCPAKey* pWrappinKey,
+ [in] ITCPAPcrs* pPcrComposite);
+
+ [helpstring("method CertifyKey")]
+ HRESULT CertifyKey([in] ITCPAKey* pCertifyingKey,
+ [in, out, ptr] TSS_VALIDATION* pValidation);
+
+ [helpstring("method GetPubKey")]
+ HRESULT GetPubKey([out] UINT32* pulPubKeyLength,
+ [out, size_is(, *pulPubKeyLength)] BYTE** ppbPubKey);
+
+ [helpstring("method UnLoadKey")]
+ HRESULT UnLoadKey();
+ };
+
+ // ITCPAMigration
+ [
+ local,
+ object,
+ uuid(FBCD9C30-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAMigration Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAMigration : IUnknown
+ {
+ [helpstring("method CreateMigrationBlob")]
+ HRESULT CreateMigrationBlob([in] ITCPAKey *pParentKey,
+ [in] UINT32 ulMigTicketLength,
+ [in, size_is(ulMigTicketLength)] BYTE* rgbMigTicket,
+ [out] UINT32 *pulRandomLength,
+ [out, size_is(, *pulRandomLength)] BYTE **prgbRandom,
+ [out] UINT32 *pulMigrationBlobLength,
+ [out, size_is(, *pulMigrationBlobLength)] BYTE **prgbMigBlob);
+
+ [helpstring("method ConvertMigrationBlob")]
+ HRESULT ConvertMigrationBlob([in] ITCPAKey *pParentKey,
+ [in] UINT32 ulRandomLength,
+ [in, size_is(ulRandomLength)] BYTE *rgbRandom,
+ [in] UINT32 ulMigrationBlobLength,
+ [in, size_is(ulMigrationBlobLength)] BYTE *rgbMigBlob);
+ };
+
+ //ITCPAEncData Interface
+ [
+ uuid(FBCD9C29-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAEncData Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAEncData : IUnknown
+ {
+ [helpstring("method Seal")]
+ HRESULT Seal([in] ITCPAKey* pEncKey,
+ [in] UINT32 ulDataLength,
+ [in, size_is(ulDataLength)] BYTE* pbData,
+ [in] ITCPAPcrs* pPcrComposite);
+
+ [helpstring("method Unseal")]
+ HRESULT Unseal([in] ITCPAKey* pKey,
+ [out] UINT32* pulUnsealedDataLength,
+ [out, size_is(, *pulUnsealedDataLength)] BYTE** ppbData);
+
+ [helpstring("method Bind")]
+ HRESULT Bind([in] ITCPAKey* pEncKey,
+ [in] UINT32 ulDataLength,
+ [in, size_is(ulDataLength)] BYTE* pbData);
+
+ [helpstring("method Unbind")]
+ HRESULT Unbind([in] ITCPAKey* pKey,
+ [out] UINT32* pulUnboundDataLength,
+ [out, size_is(, *pulUnboundDataLength)] BYTE** ppbData);
+
+ };
+
+ //ITCPAHash Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C2B-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAHash Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAHash : IUnknown
+ {
+ [helpstring("method SetHashValue")]
+ HRESULT SetHashValue([in] UINT32 ulHashValueLength,
+ [in, size_is(ulHashValueLength)] BYTE* pbHash);
+
+ [helpstring("method GetHashValue")]
+ HRESULT GetHashValue([out] UINT32* pulHashValueLength,
+ [out, size_is(, *pulHashValueLength)] BYTE** ppbHash);
+
+ [helpstring("method UpdateHashValue")]
+ HRESULT UpdateHashValue([in] UINT32 ulDataLength,
+ [in, size_is(ulDataLength)] BYTE* pbData);
+
+ [helpstring("method Sign")]
+ HRESULT Sign([in] ITCPAKey* pKey,
+ [out] UINT32* pulSignatureLength,
+ [out, size_is(, *pulSignatureLength)] BYTE** ppbSignature);
+
+ [helpstring("method VerifySignature")]
+ HRESULT VerifySignature([in] ITCPAKey* pKey,
+ [in] UINT32 ulSignatureLength,
+ [in, size_is(ulSignatureLength)] BYTE* pbSignature);
+
+ };
+
+ //ITCPAPolicy Interface
+ [
+ uuid(FBCD9C1E-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAPolicy Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAPolicy : IUnknown
+ {
+ [helpstring("method SetSecret")]
+ HRESULT SetSecret([in] TSS_FLAG SecretMode,
+ [in] UINT32 ulSecretLength,
+ [in, ptr, size_is(ulSecretLength)] BYTE* pbSecret);
+
+ [helpstring("method FlushSecret")]
+ HRESULT FlushSecret();
+
+ [helpstring("method AssignToObject")]
+ HRESULT AssignToObject([in] IUnknown* pUnkObject);
+
+ };
+
+ //ITCPAAdministration Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C24-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAAdministration Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAAdministration : IUnknown
+ {
+ [helpstring("method SelfTestFull")]
+ HRESULT SelfTestFull();
+
+ [helpstring("method GetTestResult")]
+ HRESULT GetTestResult([out] UINT32* pulTestResultLength,
+ [out, size_is(, *pulTestResultLength)] BYTE** ppbTestResult);
+
+ [helpstring("method CertifySelfTest")]
+ HRESULT CertifySelfTest([in] ITCPAKey* phKey,
+ [in, out, ptr] TSS_VALIDATION* pValidationData);
+
+ [helpstring("method CreateEndorsementKey")]
+ HRESULT CreateEndorsementKey([in] ITCPAKey* pEndorsementKey,
+ [in, out, ptr] TSS_VALIDATION* pValidation);
+
+ [helpstring("method GetPubEndorsementKey")]
+ HRESULT GetPubEndorsementKey([in] BOOL fOwnerAuthorized,
+ [in, out, ptr] TSS_VALIDATION* pValidation,
+ [out] ITCPAKey** ppEndorsementKey);
+
+ [helpstring("method TakeOwnerShip")]
+ HRESULT TakeOwnerShip([in] ITCPAKey* pKeySRK,
+ [in] ITCPAKey* pEndorsementKeyPubKey);
+
+ [helpstring("method ClearOwner")]
+ HRESULT ClearOwner([in] BOOL fForcedClear);
+
+ [helpstring("method SetStatus")]
+ HRESULT SetStatus([in] TSS_FLAG statusFlag,
+ [in] BOOL fTpmState);
+
+ [helpstring("method GetStatus")]
+ HRESULT GetStatus([in] TSS_FLAG statusFlag,
+ [out] BOOL* pfTpmState);
+
+ [helpstring("method AuthorizeMigrationTicket")]
+ HRESULT AuthorizeMigrationTicket([in] ITCPAKey* pMigrationKey,
+ [in] UINT32 MigrationScheme,
+ [out] UINT32* pulMigTicketLength,
+ [out, size_is(, *pulMigTicketLength)] BYTE** ppbMigTicket);
+ }
+
+ //ITCPAIntegrity Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C22-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAIntegrity Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAIntegrity : IUnknown
+ {
+ [helpstring("method PcrExtend")]
+ HRESULT PcrExtend([in] UINT32 ulPcrIndex,
+ [in] UINT32 ulPcrDataLength,
+ [in, size_is(ulPcrDataLength)] BYTE* pbPcrData,
+ [in, ptr] TSS_PCR_EVENT* pEventInfo,
+ [out] UINT32* pulPcrValueLength,
+ [out, size_is(, *pulPcrValueLength)] BYTE** ppbPcrValue);
+
+ [helpstring("method PcrRead")]
+ HRESULT PcrRead([in] UINT32 ulPcrIndex,
+ [out] UINT32* pulPcrValueLength,
+ [out, size_is(, *pulPcrValueLength)] BYTE** ppbPcrValue);
+
+ [helpstring("method DirWrite")]
+ HRESULT DirWrite([in] UINT32 ulDirIndex,
+ [in] UINT32 ulDirDataLength,
+ [in, size_is(ulDirDataLength)] BYTE* pbDirData);
+
+ [helpstring("method DirRead")]
+ HRESULT DirRead([in] UINT32 ulDirIndex,
+ [out] UINT32* pulDirDataLength,
+ [out, size_is(, *pulDirDataLength)] BYTE** pbDirData);
+
+ [helpstring("method Quote")]
+ HRESULT Quote([in] ITCPAKey* pIdentKey,
+ [in] ITCPAPcrs* pPcrComposite,
+ [in, out, ptr] TSS_VALIDATION* pValidation);
+ };
+
+ //ITCPAIdentityCreation Interface
+ [
+ object,
+ uuid(FBCD9C23-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAIdentityCreation Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAIdentityCreation: IUnknown
+ {
+ [helpstring("method CollateIdentityRequest")]
+ HRESULT CollateIdentityRequest([in] ITCPAKey* pKeySRK,
+ [in] ITCPAKey* pCAPubKey,
+ [in] UINT32 ulIdentityLabelLength,
+ [in, size_is(ulIdentityLabelLength)] BYTE* rgbIdentityLabelData,
+ [in] ITCPAKey* pIdentityKey,
+ [in] TSS_ALGORITHM_ID algID,
+ [out] UINT32* pulTCPAIdentityReqLength,
+ [out, size_is(, *pulTCPAIdentityReqLength)] BYTE** prgbTCPAIdentityReq);
+
+ [helpstring("method ActivateIdentity")]
+ HRESULT ActivateIdentity([in] ITCPAKey* pIdentityKey,
+ [in] UINT32 ulAsymCAContentsBlobLength,
+ [in, size_is(ulAsymCAContentsBlobLength)] BYTE* rgbAsymCAContentsBlob,
+ [in] UINT32 ulSymCAAttestationBlobLength,
+ [in, size_is(ulSymCAAttestationBlobLength)] BYTE* rgbSymCAAttestationBlob,
+ [out] UINT32* pulCredentialLength,
+ [out, size_is(, *pulCredentialLength)] BYTE** prgbCredential);
+
+ }; // end of ITCPAIdentityCreation
+
+ //ITCPAMaintenance Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C25-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAMaintenance Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAMaintenance: IUnknown
+ {
+
+// HRESULT CreateMaintenanceArchive
+// HRESULT KillMaintenanceFeature
+// HRESULT LoadMaintenancePubKey
+// HRESULT CheckMaintenancePubKey
+
+ };
+
+ //ITCPATpm Interface
+ [
+ uuid(FBCD9C21-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPATpm Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPATpm : IUnknown
+ {
+ [helpstring("method GetRandom")]
+ HRESULT GetRandom([in] UINT32 ulRandomDataLength,
+ [out, size_is(, ulRandomDataLength)] BYTE** ppbData);
+
+ [helpstring("method StirRandom")]
+ HRESULT StirRandom([in] UINT32 ulEntropyDataLength,
+ [in, size_is(ulEntropyDataLength)] BYTE* pbData);
+
+ [helpstring("method GetCapability")]
+ HRESULT GetCapability([in] TSS_FLAG CapArea,
+ [in] UINT32 ulSubCapLength,
+ [in, ptr, size_is(ulSubCapLength)] BYTE* pbSubCap,
+ [out] UINT32* pulRespDataLength,
+ [out, size_is(, *pulRespDataLength)] BYTE** ppbRespData);
+
+ [helpstring("method GetCapabilitySigned")]
+ HRESULT GetCapabilitySigned([in] ITCPAKey* pKey,
+ [in] TSS_FLAG CapArea,
+ [in] UINT32 ulSubCapLength,
+ [in, ptr, size_is(ulSubCapLength)] BYTE* pbSubCap,
+ [in, out, ptr] TSS_VALIDATION *pValidation,
+ [out] UINT32* pulRespDataLength,
+ [out, size_is(, *pulRespDataLength)] BYTE** ppbRespData);
+
+// HRESULT GetEvent
+// HRESULT GetEvents
+// HRESULT GetEventLog
+
+ };
+
+ //ITCPAPersistentStorage Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C1C-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAPersistentStorage Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAPersistentStorage: IUnknown
+ {
+ [helpstring("method LoadKeyByUUID")]
+ HRESULT LoadKeyByUUID([in] TSS_FLAG persistentStorageType,
+ [in] TSS_UUID uuidData,
+ [out] ITCPAKey** ppKey);
+
+ [helpstring("method RegisterKey")]
+ HRESULT RegisterKey([in] ITCPAKey* pKey,
+ [in] TSS_FLAG persistentStorageType,
+ [in] TSS_UUID uuidKey,
+ [in] TSS_FLAG persistentStorageTypeParent,
+ [in] TSS_UUID uuidParentKey);
+
+ [helpstring("method UnregisterKey")]
+ HRESULT UnregisterKey([in] TSS_FLAG persistentStorageType,
+ [in] TSS_UUID uuidKey,
+ [out] ITCPAKey** ppKey);
+
+ [helpstring("method DeleteKeyByUUID")]
+ HRESULT DeleteKeyByUUID([in] TSS_FLAG persistentStorageType,
+ [in] TSS_UUID uuidData);
+
+ [helpstring("method GetKeyByUUID")]
+ HRESULT GetKeyByUUID([in] TSS_FLAG persistentStorageType,
+ [in] TSS_UUID uuidData,
+ [out] ITCPAKey** ppKey);
+
+ [helpstring("method GetKeyByPublicInfo")]
+ HRESULT GetKeyByPublicInfo([in] TSS_FLAG persistentStorageType,
+ [in] TSS_ALGORITHM_ID ulAlgId,
+ [in] UINT32 ulPublicInfoLength,
+ [in, size_is(ulPublicInfoLength)] BYTE* pbPublicInfo,
+ [out] ITCPAKey** ppKey);
+
+ [helpstring("method GetRegisteredKeysByUUID")]
+ HRESULT GetRegisteredKeysByUUID([in] TSS_FLAG ulPersistentStorageType,
+ [in] LPOLESTR wszKeyGuid,
+ [out] UINT32* pulKeyHierarchySize,
+ [out, size_is(, *pulKeyHierarchySize)] TSS_KM_KEYINFO** ppKeyHierarchy);
+ }
+
+ //ITCPAContext Interface
+ [
+ local,
+ object,
+ uuid(FBCD9C1B-72CB-47BB-99DD-2317551491DE),
+
+ helpstring("ITCPAContext Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPAContext : IUnknown
+ {
+ [helpstring("method Connect")]
+ HRESULT Connect([in, ptr] LPOLESTR wszRemoteMachine);
+
+ [helpstring("method CreateObject")]
+ HRESULT CreateObject([in] UINT32 ulObjectType,
+ [in] UINT32 ulInitFlags,
+ [out] IUnknown** ppUnkObject);
+
+// HRESULT CloseObject
+
+
+ [helpstring("method LoadKeyByBlob")]
+ HRESULT LoadKeyByBlob([in] ITCPAKey* pUnwrappingKey,
+ [in] UINT32 ulBlobLength,
+ [in, size_is(ulBlobLength)] BYTE* pbBlobData,
+ [out] ITCPAKey** ppKey);
+
+ [helpstring("method GetTPMObject")]
+ HRESULT GetTPMObject([out] ITCPATpm** ppTPMObject);
+
+ [helpstring("method GetDefaultPolicy")]
+ HRESULT GetDefaultPolicy([out] ITCPAPolicy** ppPolicyObject);
+
+ [helpstring("method GetCapability")]
+ HRESULT GetCapability([in] TSS_FLAG ulCapArea,
+ [in] UINT32 ulSubCapLength,
+ [in, ptr, size_is(ulSubCapLength)] BYTE* pbSubCap,
+ [out] UINT32* pulRespDataLength,
+ [out, size_is(, *pulRespDataLength)] BYTE** ppbRespData);
+ };
+
+ //ITCPANonVolatileStorage Interface
+ [
+ object,
+ uuid(4730c51b-8998-43f6-993b-80befea1d404),
+
+ helpstring("ITCPANonVolatileStorage Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPANonVolatileStorage : IUnknown
+ {
+ [helpstring("method DefineSpace")]
+ HRESULT DefineSpace([in] ITCPAPcrs* pPCRsRead,
+ [in] ITCPAPcrs* pPCRsWrite);
+
+ [helpstring("method ReleaseSpace")]
+ HRESULT ReleaseSpace();
+
+ [helpstring("method WriteValue")]
+ HRESULT WriteValue([in] UINT32 ulOffset,
+ [in] UINT32 ulDataLength,
+ [in, size_is(ulDataLength)] BYTE* rgbData);
+
+ [helpstring("method ReadValue")]
+ HRESULT ReadValue([in] UINT32 ulOffset,
+ [in, out] UINT32* pulDataLength,
+ [out, size_is(, *pulDataLength)] BYTE** prgbData);
+ };
+
+ //ITCPATransport Interface
+ [
+ object,
+ uuid(4730c51d-8998-43f6-993b-80befea1d404),
+
+ helpstring("ITCPATransport Interface"),
+ pointer_default(unique)
+ ]
+ interface ITCPATransport : IUnknown
+ {
+ [helpstring("method SetTransEncryptionKey")]
+ HRESULT SetTransEncryptionKey([in] ITCPAKey* pKey);
+
+ [helpstring("method CloseSignTransport")]
+ HRESULT CloseSignTransport([in] ITCPAKey* pSigningKey,
+ [in, out, ptr] TSS_VALIDATION* pValidationData);
+ };
+
+[
+ uuid(FBCD9C19-72CB-47BB-99DD-2317551491DE),
+ version(1.0),
+ helpstring("TSS Service Provider 1.0 Type Library")
+]
+library TSPLib
+{
+ importlib("stdole32.tlb");
+ importlib("stdole2.tlb");
+
+ interface ITCPAContext;
+ //TCPAContext Class
+ [
+ uuid(FBCD9C1A-72CB-47BB-99DD-2317551491DE),
+ helpstring("TCPAContext Class")
+ ]
+ coclass TCPAContext
+ {
+ [default] interface ITCPAContext;
+ interface ITCPAAttrib;
+ interface ITCPAPersistentStorage;
+ };
+
+ //TCPAContext2 Class extensions for TSS v1.2
+ [
+ uuid(4730C51E-8998-43F6-993B-80BEFEA1D404),
+ helpstring("TCPAContext2 Class")
+ ]
+ coclass TCPAContext2
+ {
+ [default] interface ITCPAContext;
+ interface ITCPAAttrib;
+ interface ITCPAPersistentStorage;
+ interface ITCPATransport;
+ };
+
+ // _ITCPACallback Interface for TCPAPolicy Class
+ [
+ uuid(FBCD9C1F-72CB-47BB-99DD-2317551491DE),
+ helpstring("_ITCPACallback Interface"),
+ pointer_default(unique)
+ ]
+ interface _ITCPACallback : IUnknown
+ {
+ [helpstring("method Tspicb_CallbackHMACAuth"), callback]
+ HRESULT Tspicb_CallbackHMACAuth([in] UINT32 PulAppData,
+ [in] IUnknown *PpAuthorizedObject,
+ [in] BOOL PfReturnOrVerify,
+ [in] UINT32 PulPendingFunction,
+ [in] BOOL PfContinueUse,
+ [in] UINT32 PulSizeNonces,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceEven,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceOdd,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceEvenOSAP,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceOddOSAP,
+ [in] UINT32 PulSizeDigestHmac,
+ [in, size_is(PulSizeDigestHmac)] BYTE* PrgbParamDigest,
+ [in, out, size_is(PulSizeDigestHmac)] BYTE* PrgbHmacData);
+
+ [helpstring("method Tspicb_CallbackXorEnc"), callback]
+ HRESULT Tspicb_CallbackXorEnc([in] UINT32 PulAppData,
+ [in] IUnknown *PpOSAPObject,
+ [in] IUnknown *PpObject,
+ [in] BOOL PfPurposeSecret,
+ [in] UINT32 PulSizeNonces,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceEven,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceOdd,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceEvenOSAP,
+ [in, size_is(PulSizeNonces)] BYTE* PrgbNonceOddOSAP,
+ [in] UINT32 PulSizeEncAuth,
+ [out, size_is(PulSizeEncAuth)] BYTE* PrgbEncAuthUsage,
+ [out, size_is(PulSizeEncAuth)] BYTE* PrgbEncAuthMigration);
+
+ [helpstring("method Tspicb_CallbackTakeOwnership"), callback]
+ HRESULT Tspicb_CallbackTakeOwnership([in] UINT32 PulAppData,
+ [in] IUnknown *PpObject,
+ [in] IUnknown *PpObjectPubKey,
+ [in] UINT32 PulSizeEncAuth,
+ [out, size_is(PulSizeEncAuth)] BYTE* PrgbEncAuth );
+
+ [helpstring("method Tspicb_CallbackChangeAuthAsym"), callback]
+ HRESULT Tspicb_CallbackChangeAuthAsym([in] UINT32 PulAppData,
+ [in] IUnknown *PpObject,
+ [in] IUnknown *PpObjectPubKey,
+ [in] UINT32 PulSizeEncAuth,
+ [in] UINT32 PulSizeAuthLink,
+ [out, size_is(PulSizeEncAuth)] BYTE* PrgbEncAuth,
+ [out, size_is(PulSizeAuthLink)] BYTE* PrgbAuthLink);
+ }; // end of _ITCPACallback
+
+ //TCPAPolicy Class
+ [
+ uuid(FBCD9C1D-72CB-47BB-99DD-2317551491DE),
+ helpstring("TCPAPolicy Class"),
+ noncreatable
+ ]
+
+ coclass TCPAPolicy
+ {
+ [default] interface ITCPAPolicy;
+ interface ITCPAAttrib;
+ [default, source] interface _ITCPACallback;
+ };
+
+ //TCPATpm Class
+ [
+ uuid(FBCD9C20-72CB-47BB-99DD-2317551491DE),
+ helpstring("TCPATpm Class"),
+ noncreatable
+ ]
+ coclass TCPATpm
+ {
+ [default] interface ITCPATpm;
+ interface ITCPAAttrib;
+ interface ITCPAAuth;
+ interface ITCPAIntegrity;
+ interface ITCPAAdministration;
+ interface ITCPAIdentityCreation;
+ interface ITCPAMaintenance;
+ };
+
+ //TCPAKey Class
+ [
+ uuid(FBCD9C26-72CB-47BB-99DD-2317551491DE),
+ helpstring("TCPAKey Class"),
+ noncreatable
+ ]
+ coclass TCPAKey
+ {
+ [default] interface ITCPAKey;
+ interface ITCPAAttrib;
+ interface ITCPAAuth;
+ interface ITCPAMigration;
+ };
+
+ //TCPAEncData Class
+ [
+ uuid(FBCD9C28-72CB-47BB-99DD-2317551491DE),
+ helpstring("TCPAEncData Class"),
+ noncreatable
+ ]
+ coclass TCPAEncData
+ {
+ [default] interface ITCPAEncData;
+ interface ITCPAAttrib;
+ interface ITCPAAuth;
+ };
+
+ //TCPAHash Class
+ [
+ uuid(FBCD9C2A-72CB-47BB-99DD-2317551491DE),
+ helpstring("TCPAHash Class"),
+ noncreatable
+ ]
+ coclass TCPAHash
+ {
+ [default] interface ITCPAHash;
+ interface ITCPAAttrib;
+ };
+
+ //TCPAPcrs Class
+ [
+ uuid(FBCD9C2C-72CB-47BB-99DD-2317551491DE),
+ helpstring("TCPAPcrs Class"),
+ noncreatable
+ ]
+ coclass TCPAPcrs
+ {
+ [default] interface ITCPAPcrs;
+ };
+
+ //TCPANonVolatileStorage Class
+ [
+ uuid(4730c51c-8998-43f6-993b-80befea1d404),
+ helpstring("TCPANonVolatileStorage Class"),
+ noncreatable
+ ]
+ coclass TCPANonVolatileStorage
+ {
+ [default] interface ITCPANonVolatileStorage;
+ interface ITCPAAttrib;
+ interface ITCPAAuth;
+ };
+
+}; // end of library TSPLib
diff --git a/src/include/tss/compat11b.h b/src/include/tss/compat11b.h
new file mode 100644
index 0000000..28c7304
--- /dev/null
+++ b/src/include/tss/compat11b.h
@@ -0,0 +1,200 @@
+
+#ifndef __COMPAT11B_H__
+#define __COMPAT11B_H__
+
+#include <tss/tpm.h>
+
+#define TCPA_Vendor_Specific32 TPM_Vendor_Specific32
+#define TCPA_Vendor_Specific8 TPM_Vendor_Specific8
+
+typedef TSS_UNICODE UNICODE;
+typedef TPM_DIGEST TCPA_DIGEST;
+typedef TPM_NONCE TCPA_NONCE;
+typedef TPM_NONCE TCPA_SALT_NONCE;
+typedef TPM_PUBKEY TCPA_PUBKEY;
+typedef TPM_SECRET TCPA_SECRET;
+typedef TPM_KEY TCPA_KEY;
+typedef TPM_DIRVALUE TCPA_DIRVALUE;
+typedef TPM_COMMAND_CODE TCPA_COMMAND_CODE;
+typedef TPM_BOUND_DATA TCPA_BOUND_DATA;
+typedef TPM_STRUCT_VER TCPA_VERSION;
+typedef TPM_RESULT TCPA_RESULT;
+typedef TPM_PAYLOAD_TYPE TCPA_PAYLOAD_TYPE;
+typedef TPM_STORE_PRIVKEY TCPA_STORE_PRIVKEY;
+typedef TPM_CHOSENID_HASH TCPA_CHOSENID_HASH;
+typedef TPM_SYMMETRIC_KEY TCPA_SYMMETRIC_KEY;
+typedef TPM_PCR_INFO TCPA_PCR_INFO;
+typedef TPM_PCR_SELECTION TCPA_PCR_SELECTION;
+typedef TPM_STORED_DATA TCPA_STORED_DATA;
+typedef TPM_SEALED_DATA TCPA_SEALED_DATA;
+typedef TPM_KEY_FLAGS TCPA_KEY_FLAGS;
+typedef TPM_KEY_PARMS TCPA_KEY_PARMS;
+typedef TPM_STORE_PUBKEY TCPA_STORE_PUBKEY;
+typedef TPM_MIGRATIONKEYAUTH TCPA_MIGRATIONKEYAUTH;
+typedef TPM_RSA_KEY_PARMS TCPA_RSA_KEY_PARMS;
+typedef TPM_CERTIFY_INFO TCPA_CERTIFY_INFO;
+typedef TPM_STORE_ASYMKEY TCPA_STORE_ASYMKEY;
+typedef TPM_ENCAUTH TCPA_ENCAUTH;
+typedef TPM_PCRINDEX TCPA_PCRINDEX;
+typedef TPM_PCRVALUE TCPA_PCRVALUE;
+typedef TPM_DIRINDEX TCPA_DIRINDEX;
+typedef TPM_PROTOCOL_ID TCPA_PROTOCOL_ID;
+typedef TPM_ALGORITHM_ID TCPA_ALGORITHM_ID;
+typedef TPM_ENTITY_TYPE TCPA_ENTITY_TYPE;
+typedef TPM_CAPABILITY_AREA TCPA_CAPABILITY_AREA;
+typedef TPM_HMAC TCPA_HMAC;
+typedef TPM_MIGRATE_SCHEME TCPA_MIGRATE_SCHEME;
+typedef TPM_PHYSICAL_PRESENCE TCPA_PHYSICAL_PRESENCE;
+typedef TPM_KEY_HANDLE TCPA_KEY_HANDLE;
+typedef TPM_KEY_HANDLE_LIST TCPA_KEY_HANDLE_LIST;
+typedef TPM_PCR_COMPOSITE TCPA_PCR_COMPOSITE;
+typedef TPM_AUTH_DATA_USAGE TCPA_AUTH_DATA_USAGE;
+typedef TPM_AUTHDATA TCPA_AUTHDATA;
+typedef TPM_KEY_USAGE TCPA_KEY_USAGE;
+typedef TPM_COMPOSITE_HASH TCPA_COMPOSITE_HASH;
+typedef TPM_QUOTE_INFO TCPA_QUOTE_INFO;
+typedef TPM_TAG TCPA_TAG;
+typedef TPM_ENC_SCHEME TCPA_ENC_SCHEME;
+typedef TPM_SIG_SCHEME TCPA_SIG_SCHEME;
+typedef TPM_STARTUP_TYPE TCPA_STARTUP_TYPE;
+typedef TPM_AUTHHANDLE TCPA_AUTHHANDLE;
+typedef TPM_SYM_CA_ATTESTATION TCPA_SYM_CA_ATTESTATION;
+typedef TPM_ASYM_CA_CONTENTS TCPA_ASYM_CA_CONTENTS;
+typedef TPM_IDENTITY_REQ TCPA_IDENTITY_REQ;
+typedef TPM_IDENTITY_PROOF TCPA_IDENTITY_PROOF;
+
+// These were removed from the 1.2 TPM spec
+typedef UINT32 TCPA_ENCHANDLE;
+typedef UINT32 TCPA_EVENTTYPE;
+typedef struct tdTCPA_AUDIT_EVENT {
+ TCPA_COMMAND_CODE ordinal;
+ TCPA_RESULT returncode;
+} TCPA_AUDIT_EVENT;
+
+#define TCPA_SHA1_160_HASH_LEN TPM_SHA1_160_HASH_LEN
+#define TCPA_SHA1BASED_NONCE_LEN TPM_SHA1BASED_NONCE_LEN
+
+#define redirection TSS_KEYFLAG_REDIRECTION
+#define migratable TSS_KEYFLAG_MIGRATABLE
+#define volatileKey TSS_KEYFLAG_VOLATILEKEY
+
+#define TCPA_ET_KEYHANDLE TPM_ET_KEYHANDLE
+#define TCPA_ET_KEY TPM_ET_KEY
+#define TCPA_ET_OWNER TPM_ET_OWNER
+#define TCPA_ET_SRK TPM_ET_SRK
+#define TCPA_ET_DATA TPM_ET_DATA
+
+#define TCPA_PID_OIAP TPM_PID_OIAP
+#define TCPA_PID_OSAP TPM_PID_OSAP
+#define TCPA_PID_ADIP TPM_PID_ADIP
+#define TCPA_PID_ADCP TPM_PID_ADCP
+#define TCPA_PID_OWNER TPM_PID_OWNER
+
+#define TCPA_PT_ASYM TPM_PT_ASYM
+#define TCPA_PT_BIND TPM_PT_BIND
+#define TCPA_PT_MIGRATE TPM_PT_MIGRATE
+#define TCPA_PT_MAINT TPM_PT_MAINT
+#define TCPA_PT_SEAL TPM_PT_SEAL
+
+#define TCPA_CAP_ALG TPM_CAP_ALG
+#define TCPA_CAP_ORD TPM_CAP_ORD
+#define TCPA_CAP_PID TPM_CAP_PID
+#define TCPA_CAP_FLAG TPM_CAP_FLAG
+#define TCPA_CAP_VERSION TPM_CAP_VERSION
+#define TCPA_CAP_PROPERTY TPM_CAP_PROPERTY
+#define TCPA_CAP_KEY_HANDLE TPM_CAP_KEY_HANDLE
+#define TCPA_CAP_CHECK_LOADED TPM_CAP_CHECK_LOADED
+
+#define TCPA_ALG_RSA TPM_ALG_RSA
+#define TCPA_ALG_DES TPM_ALG_DES
+#define TCPA_ALG_3DES TPM_ALG_3DES
+#define TCPA_ALG_SHA TPM_ALG_SHA
+#define TCPA_ALG_HMAC TPM_ALG_HMAC
+#define TCPA_ALG_AES TPM_ALG_AES
+
+#define TCPA_PROTECTED_ORDINAL TPM_PROTECTED_ORDINAL
+#define TCPA_UNPROTECTED_ORDINAL TPM_UNPROTECTED_ORDINAL
+#define TCPA_CONNECTION_ORDINAL TPM_CONNECTION_ORDINAL
+
+#define TCPA_PROTECTED_COMMAND TPM_PROTECTED_COMMAND
+#define TCPA_UNPROTECTED_COMMAND TPM_UNPROTECTED_COMMAND
+#define TCPA_CONNECTION_COMMAND TPM_CONNECTION_COMMAND
+#define TCPA_VENDOR_COMMAND TPM_VENDOR_COMMAND
+
+#define TCPA_MAIN TPM_MAIN
+#define TCPA_PC TPM_PC
+#define TCPA_PDA TPM_PDA
+#define TCPA_CELL_PHONE TPM_CELL_PHONE
+
+#define TCPA_MS_MIGRATE TPM_MS_MIGRATE
+#define TCPA_MS_REWRAP TPM_MS_REWRAP
+#define TCPA_MS_MAINT TPM_MS_MAINT
+
+#define TCPA_ES_NONE TPM_ES_NONE
+#define TCPA_ES_RSAESPKCSv15 TPM_ES_RSAESPKCSv15
+#define TCPA_ES_RSAESOAEP_SHA1_MGF1 TPM_ES_RSAESOAEP_SHA1_MGF1
+
+#define TCPA_SS_NONE TPM_SS_NONE
+#define TCPA_SS_RSASSAPKCS1v15_SHA1 TPM_SS_RSASSAPKCS1v15_SHA1
+#define TCPA_SS_RSASSAPKCS1v15_DER TPM_SS_RSASSAPKCS1v15_DER
+#define TCPA_SS_RSASSAPKCS1v15_INFO TPM_SS_RSASSAPKCS1v15_INFO
+
+#define TCPA_PHYSICAL_PRESENCE_LIFETIME_LOCK TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK
+#define TCPA_PHYSICAL_PRESENCE_HW_ENABLE TPM_PHYSICAL_PRESENCE_HW_ENABLE
+#define TCPA_PHYSICAL_PRESENCE_CMD_ENABLE TPM_PHYSICAL_PRESENCE_CMD_ENABLE
+#define TCPA_PHYSICAL_PRESENCE_LOCK TPM_PHYSICAL_PRESENCE_LOCK
+#define TCPA_PHYSICAL_PRESENCE_PRESENT TPM_PHYSICAL_PRESENCE_PRESENT
+#define TCPA_PHYSICAL_PRESENCE_NOTPRESENT TPM_PHYSICAL_PRESENCE_NOTPRESENT
+
+#define TCPA_SUCCESS TPM_SUCCESS
+#define TCPA_E_BASE TPM_E_BASE
+#define TCPA_E_NON_FATAL TPM_E_NON_FATAL
+#define TCPA_E_AUTHFAIL TPM_E_AUTHFAIL
+#define TCPA_E_BAD_PARAMETER TPM_E_BAD_PARAMETER
+#define TCPA_E_BADINDEX TPM_E_BADINDEX
+#define TCPA_E_AUDITFAILURE TPM_E_AUDITFAILURE
+#define TCPA_E_CLEAR_DISABLED TPM_E_CLEAR_DISABLED
+#define TCPA_E_DEACTIVATED TPM_E_DEACTIVATED
+#define TCPA_E_DISABLED TPM_E_DISABLED
+#define TCPA_E_DISABLED_CMD TPM_E_DISABLED_CMD
+#define TCPA_E_FAIL TPM_E_FAIL
+#define TCPA_E_INACTIVE TPM_E_BAD_ORDINAL
+#define TCPA_E_INSTALL_DISABLED TPM_E_INSTALL_DISABLED
+#define TCPA_E_INVALID_KEYHANDLE TPM_E_INVALID_KEYHANDLE
+#define TCPA_E_KEYNOTFOUND TPM_E_KEYNOTFOUND
+#define TCPA_E_NEED_SELFTEST TPM_E_INAPPROPRIATE_ENC
+#define TCPA_E_MIGRATEFAIL TPM_E_MIGRATEFAIL
+#define TCPA_E_NO_PCR_INFO TPM_E_INVALID_PCR_INFO
+#define TCPA_E_NOSPACE TPM_E_NOSPACE
+#define TCPA_E_NOSRK TPM_E_NOSRK
+#define TCPA_E_NOTSEALED_BLOB TPM_E_NOTSEALED_BLOB
+#define TCPA_E_OWNER_SET TPM_E_OWNER_SET
+#define TCPA_E_RESOURCES TPM_E_RESOURCES
+#define TCPA_E_SHORTRANDOM TPM_E_SHORTRANDOM
+#define TCPA_E_SIZE TPM_E_SIZE
+#define TCPA_E_WRONGPCRVAL TPM_E_WRONGPCRVAL
+#define TCPA_E_BAD_PARAM_SIZE TPM_E_BAD_PARAM_SIZE
+#define TCPA_E_SHA_THREAD TPM_E_SHA_THREAD
+#define TCPA_E_SHA_ERROR TPM_E_SHA_ERROR
+#define TCPA_E_FAILEDSELFTEST TPM_E_FAILEDSELFTEST
+#define TCPA_E_AUTH2FAIL TPM_E_AUTH2FAIL
+#define TCPA_E_BADTAG TPM_E_BADTAG
+#define TCPA_E_IOERROR TPM_E_IOERROR
+#define TCPA_E_ENCRYPT_ERROR TPM_E_ENCRYPT_ERROR
+#define TCPA_E_DECRYPT_ERROR TPM_E_DECRYPT_ERROR
+#define TCPA_E_INVALID_AUTHHANDLE TPM_E_INVALID_AUTHHANDLE
+#define TCPA_E_NO_ENDORSEMENT TPM_E_NO_ENDORSEMENT
+#define TCPA_E_INVALID_KEYUSAGE TPM_E_INVALID_KEYUSAGE
+#define TCPA_E_WRONG_ENTITYTYPE TPM_E_WRONG_ENTITYTYPE
+#define TCPA_E_INVALID_POSTINIT TPM_E_INVALID_POSTINIT
+#define TCPA_E_INAPPROPRIATE_SIG TPM_E_INAPPROPRIATE_SIG
+#define TCPA_E_BAD_KEY_PROPERTY TPM_E_BAD_KEY_PROPERTY
+#define TCPA_E_BAD_MIGRATION TPM_E_BAD_MIGRATION
+#define TCPA_E_BAD_SCHEME TPM_E_BAD_SCHEME
+#define TCPA_E_BAD_DATASIZE TPM_E_BAD_DATASIZE
+#define TCPA_E_BAD_MODE TPM_E_BAD_MODE
+#define TCPA_E_BAD_PRESENCE TPM_E_BAD_PRESENCE
+#define TCPA_E_BAD_VERSION TPM_E_BAD_VERSION
+#define TCPA_E_RETRY TPM_E_RETRY
+
+#endif
diff --git a/src/include/tss/platform.h b/src/include/tss/platform.h
new file mode 100644
index 0000000..495afc7
--- /dev/null
+++ b/src/include/tss/platform.h
@@ -0,0 +1,46 @@
+/*++
+
+There are platform dependent and general defines.
+
+--*/
+
+#ifndef TSS_PLATFORM_H
+#define TSS_PLATFORM_H
+
+
+/* The default implementation is to use stdint.h, a part of the C99 standard.
+ * Systems that don't support this are handled on a case-by-case basis.
+ */
+
+#if !defined(WIN32)
+#include <stdint.h>
+ typedef uint8_t BYTE;
+ typedef int8_t TSS_BOOL;
+ typedef uint16_t UINT16;
+ typedef uint32_t UINT32;
+ typedef uint64_t UINT64;
+
+ typedef uint16_t TSS_UNICODE;
+ typedef void* PVOID;
+
+#elif defined(WIN32)
+#include <basetsd.h>
+ typedef unsigned char BYTE;
+ typedef signed char TSS_BOOL;
+#ifndef _BASETSD_H_
+ // basetsd.h provides definitions of UINT16, UINT32 and UINT64.
+ typedef unsigned short UINT16;
+ typedef unsigned long UINT32;
+ typedef unsigned __int64 UINT64;
+#endif
+ typedef unsigned short TSS_UNICODE;
+ typedef void* PVOID;
+#endif
+
+
+/* Include this so that applications that use names as defined in the
+ * 1.1 TSS specification can still compile
+ */
+#include <tss/compat11b.h>
+
+#endif // TSS_PLATFORM_H
diff --git a/src/include/tss/tcpa_defines.h b/src/include/tss/tcpa_defines.h
new file mode 100644
index 0000000..ea0a994
--- /dev/null
+++ b/src/include/tss/tcpa_defines.h
@@ -0,0 +1,7 @@
+
+#ifndef __TCPA_DEFINES_H__
+#define __TCPA_DEFINES_H__
+
+#warning including deprecated header file tcpa_defines.h
+
+#endif
diff --git a/src/include/tss/tcpa_error.h b/src/include/tss/tcpa_error.h
new file mode 100644
index 0000000..6391227
--- /dev/null
+++ b/src/include/tss/tcpa_error.h
@@ -0,0 +1,7 @@
+
+#ifndef __TCPA_ERROR_H__
+#define __TCPA_ERROR_H__
+
+#warning including deprecated header file tcpa_error.h
+
+#endif
diff --git a/src/include/tss/tcpa_struct.h b/src/include/tss/tcpa_struct.h
new file mode 100644
index 0000000..8ba7db7
--- /dev/null
+++ b/src/include/tss/tcpa_struct.h
@@ -0,0 +1,7 @@
+
+#ifndef __TCPA_STRUCT_H__
+#define __TCPA_STRUCT_H__
+
+#warning including deprecated header file tcpa_struct.h
+
+#endif
diff --git a/src/include/tss/tcpa_typedef.h b/src/include/tss/tcpa_typedef.h
new file mode 100644
index 0000000..9bcac88
--- /dev/null
+++ b/src/include/tss/tcpa_typedef.h
@@ -0,0 +1,7 @@
+
+#ifndef __TCPA_TYPEDEF_H__
+#define __TCPA_TYPEDEF_H__
+
+#warning including deprecated header file tcpa_typedef.h
+
+#endif
diff --git a/src/include/tss/tcs.h b/src/include/tss/tcs.h
new file mode 100644
index 0000000..f2ec7f4
--- /dev/null
+++ b/src/include/tss/tcs.h
@@ -0,0 +1,1129 @@
+#ifndef TCS_H
+#define TCS_H
+#include <tss/platform.h>
+#include <tss/tss_structs.h>
+#include <tss/tcs_typedef.h>
+#include <tss/tcs_defines.h>
+#include <tss/tcs_structs.h>
+#include <tss/tcs_error.h>
+#include <tss/tpm.h>
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+extern TSS_RESULT Tcsi_OpenContext
+(
+ TCS_CONTEXT_HANDLE* hContext // out
+);
+extern TSS_RESULT Tcsi_CloseContext
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsi_FreeMemory
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ BYTE* pMemory // in
+);
+extern TSS_RESULT Tcsi_GetCapability
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_CAPABILITY_AREA capArea, // in
+ UINT32 subCapSize, // in
+ BYTE* subCap, // in
+ UINT32* respSize, // out
+ BYTE** resp // out
+);
+extern TSS_RESULT Tcsi_RegisterKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_UUID WrappingKeyUUID, // in
+ TSS_UUID KeyUUID, // in
+ UINT32 cKeySize, // in
+ BYTE* rgbKey, // in
+ UINT32 cVendorDataSize, // in
+ BYTE* gbVendorData // in
+);
+extern TSS_RESULT Tcsip_UnregisterKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_UUID KeyUUID // in
+);
+extern TSS_RESULT Tcsip_KeyControlOwner
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hKey, // in
+ UINT32 ulPubKeyLength, // in
+ BYTE* prgbPubKey, // in
+ UINT32 attribName, // in
+ TSS_BOOL attribValue, // in
+ TPM_AUTH* pOwnerAuth, // in, out
+ TSS_UUID* pUuidData // out
+);
+extern TSS_RESULT Tcsi_EnumRegisteredKeys
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_UUID* pKeyUUID, // in
+ UINT32* pcKeyHierarchySize, // out
+ TSS_KM_KEYINFO** ppKeyHierarchy // out
+);
+extern TSS_RESULT Tcsi_GetRegisteredKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_UUID KeyUUID, // in
+ TSS_KM_KEYINFO** ppKeyInfo // out
+);
+extern TSS_RESULT Tcsi_GetRegisteredKeyBlob
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_UUID KeyUUID, // in
+ UINT32* pcKeySize, // out
+ BYTE** prgbKey // out
+);
+extern TSS_RESULT Tcsip_GetRegisteredKeyByPublicInfo
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_ALGORITHM_ID algID, // in
+ UINT32 ulPublicInfoLength, // in
+ BYTE* rgbPublicInfo, // in
+ UINT32* keySize, // out
+ BYTE** keyBlob // out
+);
+extern TSS_RESULT Tcsip_LoadKeyByBlob
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hUnwrappingKey, // in
+ UINT32 cWrappedKeyBlobSize, // in
+ BYTE* rgbWrappedKeyBlob, // in
+ TPM_AUTH* pAuth, // in, out
+ TCS_KEY_HANDLE* phKeyTCSI, // out
+ TCS_KEY_HANDLE* phKeyHMAC // out
+);
+extern TSS_RESULT Tcsip_LoadKeyByUUID
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_UUID KeyUUID, // in
+ TCS_LOADKEY_INFO* pLoadKeyInfo, // in, out
+ TCS_KEY_HANDLE* phKeyTCSI // out
+);
+extern TSS_RESULT Tcsip_EvictKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hKey // in
+);
+extern TSS_RESULT Tcsip_CreateWrapKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hWrappingKey, // in
+ TPM_ENCAUTH KeyUsageAuth, // in
+ TPM_ENCAUTH KeyMigrationAuth, // in
+ UINT32 keyInfoSize, // in
+ BYTE* keyInfo, // in
+ TPM_AUTH* pAuth, // in, out
+ UINT32* keyDataSize, // out
+ BYTE** keyData // out
+);
+extern TSS_RESULT Tcsip_GetPubKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hKey, // in
+ TPM_AUTH* pAuth, // in, out
+ UINT32* pcPubKeySize, // out
+ BYTE** prgbPubKey // out
+);
+extern TSS_RESULT Tcsip_MakeIdentity
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_ENCAUTH identityAuth, // in
+ TPM_CHOSENID_HASH IDLabel_PrivCAHash, // in
+ UINT32 idIdentityKeyInfoSize, // in
+ BYTE* idIdentityKeyInfo, // in
+ TPM_AUTH* pSrkAuth, // in, out
+ TPM_AUTH* pOwnerAuth, // in, out
+ UINT32* idIdentityKeySize, // out
+ BYTE** idIdentityKey, // out
+ UINT32* pcIdentityBindingSize, // out
+ BYTE** prgbIdentityBinding, // out
+ UINT32* pcEndorsementCredentialSize, // out
+ BYTE** prgbEndorsementCredential, // out
+ UINT32* pcPlatformCredentialSize, // out
+ BYTE** prgbPlatformCredential, // out
+ UINT32* pcConformanceCredentialSize, // out
+ BYTE** prgbConformanceCredential // out
+);
+extern TSS_RESULT Tcsip_MakeIdentity2
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_ENCAUTH identityAuth, // in
+ TPM_CHOSENID_HASH IDLabel_PrivCAHash, // in
+ UINT32 idIdentityKeyInfoSize, // in
+ BYTE* idIdentityKeyInfo, // in
+ TPM_AUTH* pSrkAuth, // in, out
+ TPM_AUTH* pOwnerAuth, // in, out
+ UINT32* idIdentityKeySize, // out
+ BYTE** idIdentityKey, // out
+ UINT32* pcIdentityBindingSize, // out
+ BYTE** prgbIdentityBinding // out
+);
+extern TSS_RESULT Tcsi_LogPcrEvent
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_PCR_EVENT Event, // in
+ UINT32* pNumber // out
+);
+extern TSS_RESULT Tcsi_GetPcrEvent
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 PcrIndex, // in
+ UINT32* pNumber, // in, out
+ TSS_PCR_EVENT** ppEvent // out
+);
+extern TSS_RESULT Tcsi_GetPcrEventsByPcr
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 PcrIndex, // in
+ UINT32 FirstEvent, // in
+ UINT32* pEventCount, // in, out
+ TSS_PCR_EVENT** ppEvents // out
+);
+extern TSS_RESULT Tcsi_GetPcrEventLog
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32* pEventCount, // out
+ TSS_PCR_EVENT** ppEvents // out
+);
+extern TSS_RESULT Tcsip_SetOwnerInstall
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_BOOL state // in
+);
+extern TSS_RESULT Tcsip_TakeOwnership
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT16 protocolID, // in
+ UINT32 encOwnerAuthSize, // in
+ BYTE* encOwnerAuth, // in
+ UINT32 encSrkAuthSize, // in
+ BYTE* encSrkAuth, // in
+ UINT32 srkKeyInfoSize, // in
+ BYTE* srkKeyInfo, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* srkKeyDataSize, // out
+ BYTE** srkKeyData // out
+);
+extern TSS_RESULT Tcsip_SetOperatorAuth
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_SECRET operatorAuth // in
+);
+extern TSS_RESULT Tcsip_OIAP
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_AUTHHANDLE* authHandle, // out
+ TPM_NONCE* nonce0 // out
+);
+extern TSS_RESULT Tcsip_OSAP
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_ENTITY_TYPE entityType, // in
+ UINT32 entityValue, // in
+ TPM_NONCE nonceOddOSAP, // in
+ TCS_AUTHHANDLE* authHandle, // out
+ TPM_NONCE* nonceEven, // out
+ TPM_NONCE* nonceEvenOSAP // out
+);
+extern TSS_RESULT Tcsip_ChangeAuth
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE parentHandle, // in
+ TPM_PROTOCOL_ID protocolID, // in
+ TPM_ENCAUTH newAuth, // in
+ TPM_ENTITY_TYPE entityType, // in
+ UINT32 encDataSize, // in
+ BYTE* encData, // in
+ TPM_AUTH* ownerAuth, // in, out
+ TPM_AUTH* entityAuth, // in, out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_ChangeAuthOwner
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_PROTOCOL_ID protocolID, // in
+ TPM_ENCAUTH newAuth, // in
+ TPM_ENTITY_TYPE entityType, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_ChangeAuthAsymStart
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE idHandle, // in
+ TPM_NONCE antiReplay, // in
+ UINT32 TempKeyInfoSize, // in
+ BYTE* TempKeyInfoData, // in
+ TPM_AUTH* pAuth, // in, out
+ UINT32* TempKeySize, // out
+ BYTE** TempKeyData, // out
+ UINT32* CertifyInfoSize, // out
+ BYTE** CertifyInfo, // out
+ UINT32* sigSize, // out
+ BYTE** sig, // out
+ TCS_KEY_HANDLE* ephHandle // out
+);
+extern TSS_RESULT Tcsip_ChangeAuthAsymFinish
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE parentHandle, // in
+ TCS_KEY_HANDLE ephHandle, // in
+ TPM_ENTITY_TYPE entityType, // in
+ TPM_HMAC newAuthLink, // in
+ UINT32 newAuthSize, // in
+ BYTE* encNewAuth, // in
+ UINT32 encDataSizeIn, // in
+ BYTE* encDataIn, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* encDataSizeOut, // out
+ BYTE** encDataOut, // out
+ TPM_NONCE* saltNonce, // out
+ TPM_DIGEST* changeProof // out
+);
+extern TSS_RESULT Tcsip_TerminateHandle
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_AUTHHANDLE handle // in
+);
+extern TSS_RESULT Tcsip_ActivateTPMIdentity
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE idKey, // in
+ UINT32 blobSize, // in
+ BYTE* blob, // in
+ TPM_AUTH* idKeyAuth, // in, out
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* SymmetricKeySize, // out
+ BYTE** SymmetricKey // out
+);
+extern TSS_RESULT Tcsip_EstablishTransport
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 ulTransControlFlags, // in
+ TCS_KEY_HANDLE hEncKey, // in
+ UINT32 ulTransSessionInfoSize, // in
+ BYTE* rgbTransSessionInfo, // in
+ UINT32 ulSecretSize, // in
+ BYTE* rgbSecret, // in
+ TPM_AUTH* pEncKeyAuth, // in, out
+ TPM_MODIFIER_INDICATOR* pbLocality, // out
+ TCS_HANDLE* hTransSession, // out
+ UINT32* ulCurrentTicksSize, // out
+ BYTE** prgbCurrentTicks, // out
+ TPM_NONCE* pTransNonce // out
+);
+extern TSS_RESULT Tcsip_ExecuteTransport
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_COMMAND_CODE unWrappedCommandOrdinal, // in
+ UINT32 ulWrappedCmdParamInSize, // in
+ BYTE* rgbWrappedCmdParamIn, // in
+ UINT32* pulHandleListSize, // in, out
+ TCS_HANDLE** rghHandles, // in, out
+ TPM_AUTH* pWrappedCmdAuth1, // in, out
+ TPM_AUTH* pWrappedCmdAuth2, // in, out
+ TPM_AUTH* pTransAuth, // in, out
+ UINT64* punCurrentTicks, // out
+ TPM_MODIFIER_INDICATOR* pbLocality, // out
+ TPM_RESULT* pulWrappedCmdReturnCode, // out
+ UINT32* ulWrappedCmdParamOutSize, // out
+ BYTE** rgbWrappedCmdParamOut // out
+);
+extern TSS_RESULT Tcsip_ReleaseTransportSigned
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hSignatureKey, // in
+ TPM_NONCE AntiReplayNonce, // in
+ TPM_AUTH* pKeyAuth, // in, out
+ TPM_AUTH* pTransAuth, // in, out
+ TPM_MODIFIER_INDICATOR* pbLocality, // out
+ UINT32* pulCurrentTicksSize, // out
+ BYTE** prgbCurrentTicks, // out
+ UINT32* pulSignatureSize, // out
+ BYTE** prgbSignature // out
+);
+extern TSS_RESULT Tcsip_Extend
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_PCRINDEX pcrNum, // in
+ TPM_DIGEST inDigest, // in
+ TPM_PCRVALUE* outDigest // out
+);
+extern TSS_RESULT Tcsip_PcrRead
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_PCRINDEX pcrNum, // in
+ TPM_PCRVALUE* outDigest // out
+);
+extern TSS_RESULT Tcsip_Quote
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_NONCE antiReplay, // in
+ UINT32 pcrTargetSize, // in
+ BYTE* pcrTarget, // in
+ TPM_AUTH* privAuth, // in, out
+ UINT32* pcrDataSize, // out
+ BYTE** pcrData, // out
+ UINT32* sigSize, // out
+ BYTE** sig // out
+);
+extern TSS_RESULT Tcsip_Quote2
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_NONCE antiReplay, // in
+ UINT32 pcrTargetSize, // in
+ BYTE* pcrTarget, // in
+ TSS_BOOL addVersion, // in
+ TPM_AUTH* privAuth, // in, out
+ UINT32* pcrDataSize, // out
+ BYTE** pcrData, // out
+ UINT32* versionInfoSize, // out
+ BYTE** versionInfo, // out
+ UINT32* sigSize, // out
+ BYTE** sig // out
+);
+extern TSS_RESULT Tcsip_DirWriteAuth
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_DIRINDEX dirIndex, // in
+ TPM_DIRVALUE newContents, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_DirRead
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_DIRINDEX dirIndex, // in
+ TPM_DIRVALUE* dirValue // out
+);
+extern TSS_RESULT Tcsip_Seal
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_ENCAUTH encAuth, // in
+ UINT32 pcrInfoSize, // in
+ BYTE* PcrInfo, // in
+ UINT32 inDataSize, // in
+ BYTE* inData, // in
+ TPM_AUTH* pubAuth, // in, out
+ UINT32* SealedDataSize, // out
+ BYTE** SealedData // out
+);
+extern TSS_RESULT Tcsip_Unseal
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ UINT32 SealedDataSize, // in
+ BYTE* SealedData, // in
+ TPM_AUTH* keyAuth, // in, out
+ TPM_AUTH* dataAuth, // in, out
+ UINT32* DataSize, // out
+ BYTE** Data // out
+);
+extern TSS_RESULT Tcsip_UnBind
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ UINT32 inDataSize, // in
+ BYTE* inData, // in
+ TPM_AUTH* privAuth, // in, out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_Sealx
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_ENCAUTH encAuth, // in
+ UINT32 pcrInfoSize, // in
+ BYTE* PcrInfo, // in
+ UINT32 inDataSize, // in
+ BYTE* inData, // in
+ TPM_AUTH* pubAuth, // in, out
+ UINT32* SealedDataSize, // out
+ BYTE** SealedData // out
+);
+extern TSS_RESULT Tcsip_LoadKey2ByBlob
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hUnwrappingKey, // in
+ UINT32 cWrappedKeyBlobSize, // in
+ BYTE* rgbWrappedKeyBlob, // in
+ TPM_AUTH* pAuth, // in, out
+ TCS_KEY_HANDLE* phKeyTCSI // out
+);
+extern TSS_RESULT Tcsip_CreateMigrationBlob
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE parentHandle, // in
+ TSS_MIGRATE_SCHEME migrationType, // in
+ UINT32 MigrationKeyAuthSize, // in
+ BYTE* MigrationKeyAuth, // in
+ UINT32 encDataSize, // in
+ BYTE* encData, // in
+ TPM_AUTH* parentAuth, // in, out
+ TPM_AUTH* entityAuth, // in, out
+ UINT32* randomSize, // out
+ BYTE** random, // out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_ConvertMigrationBlob
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE parentHandle, // in
+ UINT32 inDataSize, // in
+ BYTE* inData, // in
+ UINT32 randomSize, // in
+ BYTE* random, // in
+ TPM_AUTH* parentAuth, // in, out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_AuthorizeMigrationKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_MIGRATE_SCHEME migrateScheme, // in
+ UINT32 MigrationKeySize, // in
+ BYTE* MigrationKey, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* MigrationKeyAuthSize, // out
+ BYTE** MigrationKeyAuth // out
+);
+extern TSS_RESULT Tcsip_CertifyKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE certHandle, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_NONCE antiReplay, // in
+ TPM_AUTH* certAuth, // in, out
+ TPM_AUTH* keyAuth, // in, out
+ UINT32* CertifyInfoSize, // out
+ BYTE** CertifyInfo, // out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_CertifyKey2
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE certHandle, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_DIGEST MSAdigest, // in
+ TPM_NONCE antiReplay, // in
+ TPM_AUTH* certAuth, // in, out
+ TPM_AUTH* keyAuth, // in, out
+ UINT32* CertifyInfoSize, // out
+ BYTE** CertifyInfo, // out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_Sign
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ UINT32 areaToSignSize, // in
+ BYTE* areaToSign, // in
+ TPM_AUTH* privAuth, // in, out
+ UINT32* sigSize, // out
+ BYTE** sig // out
+);
+extern TSS_RESULT Tcsip_GetRandom
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32* bytesRequested, // in, out
+ BYTE** randomBytes // out
+);
+extern TSS_RESULT Tcsip_StirRandom
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 inDataSize, // in
+ BYTE* inData // in
+);
+extern TSS_RESULT Tcsip_GetCapability
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_CAPABILITY_AREA capArea, // in
+ UINT32 subCapSize, // in
+ BYTE* subCap, // in
+ UINT32* respSize, // out
+ BYTE** resp // out
+);
+extern TSS_RESULT Tcsip_GetCapabilitySigned
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_NONCE antiReplay, // in
+ TPM_CAPABILITY_AREA capArea, // in
+ UINT32 subCapSize, // in
+ BYTE* subCap, // in
+ TPM_AUTH* privAuth, // in, out
+ TPM_VERSION* Version, // out
+ UINT32* respSize, // out
+ BYTE** resp, // out
+ UINT32* sigSize, // out
+ BYTE** sig // out
+);
+extern TSS_RESULT Tcsip_GetCapabilityOwner
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* pOwnerAuth, // in, out
+ TPM_VERSION* pVersion, // out
+ UINT32* pNonVolatileFlags, // out
+ UINT32* pVolatileFlags // out
+);
+extern TSS_RESULT Tcsip_CreateEndorsementKeyPair
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_NONCE antiReplay, // in
+ UINT32 endorsementKeyInfoSize, // in
+ BYTE* endorsementKeyInfo, // in
+ UINT32* endorsementKeySize, // out
+ BYTE** endorsementKey, // out
+ TPM_DIGEST* checksum // out
+);
+extern TSS_RESULT Tcsip_ReadPubek
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_NONCE antiReplay, // in
+ UINT32* pubEndorsementKeySize, // out
+ BYTE** pubEndorsementKey, // out
+ TPM_DIGEST* checksum // out
+);
+extern TSS_RESULT Tcsip_DisablePubekRead
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_OwnerReadPubek
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* pubEndorsementKeySize, // out
+ BYTE** pubEndorsementKey // out
+);
+extern TSS_RESULT Tcsip_SelfTestFull
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsip_CertifySelfTest
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_NONCE antiReplay, // in
+ TPM_AUTH* privAuth, // in, out
+ UINT32* sigSize, // out
+ BYTE** sig // out
+);
+extern TSS_RESULT Tcsip_ContinueSelfTest
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsip_GetTestResult
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_OwnerSetDisable
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_BOOL disableState, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_OwnerClear
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_DisableOwnerClear
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_ForceClear
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsip_DisableForceClear
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsip_PhysicalDisable
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsip_PhysicalEnable
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsip_PhysicalSetDeactivated
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_BOOL state // in
+);
+extern TSS_RESULT Tcsip_SetTempDeactivated
+(
+ TCS_CONTEXT_HANDLE hContext // in
+);
+extern TSS_RESULT Tcsip_SetTempDeactivated2
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* pOperatorAuth // in, out
+);
+extern TSS_RESULT Tcsip_OwnerReadInternalPub
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hKey, // in
+ TPM_AUTH* pOwnerAuth, // in, out
+ UINT32* punPubKeySize, // out
+ BYTE** ppbPubKeyData // out
+);
+extern TSS_RESULT Tcsip_PhysicalPresence
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_PHYSICAL_PRESENCE fPhysicalPresence // in
+);
+extern TSS_RESULT Tcsip_FieldUpgrade
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 dataInSize, // in
+ BYTE* dataIn, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* dataOutSize, // out
+ BYTE** dataOut // out
+);
+extern TSS_RESULT Tcsip_ResetLockValue
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_FlushSpecific
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_HANDLE hResHandle, // in
+ TPM_RESOURCE_TYPE resourceType // in
+);
+extern TSS_RESULT Tcsip_SetRedirection
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ UINT32 c1, // in
+ UINT32 c2, // in
+ TPM_AUTH* privAuth // in, out
+);
+extern TSS_RESULT Tcsip_DSAP
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_ENTITY_TYPE entityType, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TPM_NONCE nonceOddDSAP, // in
+ UINT32 entityValueSize, // in
+ BYTE* entityValue, // in
+ TCS_AUTHHANDLE* authHandle, // out
+ TPM_NONCE* nonceEven, // out
+ TPM_NONCE* nonceEvenDSAP // out
+);
+extern TSS_RESULT Tcsip_Delegate_Manage
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_FAMILY_ID familyID, // in
+ TPM_FAMILY_OPERATION opFlag, // in
+ UINT32 opDataSize, // in
+ BYTE* opData, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* retDataSize, // out
+ BYTE** retData // out
+);
+extern TSS_RESULT Tcsip_Delegate_CreateKeyDelegation
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hKey, // in
+ UINT32 publicInfoSize, // in
+ BYTE* publicInfo, // in
+ TPM_ENCAUTH encDelAuth, // in
+ TPM_AUTH* keyAuth, // in, out
+ UINT32* blobSize, // out
+ BYTE** blob // out
+);
+extern TSS_RESULT Tcsip_Delegate_CreateOwnerDelegation
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_BOOL increment, // in
+ UINT32 publicInfoSize, // in
+ BYTE* publicInfo, // in
+ TPM_ENCAUTH encDelAuth, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* blobSize, // out
+ BYTE** blob // out
+);
+extern TSS_RESULT Tcsip_Delegate_LoadOwnerDelegation
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_DELEGATE_INDEX index, // in
+ UINT32 blobSize, // in
+ BYTE* blob, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_Delegate_UpdateVerificationCount
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 inputSize, // in
+ BYTE* input, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* outputSize, // out
+ BYTE** output // out
+);
+extern TSS_RESULT Tcsip_Delegate_VerifyDelegation
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 delegateSize, // in
+ BYTE* delegate // in
+);
+extern TSS_RESULT Tcsip_Delegate_ReadTable
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32* pulFamilyTableSize, // out
+ BYTE** ppFamilyTable, // out
+ UINT32* pulDelegateTableSize, // out
+ BYTE** ppDelegateTable // out
+);
+extern TSS_RESULT Tcsip_NV_DefineOrReleaseSpace
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 cPubInfoSize, // in
+ BYTE* pPubInfo, // in
+ TPM_ENCAUTH encAuth, // in
+ TPM_AUTH* pAuth // in, out
+);
+extern TSS_RESULT Tcsip_NV_WriteValue
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_NV_INDEX hNVStore, // in
+ UINT32 offset, // in
+ UINT32 ulDataLength, // in
+ BYTE* rgbDataToWrite, // in
+ TPM_AUTH* privAuth // in, out
+);
+extern TSS_RESULT Tcsip_NV_WriteValueAuth
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_NV_INDEX hNVStore, // in
+ UINT32 offset, // in
+ UINT32 ulDataLength, // in
+ BYTE* rgbDataToWrite, // in
+ TPM_AUTH* NVAuth // in, out
+);
+extern TSS_RESULT Tcsip_NV_ReadValue
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_NV_INDEX hNVStore, // in
+ UINT32 offset, // in
+ UINT32* pulDataLength, // in, out
+ TPM_AUTH* privAuth, // in, out
+ BYTE** rgbDataRead // out
+);
+extern TSS_RESULT Tcsip_NV_ReadValueAuth
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_NV_INDEX hNVStore, // in
+ UINT32 offset, // in
+ UINT32* pulDataLength, // in, out
+ TPM_AUTH* NVAuth, // in, out
+ BYTE** rgbDataRead // out
+);
+extern TSS_RESULT Tcsip_CreateMaintenanceArchive
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_BOOL generateRandom, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* randomSize, // out
+ BYTE** random, // out
+ UINT32* archiveSize, // out
+ BYTE** archive // out
+);
+extern TSS_RESULT Tcsip_LoadMaintenanceArchive
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 dataInSize, // in
+ BYTE* dataIn, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* dataOutSize, // out
+ BYTE** dataOut // out
+);
+extern TSS_RESULT Tcsip_KillMaintenanceFeature
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_LoadManuMaintPub
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_NONCE antiReplay, // in
+ UINT32 PubKeySize, // in
+ BYTE* PubKey, // in
+ TPM_DIGEST* checksum // out
+);
+extern TSS_RESULT Tcsip_ReadManuMaintPub
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_NONCE antiReplay, // in
+ TPM_DIGEST* checksum // out
+);
+extern TSS_RESULT Tcsip_CreateRevocableEndorsementKeyPair
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_NONCE antiReplay, // in
+ UINT32 endorsementKeyInfoSize, // in
+ BYTE* endorsementKeyInfo, // in
+ TSS_BOOL GenResetAuth, // in
+ TPM_DIGEST* EKResetAuth, // in, out
+ UINT32* endorsementKeySize, // out
+ BYTE** endorsementKey, // out
+ TPM_DIGEST* checksum // out
+);
+extern TSS_RESULT Tcsip_RevokeEndorsementKeyPair
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_DIGEST EKResetAuth // in
+);
+extern TSS_RESULT Tcsip_PcrReset
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 pcrTargetSize, // in
+ BYTE* pcrTarget // in
+);
+extern TSS_RESULT Tcsip_ReadCounter
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_COUNTER_ID idCounter, // in
+ TPM_COUNTER_VALUE* counterValue // out
+);
+extern TSS_RESULT Tcsip_CreateCounter
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 LabelSize, // in (=4)
+ BYTE* pLabel, // in
+ TPM_ENCAUTH CounterAuth, // in
+ TPM_AUTH* pOwnerAuth, // in, out
+ TSS_COUNTER_ID* idCounter, // out
+ TPM_COUNTER_VALUE* counterValue // out
+);
+extern TSS_RESULT Tcsip_IncrementCounter
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_COUNTER_ID idCounter, // in
+ TPM_AUTH* pCounterAuth, // in, out
+ TPM_COUNTER_VALUE* counterValue // out
+);
+extern TSS_RESULT Tcsip_ReleaseCounter
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_COUNTER_ID idCounter, // in
+ TPM_AUTH* pCounterAuth // in, out
+);
+extern TSS_RESULT Tcsip_ReleaseCounterOwner
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_COUNTER_ID idCounter, // in
+ TPM_AUTH* pOwnerAuth // in, out
+);
+extern TSS_RESULT Tcsip_ReadCurrentTicks
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32* pulCurrentTimeSize, // out
+ BYTE** prgbCurrentTime // out
+);
+extern TSS_RESULT Tcsip_TickStampBlob
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hKey, // in
+ TPM_NONCE antiReplay, // in
+ TPM_DIGEST digestToStamp, // in
+ TPM_AUTH* privAuth, // in, out
+ UINT32* pulSignatureLength, // out
+ BYTE** prgbSignature, // out
+ UINT32* pulTickCountSize, // out
+ BYTE** prgbTickCount // out
+);
+extern TSS_RESULT Tcsip_TPM_DAA_Join
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_HANDLE handle, // in
+ BYTE stage, // in
+ UINT32 inputSize0, // in
+ BYTE* inputData0, // in
+ UINT32 inputSize1, // in
+ BYTE* inputData1, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* outputSize, // out
+ BYTE** outputData // out
+);
+extern TSS_RESULT Tcsip_TPM_DAA_Sign
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_HANDLE handle, // in
+ BYTE stage, // in
+ UINT32 inputSize0, // in
+ BYTE* inputData0, // in
+ UINT32 inputSize1, // in
+ BYTE* inputData1, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* outputSize, // out
+ BYTE** outputData // out
+);
+extern TSS_RESULT Tcsip_MigrateKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hMaKey, // in
+ UINT32 PublicKeySize, // in
+ BYTE* PublicKey, // in
+ UINT32 inDataSize, // in
+ BYTE* inData, // in
+ TPM_AUTH* ownerAuth, // in, out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_CMK_SetRestrictions
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TSS_CMK_DELEGATE Restriction, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_CMK_ApproveMA
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_DIGEST migAuthorityDigest, // in
+ TPM_AUTH* ownerAuth, // in, out
+ TPM_HMAC* HmacMigAuthDigest // out
+);
+extern TSS_RESULT Tcsip_CMK_CreateKey
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE hWrappingKey, // in
+ TPM_ENCAUTH KeyUsageAuth, // in
+ TPM_HMAC MigAuthApproval, // in
+ TPM_DIGEST MigAuthorityDigest, // in
+ UINT32* keyDataSize, // in, out
+ BYTE** prgbKeyData, // in, out
+ TPM_AUTH* pAuth // in, out
+);
+extern TSS_RESULT Tcsip_CMK_CreateTicket
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 PublicVerifyKeySize, // in
+ BYTE* PublicVerifyKey, // in
+ TPM_DIGEST SignedData, // in
+ UINT32 SigValueSize, // in
+ BYTE* SigValue, // in
+ TPM_AUTH* pOwnerAuth, // in, out
+ TPM_HMAC* SigTicket // out
+);
+extern TSS_RESULT Tcsip_CMK_CreateBlob
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE parentHandle, // in
+ TSS_MIGRATE_SCHEME migrationType, // in
+ UINT32 MigrationKeyAuthSize, // in
+ BYTE* MigrationKeyAuth, // in
+ TPM_DIGEST PubSourceKeyDigest, // in
+ UINT32 msaListSize, // in
+ BYTE* msaList, // in
+ UINT32 restrictTicketSize, // in
+ BYTE* restrictTicket, // in
+ UINT32 sigTicketSize, // in
+ BYTE* sigTicket, // in
+ UINT32 encDataSize, // in
+ BYTE* encData, // in
+ TPM_AUTH* parentAuth, // in, out
+ UINT32* randomSize, // out
+ BYTE** random, // out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_CMK_ConvertMigration
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE parentHandle, // in
+ TPM_CMK_AUTH restrictTicket, // in
+ TPM_HMAC sigTicket, // in
+ UINT32 keyDataSize, // in
+ BYTE* prgbKeyData, // in
+ UINT32 msaListSize, // in
+ BYTE* msaList, // in
+ UINT32 randomSize, // in
+ BYTE* random, // in
+ TPM_AUTH* parentAuth, // in, out
+ UINT32* outDataSize, // out
+ BYTE** outData // out
+);
+extern TSS_RESULT Tcsip_SetCapability
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TPM_CAPABILITY_AREA capArea, // in
+ UINT32 subCapSize, // in
+ BYTE* subCap, // in
+ UINT32 valueSize, // in
+ BYTE* value, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsip_GetAuditDigest
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 startOrdinal, // in
+ TPM_DIGEST* auditDigest, // out
+ UINT32* counterValueSize, // out
+ BYTE** counterValue, // out
+ TSS_BOOL* more, // out
+ UINT32* ordSize, // out
+ UINT32** ordList // out
+);
+extern TSS_RESULT Tcsip_GetAuditDigestSigned
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ TCS_KEY_HANDLE keyHandle, // in
+ TSS_BOOL closeAudit, // in
+ TPM_NONCE antiReplay, // in
+ TPM_AUTH* privAuth, // in, out
+ UINT32* counterValueSize, // out
+ BYTE** counterValue, // out
+ TPM_DIGEST* auditDigest, // out
+ TPM_DIGEST* ordinalDigest, // out
+ UINT32* sigSize, // out
+ BYTE** sig // out
+);
+extern TSS_RESULT Tcsip_SetOrdinalAuditStatus
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 ordinalToAudit, // in
+ TSS_BOOL auditState, // in
+ TPM_AUTH* ownerAuth // in, out
+);
+extern TSS_RESULT Tcsi_Admin_TSS_SessionsPerLocality
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 ulLocality, // in
+ UINT32 ulSessions, // in
+ TPM_AUTH* pOwnerAuth // in, out
+);
+extern TSS_RESULT Tcsi_GetCredential
+(
+ TCS_CONTEXT_HANDLE hContext, // in
+ UINT32 ulCredentialType, // in
+ UINT32 ulCredentialAccessMode, // in
+ UINT32* pulCredentialSize, // out
+ BYTE** prgbCredentialData // out
+);
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
+#endif /* TCS_H */
diff --git a/src/include/tss/tcs_defines.h b/src/include/tss/tcs_defines.h
new file mode 100644
index 0000000..5b0d192
--- /dev/null
+++ b/src/include/tss/tcs_defines.h
@@ -0,0 +1,28 @@
+/*++
+
+TSS Core Service structures
+
+*/
+
+#ifndef __TCS_DEFINES_H__
+#define __TCS_DEFINES_H__
+
+#define TSS_TCSATTRIB_TRANSPORT_DEFAULT ((UINT32)(0x00000000))
+#define TSS_TCSATTRIB_TRANSPORT_EXCLUSIVE ((UINT32)(0x00000001))
+
+
+// Values for the ulCredentialType parameter to Tcsi_GetCredential
+#define TSS_TCS_CREDENTIAL_EKCERT ((UINT32)0x00000001)
+#define TSS_TCS_CREDENTIAL_TPM_CC ((UINT32)0x00000002)
+#define TSS_TCS_CREDENTIAL_PLATFORMCERT ((UINT32)0x00000003)
+
+
+// Values for the ulCredentialAccessMode parameter to Tcsi_GetCredential
+// TSS_TCS_CERT_ACCESS_AUTO triggers the default behavior.
+// Values with TSS_TCS_CERT_VENDOR_SPECIFIC_BIT set trigger
+// vendor specific behavior.
+#define TSS_TCS_CERT_ACCESS_AUTO ((UINT32)0x00000001)
+
+#define TSS_TCS_CERT_VENDOR_SPECIFIC_BIT ((UINT32)0x80000000)
+
+#endif // __TCS_DEFINES_H__
diff --git a/src/include/tss/tcs_error.h b/src/include/tss/tcs_error.h
new file mode 100644
index 0000000..2a64c34
--- /dev/null
+++ b/src/include/tss/tcs_error.h
@@ -0,0 +1,56 @@
+/*++
+
+TSS Core Service error return codes
+
+--*/
+
+#ifndef __TCS_ERROR_H__
+#define __TCS_ERROR_H__
+
+
+#ifndef TSS_E_BASE
+#define TSS_E_BASE 0x00000000L
+#endif // TSS_E_BASE
+
+// The context handle supplied is invalid.
+#define TCS_E_INVALID_CONTEXTHANDLE (UINT32)(TSS_E_BASE + 0x0C1L)
+
+// The key handle supplied is invalid.
+#define TCS_E_INVALID_KEYHANDLE (UINT32)(TSS_E_BASE + 0x0C2L)
+
+// The authorization session handle supplied is invalid.
+#define TCS_E_INVALID_AUTHHANDLE (UINT32)(TSS_E_BASE + 0x0C3L)
+
+// the auth session has been closed by the TPM
+#define TCS_E_INVALID_AUTHSESSION (UINT32)(TSS_E_BASE + 0x0C4L)
+
+// the key has been unloaded
+#define TCS_E_INVALID_KEY (UINT32)(TSS_E_BASE + 0x0C5L)
+
+// Key addressed by the application key handle does not match the key addressed
+// by the given UUID.
+#define TCS_E_KEY_MISMATCH (UINT32)(TSS_E_BASE + 0x0C8L)
+
+// Key adressed by Key's UUID cannot be loaded because one of the required
+// parent keys needs authorization.
+#define TCS_E_KM_LOADFAILED (UINT32)(TSS_E_BASE + 0x0CAL)
+
+// The Key Cache Manager could not reload the key into the TPM.
+#define TCS_E_KEY_CONTEXT_RELOAD (UINT32)(TSS_E_BASE + 0x0CCL)
+
+// Bad memory index
+#define TCS_E_BAD_INDEX (UINT32)(TSS_E_BASE + 0x0CDL)
+
+
+// These TCS_E_ macros are defined by name in the TSS spec, however
+// they are defined to have the same values as the TSS_E_ equivalents.
+#define TCS_SUCCESS TSS_SUCCESS
+#define TCS_E_KEY_ALREADY_REGISTERED TSS_E_KEY_ALREADY_REGISTERED
+#define TCS_E_KEY_NOT_REGISTERED TSS_E_KEY_NOT_REGISTERED
+#define TCS_E_BAD_PARAMETER TSS_E_BAD_PARAMETER
+#define TCS_E_OUTOFMEMORY TSS_E_OUTOFMEMORY
+#define TCS_E_SIZE TSS_E_SIZE
+#define TCS_E_NOTIMPL TSS_E_NOTIMPL
+#define TCS_E_INTERNAL_ERROR TSS_E_INTERNAL_ERROR
+
+#endif // __TCS_ERROR_H__
diff --git a/src/include/tss/tcs_structs.h b/src/include/tss/tcs_structs.h
new file mode 100644
index 0000000..30b3fb9
--- /dev/null
+++ b/src/include/tss/tcs_structs.h
@@ -0,0 +1,40 @@
+/*++
+
+TSS Core Service structures
+
+*/
+
+#ifndef __TCS_STRUCT_H__
+#define __TCS_STRUCT_H__
+
+#include <tss/tpm.h>
+#include <tss/tss_structs.h>
+#include <tss/tcs_typedef.h>
+
+typedef struct tdTCS_AUTH
+{
+ TCS_AUTHHANDLE AuthHandle;
+ TPM_NONCE NonceOdd; // system
+ TPM_NONCE NonceEven; // TPM
+ TSS_BOOL fContinueAuthSession;
+ TPM_AUTHDATA HMAC;
+} TCS_AUTH;
+
+// This is kept for legacy compatibility
+typedef TCS_AUTH TPM_AUTH;
+
+
+typedef struct tdTCS_LOADKEY_INFO
+{
+ TSS_UUID keyUUID;
+ TSS_UUID parentKeyUUID;
+ TPM_DIGEST paramDigest; // SHA1 digest of the TPM_LoadKey
+ // Command input parameters
+ // As defined in TPM Main Specification
+ TPM_AUTH authData; // Data regarding a valid auth
+ // Session including the
+ // HMAC digest
+} TCS_LOADKEY_INFO;
+
+#endif // __TCS_STRUCT_H__
+
diff --git a/src/include/tss/tcs_typedef.h b/src/include/tss/tcs_typedef.h
new file mode 100644
index 0000000..0c89839
--- /dev/null
+++ b/src/include/tss/tcs_typedef.h
@@ -0,0 +1,32 @@
+/*++
+
+Global typedefs for TSS Core Service
+
+*/
+
+#ifndef __TCS_TYPEDEF_H__
+#define __TCS_TYPEDEF_H__
+
+#include <tss/tss_structs.h>
+#include <tss/tpm.h>
+
+typedef UINT32 TCS_AUTHHANDLE;
+typedef UINT32 TCS_CONTEXT_HANDLE;
+typedef UINT32 TCS_KEY_HANDLE;
+typedef UINT32 TCS_HANDLE;
+
+
+// Substitution definitions for TCS-IDL
+typedef TPM_ENCAUTH TCG_ENCAUTH;
+typedef TPM_NONCE TCG_NONCE;
+typedef TPM_ENTITY_TYPE TCG_ENTITY_TYPE;
+typedef TPM_PCRINDEX TCG_PCRINDEX;
+typedef TPM_DIGEST TCG_DIGEST;
+typedef TPM_PCRVALUE TCG_PCRVALUE;
+typedef TPM_DIRVALUE TCG_DIRVALUE;
+typedef TPM_DIRINDEX TCG_DIRINDEX;
+
+
+
+#endif // __TCS_TYPEDEF_H__
+
diff --git a/src/include/tss/tddl_error.h b/src/include/tss/tddl_error.h
new file mode 100644
index 0000000..b63ca11
--- /dev/null
+++ b/src/include/tss/tddl_error.h
@@ -0,0 +1,51 @@
+/*++
+
+TPM Device Driver Library error return codes
+
+--*/
+
+#ifndef __TDDL_ERROR_H__
+#define __TDDL_ERROR_H__
+
+#include <tss/tss_error_basics.h>
+#include <tss/tss_error.h>
+
+
+#ifndef TSS_E_BASE
+#define TSS_E_BASE 0x00000000L
+#endif // TSS_E_BASE
+
+
+//
+// specific error codes returned by the TPM device driver library
+// offset TSS_TDDL_OFFSET
+//
+#define TDDL_E_FAIL TSS_E_FAIL
+#define TDDL_E_TIMEOUT TSS_E_TIMEOUT
+
+// The connection was already established.
+#define TDDL_E_ALREADY_OPENED (UINT32)(TSS_E_BASE + 0x081L)
+
+// The device was not connected.
+#define TDDL_E_ALREADY_CLOSED (UINT32)(TSS_E_BASE + 0x082L)
+
+// The receive buffer is too small.
+#define TDDL_E_INSUFFICIENT_BUFFER (UINT32)(TSS_E_BASE + 0x083L)
+
+// The command has already completed.
+#define TDDL_E_COMMAND_COMPLETED (UINT32)(TSS_E_BASE + 0x084L)
+
+// TPM aborted processing of command.
+#define TDDL_E_COMMAND_ABORTED (UINT32)(TSS_E_BASE + 0x085L)
+
+// The request could not be performed because of an I/O device error.
+#define TDDL_E_IOERROR (UINT32)(TSS_E_BASE + 0x087L)
+
+// Unsupported TAG is requested
+#define TDDL_E_BADTAG (UINT32)(TSS_E_BASE + 0x088L)
+
+// the requested TPM component was not found
+#define TDDL_E_COMPONENT_NOT_FOUND (UINT32)(TSS_E_BASE + 0x089L)
+
+#endif // __TDDL_ERROR_H__
+
diff --git a/src/include/tss/tddlapi_error.h b/src/include/tss/tddlapi_error.h
new file mode 100644
index 0000000..f021150
--- /dev/null
+++ b/src/include/tss/tddlapi_error.h
@@ -0,0 +1,54 @@
+/*++
+
+TDDL error return codes for the TPM Device Driver Library Interface (TDDLI)
+
+--*/
+
+#ifndef __TDDLAPI_ERROR_H__
+#define __TDDLAPI_ERROR_H__
+
+
+//
+// error coding scheme for a Microsoft Windows platform -
+// refer to the TSS Specification Parts
+//
+// Values are 32 bit values layed out as follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-+-----------------------+-------+-----------------------+
+// |Lev|C|R| Facility | Layer | Code |
+// +---+-+-+-----------------------+-------+-----------------------+
+// | Platform specific coding | TSS error coding system |
+// +---+-+-+-----------------------+-------+-----------------------+
+//
+// Lev - is the Level code
+//
+// 00 - Success
+// 01 - Informational
+// 10 - Warning
+// 11 - Error
+//
+// C - is the Customer code flag (must actually be set)
+//
+// R - is a reserved bit (unused)
+//
+// Facility - is the facility code: TCPA: proposal 0x028
+//
+// Code - is the facility's status code
+//
+
+
+// no macros are used below intentionally
+// for a better error code recognition by the reader
+
+// note that the values of TPM_E_BASE and TSS_E_BASE, TSS_W_BASE and TSS_I_BASE
+// have to be adjusted for a platform other than Windows
+
+//
+// TPM specific error codes (layer nibble set to TPM layer TSS_LAYER_TPM)
+//
+
+
+#endif // __TDDLAPI_ERROR_H__
+
diff --git a/src/include/tss/tddli.h b/src/include/tss/tddli.h
new file mode 100644
index 0000000..bfd6045
--- /dev/null
+++ b/src/include/tss/tddli.h
@@ -0,0 +1,94 @@
+/*++
+
+TPM Device Driver Library interface
+
+--*/
+
+#ifndef __TDDLI_H__
+#define __TDDLI_H__
+
+#include <tss/tss_typedef.h>
+#include <tss/tddl_error.h>
+
+#if !defined(TDDLI)
+#ifdef WIN32
+// --- This should be used on Windows platforms
+#ifdef TDDLI_EXPORTS
+#define TDDLI __declspec(dllexport)
+#else
+#define TDDLI __declspec(dllimport)
+#endif
+#else
+#define TDDLI
+#endif
+#endif /* !defined(TDDLI) */
+
+
+#define TDDL_CAP_VERSION 0x0100
+#define TDDL_CAP_VER_DRV 0x0101
+#define TDDL_CAP_VER_FW 0x0102
+#define TDDL_CAP_VER_FW_DATE 0x0103
+
+#define TDDL_CAP_PROPERTY 0x0200
+#define TDDL_CAP_PROP_MANUFACTURER 0x0201
+#define TDDL_CAP_PROP_MODULE_TYPE 0x0202
+#define TDDL_CAP_PROP_GLOBAL_STATE 0x0203
+
+
+//--------------------------------------------------------------------
+// TDDL specific helper redefinitions
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ //establish a connection to the TPM device driver
+ TDDLI TSS_RESULT Tddli_Open(void);
+
+ //close a open connection to the TPM device driver
+ TDDLI TSS_RESULT Tddli_Close(void);
+
+ //cancels the last outstanding TPM command
+ TDDLI TSS_RESULT Tddli_Cancel(void);
+
+ // read the attributes returned by the TPM HW/FW
+ TDDLI TSS_RESULT Tddli_GetCapability(
+ UINT32 CapArea,
+ UINT32 SubCap,
+ BYTE *pCapBuf,
+ UINT32 *puntCapBufLen);
+
+ // set parameters to the TPM HW/FW
+ TDDLI TSS_RESULT Tddli_SetCapability(
+ UINT32 CapArea,
+ UINT32 SubCap,
+ BYTE *pCapBuf,
+ UINT32 puntCapBufLen);
+
+ // get status of the TPM driver and device
+ TDDLI TSS_RESULT Tddli_GetStatus(
+ UINT32 ReqStatusType,
+ UINT32 *puntStatus);
+
+ // send any data to the TPM module
+ TDDLI TSS_RESULT Tddli_TransmitData(
+ BYTE *pTransmitBuf,
+ UINT32 TransmitBufLen,
+ BYTE *pReceiveBuf,
+ UINT32 *puntReceiveBufLen);
+
+ TDDLI TSS_RESULT Tddli_SetPowerManagement(
+ TSS_BOOL SendSaveStateCommand, // in
+ UINT32 *QuerySetNewTPMPowerState); // in, out
+
+ TDDLI TSS_RESULT Tddli_PowerManagementControl(
+ TSS_BOOL SendPowerManager, // in
+ UINT32 *DriverManagesPowerStates); // out
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TDDLI_H__
+
diff --git a/src/include/tss/tpm.h b/src/include/tss/tpm.h
new file mode 100644
index 0000000..a9057f3
--- /dev/null
+++ b/src/include/tss/tpm.h
@@ -0,0 +1,1663 @@
+/*++
+ *
+ * TPM structures extracted from the TPM specification 1.2,
+ * Part 2 (Structures), rev 85.
+ *
+ * Errata:
+ *
+ * *) The individual bits of TPM_STARTUP_EFFECTS were not given names in
+ * the TPM spec so they are not defined in tpm.h.
+ *
+ * *) A few typedefs not present in the TPM 1.2 specification have been
+ * added. This was generally done when the TPM 1.2 spec defined a set of
+ * related values (either bitmasks or enumeration values) but did not
+ * define an associated type to hold these values. The typedefs have been
+ * added and structure fields that were to hold those values have been
+ * switched from generic UINT* types to the more specific types. This was
+ * done to highlight exactly where those #defined values were to be used.
+ * The types that have been added are:
+ * TPM_NV_PER_ATTRIBUTES
+ * TPM_DELEGATE_TYPE
+ *
+ * *) The layout of bitfields within a structure are compiler-dependent
+ * and the use of structure bitfields has been avoided where possible. In
+ * cases where a value is a collection of independent bits the type is
+ * given a name (typedeffed to UINT16 or UINT32 as appropriate) and masks
+ * are #defined to access the individual bits. This is not possible for
+ * TPM_VERSION_BYTE because the fields are 4-bit values. A best attempt
+ * has been made to make this compiler independent but it has only been
+ * checked on GCC and Visual C++ on little-endian machines.
+ *
+ * *) The TPM_DELEGATIONS per1 and per2 fields field are a bitmask but
+ * are defined as a UINT32 because the bitfields have different meaning
+ * based on the type of delegation blob.
+ *
+ * *) The definitions of TPM_PERMANENT_DATA, TPM_STCLEAR_DATA,
+ * TPM_STANY_DATA, and TPM_DELEGATE_TABLE_ROW are commented out. These
+ * structures are internal to the TPM and are not directly accessible by
+ * external software so this should not be a problem.
+ *
+ * *) The definitions of TPM_FAMILY_TABLE and TPM_DELEGATE_TABLE are
+ * commented out because they are variable length arrays internal to the
+ * TPM. As above they are not directly accessible by external software
+ * so this should not be a problem.
+ */
+
+#ifndef __TPM_H__
+#define __TPM_H__
+
+#ifdef __midl
+#define SIZEIS(x) [size_is(x)]
+#else
+#define SIZEIS(x)
+#endif
+
+#include <tss/platform.h>
+
+//-------------------------------------------------------------------
+// Part 2, section 2.1: Basic data types
+typedef BYTE TPM_BOOL;
+#ifndef FALSE
+#define FALSE 0x00
+#define TRUE 0x01
+#endif /* ifndef FALSE */
+
+//-------------------------------------------------------------------
+// Part 2, section 2.3: Helper Redefinitions
+// Many of the helper redefinitions appear later in this file
+// so that they are declared next to the list of valid values
+// they may hold.
+typedef BYTE TPM_LOCALITY_MODIFIER;
+typedef UINT32 TPM_COMMAND_CODE; /* 1.1b */
+typedef UINT32 TPM_COUNT_ID;
+typedef UINT32 TPM_REDIT_COMMAND;
+typedef UINT32 TPM_HANDLE;
+typedef UINT32 TPM_AUTHHANDLE;
+typedef UINT32 TPM_TRANSHANDLE;
+typedef UINT32 TPM_KEYHANDLE;
+typedef UINT32 TPM_DIRINDEX;
+typedef UINT32 TPM_PCRINDEX;
+typedef UINT32 TPM_RESULT;
+typedef UINT32 TPM_MODIFIER_INDICATOR;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 2.2.4: Vendor Specific
+#define TPM_Vendor_Specific32 0x00000400
+#define TPM_Vendor_Specific8 0x80
+
+
+//-------------------------------------------------------------------
+// Part 2, section 3: Structure Tags
+typedef UINT16 TPM_STRUCTURE_TAG;
+#define TPM_TAG_CONTEXTBLOB ((UINT16)0x0001)
+#define TPM_TAG_CONTEXT_SENSITIVE ((UINT16)0x0002)
+#define TPM_TAG_CONTEXTPOINTER ((UINT16)0x0003)
+#define TPM_TAG_CONTEXTLIST ((UINT16)0x0004)
+#define TPM_TAG_SIGNINFO ((UINT16)0x0005)
+#define TPM_TAG_PCR_INFO_LONG ((UINT16)0x0006)
+#define TPM_TAG_PERSISTENT_FLAGS ((UINT16)0x0007)
+#define TPM_TAG_VOLATILE_FLAGS ((UINT16)0x0008)
+#define TPM_TAG_PERSISTENT_DATA ((UINT16)0x0009)
+#define TPM_TAG_VOLATILE_DATA ((UINT16)0x000a)
+#define TPM_TAG_SV_DATA ((UINT16)0x000b)
+#define TPM_TAG_EK_BLOB ((UINT16)0x000c)
+#define TPM_TAG_EK_BLOB_AUTH ((UINT16)0x000d)
+#define TPM_TAG_COUNTER_VALUE ((UINT16)0x000e)
+#define TPM_TAG_TRANSPORT_INTERNAL ((UINT16)0x000f)
+#define TPM_TAG_TRANSPORT_LOG_IN ((UINT16)0x0010)
+#define TPM_TAG_TRANSPORT_LOG_OUT ((UINT16)0x0011)
+#define TPM_TAG_AUDIT_EVENT_IN ((UINT16)0x0012)
+#define TPM_TAG_AUDIT_EVENT_OUT ((UINT16)0x0013)
+#define TPM_TAG_CURRENT_TICKS ((UINT16)0x0014)
+#define TPM_TAG_KEY ((UINT16)0x0015)
+#define TPM_TAG_STORED_DATA12 ((UINT16)0x0016)
+#define TPM_TAG_NV_ATTRIBUTES ((UINT16)0x0017)
+#define TPM_TAG_NV_DATA_PUBLIC ((UINT16)0x0018)
+#define TPM_TAG_NV_DATA_SENSITIVE ((UINT16)0x0019)
+#define TPM_TAG_DELEGATIONS ((UINT16)0x001a)
+#define TPM_TAG_DELEGATE_PUBLIC ((UINT16)0x001b)
+#define TPM_TAG_DELEGATE_TABLE_ROW ((UINT16)0x001c)
+#define TPM_TAG_TRANSPORT_AUTH ((UINT16)0x001d)
+#define TPM_TAG_TRANSPORT_PUBLIC ((UINT16)0x001e)
+#define TPM_TAG_PERMANENT_FLAGS ((UINT16)0x001f)
+#define TPM_TAG_STCLEAR_FLAGS ((UINT16)0x0020)
+#define TPM_TAG_STANY_FLAGS ((UINT16)0x0021)
+#define TPM_TAG_PERMANENT_DATA ((UINT16)0x0022)
+#define TPM_TAG_STCLEAR_DATA ((UINT16)0x0023)
+#define TPM_TAG_STANY_DATA ((UINT16)0x0024)
+#define TPM_TAG_FAMILY_TABLE_ENTRY ((UINT16)0x0025)
+#define TPM_TAG_DELEGATE_SENSITIVE ((UINT16)0x0026)
+#define TPM_TAG_DELG_KEY_BLOB ((UINT16)0x0027)
+#define TPM_TAG_KEY12 ((UINT16)0x0028)
+#define TPM_TAG_CERTIFY_INFO2 ((UINT16)0x0029)
+#define TPM_TAG_DELEGATE_OWNER_BLOB ((UINT16)0x002a)
+#define TPM_TAG_EK_BLOB_ACTIVATE ((UINT16)0x002b)
+#define TPM_TAG_DAA_BLOB ((UINT16)0x002c)
+#define TPM_TAG_DAA_CONTEXT ((UINT16)0x002d)
+#define TPM_TAG_DAA_ENFORCE ((UINT16)0x002e)
+#define TPM_TAG_DAA_ISSUER ((UINT16)0x002f)
+#define TPM_TAG_CAP_VERSION_INFO ((UINT16)0x0030)
+#define TPM_TAG_DAA_SENSITIVE ((UINT16)0x0031)
+#define TPM_TAG_DAA_TPM ((UINT16)0x0032)
+#define TPM_TAG_CMK_MIGAUTH ((UINT16)0x0033)
+#define TPM_TAG_CMK_SIGTICKET ((UINT16)0x0034)
+#define TPM_TAG_CMK_MA_APPROVAL ((UINT16)0x0035)
+#define TPM_TAG_QUOTE_INFO2 ((UINT16)0x0036)
+#define TPM_TAG_DA_INFO ((UINT16)0x0037)
+#define TPM_TAG_DA_INFO_LIMITED ((UINT16)0x0038)
+#define TPM_TAG_DA_ACTION_TYPE ((UINT16)0x0039)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 4: Types
+typedef UINT32 TPM_RESOURCE_TYPE;
+#define TPM_RT_KEY ((UINT32)0x00000001)
+#define TPM_RT_AUTH ((UINT32)0x00000002)
+#define TPM_RT_HASH ((UINT32)0x00000003)
+#define TPM_RT_TRANS ((UINT32)0x00000004)
+#define TPM_RT_CONTEXT ((UINT32)0x00000005)
+#define TPM_RT_COUNTER ((UINT32)0x00000006)
+#define TPM_RT_DELEGATE ((UINT32)0x00000007)
+#define TPM_RT_DAA_TPM ((UINT32)0x00000008)
+#define TPM_RT_DAA_V0 ((UINT32)0x00000009)
+#define TPM_RT_DAA_V1 ((UINT32)0x0000000a)
+
+
+typedef BYTE TPM_PAYLOAD_TYPE; /* 1.1b */
+#define TPM_PT_ASYM ((BYTE)0x01) /* 1.1b */
+#define TPM_PT_BIND ((BYTE)0x02) /* 1.1b */
+#define TPM_PT_MIGRATE ((BYTE)0x03) /* 1.1b */
+#define TPM_PT_MAINT ((BYTE)0x04) /* 1.1b */
+#define TPM_PT_SEAL ((BYTE)0x05) /* 1.1b */
+#define TPM_PT_MIGRATE_RESTRICTED ((BYTE)0x06)
+#define TPM_PT_MIGRATE_EXTERNAL ((BYTE)0x07)
+#define TPM_PT_CMK_MIGRATE ((BYTE)0x08)
+
+
+typedef UINT16 TPM_ENTITY_TYPE; /* 1.1b */
+#define TPM_ET_KEYHANDLE ((UINT16)0x0001) /* 1.1b */
+#define TPM_ET_OWNER ((UINT16)0x0002) /* 1.1b */
+#define TPM_ET_DATA ((UINT16)0x0003) /* 1.1b */
+#define TPM_ET_SRK ((UINT16)0x0004) /* 1.1b */
+#define TPM_ET_KEY ((UINT16)0x0005) /* 1.1b */
+#define TPM_ET_REVOKE ((UINT16)0x0006)
+#define TPM_ET_DEL_OWNER_BLOB ((UINT16)0x0007)
+#define TPM_ET_DEL_ROW ((UINT16)0x0008)
+#define TPM_ET_DEL_KEY_BLOB ((UINT16)0x0009)
+#define TPM_ET_COUNTER ((UINT16)0x000a)
+#define TPM_ET_NV ((UINT16)0x000b)
+#define TPM_ET_OPERATOR ((UINT16)0x000c)
+#define TPM_ET_RESERVED_HANDLE ((UINT16)0x0040)
+
+/* The following values may be ORed into the MSB of the TPM_ENTITY_TYPE
+ * to indicate particular encryption scheme
+ */
+#define TPM_ET_XOR ((BYTE)0x00)
+#define TPM_ET_AES ((BYTE)0x06)
+
+typedef UINT32 TPM_KEY_HANDLE; /* 1.1b */
+#define TPM_KH_SRK ((UINT32)0x40000000)
+#define TPM_KH_OWNER ((UINT32)0x40000001)
+#define TPM_KH_REVOKE ((UINT32)0x40000002)
+#define TPM_KH_TRANSPORT ((UINT32)0x40000003)
+#define TPM_KH_OPERATOR ((UINT32)0x40000004)
+#define TPM_KH_ADMIN ((UINT32)0x40000005)
+#define TPM_KH_EK ((UINT32)0x40000006)
+/* 1.1b used different names, but the same values */
+#define TPM_KEYHND_SRK (TPM_KH_SRK) /* 1.1b */
+#define TPM_KEYHND_OWNER (TPM_KH_OWNER) /* 1.1b */
+
+
+typedef UINT16 TPM_STARTUP_TYPE; /* 1.1b */
+#define TPM_ST_CLEAR ((UINT16)0x0001) /* 1.1b */
+#define TPM_ST_STATE ((UINT16)0x0002) /* 1.1b */
+#define TPM_ST_DEACTIVATED ((UINT16)0x0003) /* 1.1b */
+
+
+//typedef UINT32 TPM_STARTUP_EFFECTS;
+// 32-bit mask, see spec for meaning. Names not currently defined.
+// bits 0-8 have meaning
+
+typedef UINT16 TPM_PROTOCOL_ID; /* 1.1b */
+#define TPM_PID_OIAP ((UINT16)0x0001) /* 1.1b */
+#define TPM_PID_OSAP ((UINT16)0x0002) /* 1.1b */
+#define TPM_PID_ADIP ((UINT16)0x0003) /* 1.1b */
+#define TPM_PID_ADCP ((UINT16)0x0004) /* 1.1b */
+#define TPM_PID_OWNER ((UINT16)0x0005) /* 1.1b */
+#define TPM_PID_DSAP ((UINT16)0x0006)
+#define TPM_PID_TRANSPORT ((UINT16)0x0007)
+
+
+// Note in 1.2 rev 104, DES and 3DES are eliminated
+typedef UINT32 TPM_ALGORITHM_ID; /* 1.1b */
+#define TPM_ALG_RSA ((UINT32)0x00000001) /* 1.1b */
+#define TPM_ALG_DES ((UINT32)0x00000002) /* 1.1b */
+#define TPM_ALG_3DES ((UINT32)0x00000003) /* 1.1b */
+#define TPM_ALG_SHA ((UINT32)0x00000004) /* 1.1b */
+#define TPM_ALG_HMAC ((UINT32)0x00000005) /* 1.1b */
+#define TPM_ALG_AES ((UINT32)0x00000006) /* 1.1b */
+#define TPM_ALG_AES128 (TPM_ALG_AES)
+#define TPM_ALG_MGF1 ((UINT32)0x00000007)
+#define TPM_ALG_AES192 ((UINT32)0x00000008)
+#define TPM_ALG_AES256 ((UINT32)0x00000009)
+#define TPM_ALG_XOR ((UINT32)0x0000000a)
+
+
+typedef UINT16 TPM_PHYSICAL_PRESENCE; /* 1.1b */
+#define TPM_PHYSICAL_PRESENCE_LOCK ((UINT16)0x0004) /* 1.1b */
+#define TPM_PHYSICAL_PRESENCE_PRESENT ((UINT16)0x0008) /* 1.1b */
+#define TPM_PHYSICAL_PRESENCE_NOTPRESENT ((UINT16)0x0010) /* 1.1b */
+#define TPM_PHYSICAL_PRESENCE_CMD_ENABLE ((UINT16)0x0020) /* 1.1b */
+#define TPM_PHYSICAL_PRESENCE_HW_ENABLE ((UINT16)0x0040) /* 1.1b */
+#define TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK ((UINT16)0x0080) /* 1.1b */
+#define TPM_PHYSICAL_PRESENCE_CMD_DISABLE ((UINT16)0x0100)
+#define TPM_PHYSICAL_PRESENCE_HW_DISABLE ((UINT16)0x0200)
+
+
+typedef UINT16 TPM_MIGRATE_SCHEME; /* 1.1b */
+#define TPM_MS_MIGRATE ((UINT16)0x0001) /* 1.1b */
+#define TPM_MS_REWRAP ((UINT16)0x0002) /* 1.1b */
+#define TPM_MS_MAINT ((UINT16)0x0003) /* 1.1b */
+#define TPM_MS_RESTRICT_MIGRATE ((UINT16)0x0004)
+#define TPM_MS_RESTRICT_APPROVE_DOUBLE ((UINT16)0x0005)
+
+
+typedef UINT16 TPM_EK_TYPE;
+#define TPM_EK_TYPE_ACTIVATE ((UINT16)0x0001)
+#define TPM_EK_TYPE_AUTH ((UINT16)0x0002)
+
+
+typedef UINT16 TPM_PLATFORM_SPECIFIC;
+#define TPM_PS_PC_11 ((UINT16)0x0001)
+#define TPM_PS_PC_12 ((UINT16)0x0002)
+#define TPM_PS_PDA_12 ((UINT16)0x0003)
+#define TPM_PS_Server_12 ((UINT16)0x0004)
+#define TPM_PS_Mobile_12 ((UINT16)0x0005)
+
+//-------------------------------------------------------------------
+// Part 2, section 5: Basic Structures
+
+typedef struct tdTPM_STRUCT_VER
+{
+ BYTE major;
+ BYTE minor;
+ BYTE revMajor;
+ BYTE revMinor;
+} TPM_STRUCT_VER;
+
+typedef struct tdTPM_VERSION_BYTE
+{
+ // This needs to be made compiler-independent.
+ int leastSigVer : 4; // least significant 4 bits
+ int mostSigVer : 4; // most significant 4 bits
+} TPM_VERSION_BYTE;
+
+typedef struct tdTPM_VERSION
+{
+ BYTE major; // Should really be a TPM_VERSION_BYTE
+ BYTE minor; // Should really be a TPM_VERSION_BYTE
+ BYTE revMajor;
+ BYTE revMinor;
+} TPM_VERSION;
+
+
+// Put this in the right place:
+// byte size definition for 160 bit SHA1 hash value
+#define TPM_SHA1_160_HASH_LEN 0x14
+#define TPM_SHA1BASED_NONCE_LEN TPM_SHA1_160_HASH_LEN
+
+typedef struct tdTPM_DIGEST
+{
+ BYTE digest[TPM_SHA1_160_HASH_LEN];
+} TPM_DIGEST;
+
+typedef TPM_DIGEST TPM_CHOSENID_HASH;
+typedef TPM_DIGEST TPM_COMPOSITE_HASH;
+typedef TPM_DIGEST TPM_DIRVALUE;
+typedef TPM_DIGEST TPM_HMAC;
+typedef TPM_DIGEST TPM_PCRVALUE;
+typedef TPM_DIGEST TPM_AUDITDIGEST;
+
+typedef struct tdTPM_NONCE /* 1.1b */
+{
+ BYTE nonce[TPM_SHA1BASED_NONCE_LEN];
+} TPM_NONCE;
+
+typedef TPM_NONCE TPM_DAA_TPM_SEED;
+typedef TPM_NONCE TPM_DAA_CONTEXT_SEED;
+
+typedef struct tdTPM_AUTHDATA /* 1.1b */
+{
+ BYTE authdata[TPM_SHA1_160_HASH_LEN];
+} TPM_AUTHDATA;
+
+typedef TPM_AUTHDATA TPM_SECRET;
+typedef TPM_AUTHDATA TPM_ENCAUTH;
+
+
+typedef struct tdTPM_KEY_HANDLE_LIST /* 1.1b */
+{
+ UINT16 loaded;
+ SIZEIS(loaded)
+ TPM_KEY_HANDLE *handle;
+} TPM_KEY_HANDLE_LIST;
+
+
+//-------------------------------------------------------------------
+// Part 2, section 5.8: Key usage values
+
+typedef UINT16 TPM_KEY_USAGE; /* 1.1b */
+#define TPM_KEY_SIGNING ((UINT16)0x0010) /* 1.1b */
+#define TPM_KEY_STORAGE ((UINT16)0x0011) /* 1.1b */
+#define TPM_KEY_IDENTITY ((UINT16)0x0012) /* 1.1b */
+#define TPM_KEY_AUTHCHANGE ((UINT16)0x0013) /* 1.1b */
+#define TPM_KEY_BIND ((UINT16)0x0014) /* 1.1b */
+#define TPM_KEY_LEGACY ((UINT16)0x0015) /* 1.1b */
+#define TPM_KEY_MIGRATE ((UINT16)0x0016)
+
+typedef UINT16 TPM_SIG_SCHEME; /* 1.1b */
+#define TPM_SS_NONE ((UINT16)0x0001) /* 1.1b */
+#define TPM_SS_RSASSAPKCS1v15_SHA1 ((UINT16)0x0002) /* 1.1b */
+#define TPM_SS_RSASSAPKCS1v15_DER ((UINT16)0x0003) /* 1.1b */
+#define TPM_SS_RSASSAPKCS1v15_INFO ((UINT16)0x0004)
+
+typedef UINT16 TPM_ENC_SCHEME; /* 1.1b */
+#define TPM_ES_NONE ((UINT16)0x0001) /* 1.1b */
+#define TPM_ES_RSAESPKCSv15 ((UINT16)0x0002) /* 1.1b */
+#define TPM_ES_RSAESOAEP_SHA1_MGF1 ((UINT16)0x0003) /* 1.1b */
+#define TPM_ES_SYM_CNT ((UINT16)0x0004)
+#define TPM_ES_SYM_CTR TPM_ES_SYM_CNT
+#define TPM_ES_SYM_OFB ((UINT16)0x0005)
+#define TPM_ES_SYM_CBC_PKCS5PAD ((UINT16)0x00ff)
+
+//-------------------------------------------------------------------
+// Part 2, section 5.9: TPM_AUTH_DATA_USAGE values
+
+typedef BYTE TPM_AUTH_DATA_USAGE; /* 1.1b */
+#define TPM_AUTH_NEVER ((BYTE)0x00) /* 1.1b */
+#define TPM_AUTH_ALWAYS ((BYTE)0x01) /* 1.1b */
+#define TPM_AUTH_PRIV_USE_ONLY ((BYTE)0x11)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 5.10: TPM_KEY_FLAGS flags
+
+typedef UINT32 TPM_KEY_FLAGS; /* 1.1b */
+#define TPM_REDIRECTION ((UINT32)0x00000001) /* 1.1b */
+#define TPM_MIGRATABLE ((UINT32)0x00000002) /* 1.1b */
+#define TPM_VOLATILE ((UINT32)0x00000004) /* 1.1b */
+#define TPM_PCRIGNOREDONREAD ((UINT32)0x00000008)
+#define TPM_MIGRATEAUTHORITY ((UINT32)0x00000010)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 5.11: TPM_CHANGEAUTH_VALIDATE
+
+typedef struct tdTPM_CHANGEAUTH_VALIDATE
+{
+ TPM_SECRET newAuthSecret;
+ TPM_NONCE n1;
+} TPM_CHANGEAUTH_VALIDATE;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH
+// declared after section 10 to catch declaration of TPM_PUBKEY
+
+//-------------------------------------------------------------------
+// Part 2, section 5.13: TPM_COUNTER_VALUE;
+
+typedef UINT32 TPM_ACTUAL_COUNT;
+typedef struct tdTPM_COUNTER_VALUE
+{
+ TPM_STRUCTURE_TAG tag;
+ BYTE label[4];
+ TPM_ACTUAL_COUNT counter;
+} TPM_COUNTER_VALUE;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.14: TPM_SIGN_INFO structure
+
+typedef struct tdTPM_SIGN_INFO
+{
+ TPM_STRUCTURE_TAG tag;
+ BYTE fixed[4];
+ TPM_NONCE replay;
+ UINT32 dataLen;
+ SIZEIS(dataLen)
+ BYTE *data;
+} TPM_SIGN_INFO;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.15: TPM_MSA_COMPOSITE
+
+typedef struct tdTPM_MSA_COMPOSITE
+{
+ UINT32 MSAlist;
+ SIZEIS(MSAlist)
+ TPM_DIGEST *migAuthDigest;
+} TPM_MSA_COMPOSITE;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.16: TPM_CMK_AUTH
+
+typedef struct tdTPM_CMK_AUTH
+{
+ TPM_DIGEST migrationAuthorityDigest;
+ TPM_DIGEST destinationKeyDigest;
+ TPM_DIGEST sourceKeyDigest;
+} TPM_CMK_AUTH;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.17: TPM_CMK_DELEGATE
+
+typedef UINT32 TPM_CMK_DELEGATE;
+#define TPM_CMK_DELEGATE_SIGNING (((UINT32)1)<<31)
+#define TPM_CMK_DELEGATE_STORAGE (((UINT32)1)<<30)
+#define TPM_CMK_DELEGATE_BIND (((UINT32)1)<<29)
+#define TPM_CMK_DELEGATE_LEGACY (((UINT32)1)<<28)
+#define TPM_CMK_DELEGATE_MIGRATE (((UINT32)1)<<27)
+
+//-------------------------------------------------------------------
+// Part 2, section 5.18: TPM_SELECT_SIZE
+
+typedef struct tdTPM_SELECT_SIZE
+{
+ BYTE major;
+ BYTE minor;
+ UINT16 reqSize;
+} TPM_SELECT_SIZE;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.19: TPM_CMK_MIGAUTH
+
+typedef struct tdTPM_CMK_MIGAUTH
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST msaDigest;
+ TPM_DIGEST pubKeyDigest;
+} TPM_CMK_MIGAUTH;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.20: TPM_CMK_SIGTICKET
+
+typedef struct tdTPM_CMK_SIGTICKET
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST verKeyDigest;
+ TPM_DIGEST signedData;
+} TPM_CMK_SIGTICKET;
+
+//-------------------------------------------------------------------
+// Part 2, section 5.21: TPM_CMK_MA_APPROVAL
+
+typedef struct tdTPM_CMK_MA_APPROVAL
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST migrationAuthorityDigest;
+} TPM_CMK_MA_APPROVAL;
+
+
+//-------------------------------------------------------------------
+// Part 2, section 6: Command Tags
+
+typedef UINT16 TPM_TAG; /* 1.1b */
+#define TPM_TAG_RQU_COMMAND ((UINT16)0x00c1)
+#define TPM_TAG_RQU_AUTH1_COMMAND ((UINT16)0x00c2)
+#define TPM_TAG_RQU_AUTH2_COMMAND ((UINT16)0x00c3)
+#define TPM_TAG_RSP_COMMAND ((UINT16)0x00c4)
+#define TPM_TAG_RSP_AUTH1_COMMAND ((UINT16)0x00c5)
+#define TPM_TAG_RSP_AUTH2_COMMAND ((UINT16)0x00c6)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 7.1: TPM_PERMANENT_FLAGS
+
+typedef struct tdTPM_PERMANENT_FLAGS
+{
+ TPM_STRUCTURE_TAG tag;
+ TSS_BOOL disable;
+ TSS_BOOL ownership;
+ TSS_BOOL deactivated;
+ TSS_BOOL readPubek;
+ TSS_BOOL disableOwnerClear;
+ TSS_BOOL allowMaintenance;
+ TSS_BOOL physicalPresenceLifetimeLock;
+ TSS_BOOL physicalPresenceHWEnable;
+ TSS_BOOL physicalPresenceCMDEnable;
+ TSS_BOOL CEKPUsed;
+ TSS_BOOL TPMpost;
+ TSS_BOOL TPMpostLock;
+ TSS_BOOL FIPS;
+ TSS_BOOL Operator;
+ TSS_BOOL enableRevokeEK;
+ TSS_BOOL nvLocked;
+ TSS_BOOL readSRKPub;
+ TSS_BOOL tpmEstablished;
+ TSS_BOOL maintenanceDone;
+ TSS_BOOL disableFullDALogicInfo;
+} TPM_PERMANENT_FLAGS;
+
+#define TPM_PF_DISABLE ((UINT32)0x00000001)
+#define TPM_PF_OWNERSHIP ((UINT32)0x00000002)
+#define TPM_PF_DEACTIVATED ((UINT32)0x00000003)
+#define TPM_PF_READPUBEK ((UINT32)0x00000004)
+#define TPM_PF_DISABLEOWNERCLEAR ((UINT32)0x00000005)
+#define TPM_PF_ALLOWMAINTENANCE ((UINT32)0x00000006)
+#define TPM_PF_PHYSICALPRESENCELIFETIMELOCK ((UINT32)0x00000007)
+#define TPM_PF_PHYSICALPRESENCEHWENABLE ((UINT32)0x00000008)
+#define TPM_PF_PHYSICALPRESENCECMDENABLE ((UINT32)0x00000009)
+#define TPM_PF_CEKPUSED ((UINT32)0x0000000A)
+#define TPM_PF_TPMPOST ((UINT32)0x0000000B)
+#define TPM_PF_TPMPOSTLOCK ((UINT32)0x0000000C)
+#define TPM_PF_FIPS ((UINT32)0x0000000D)
+#define TPM_PF_OPERATOR ((UINT32)0x0000000E)
+#define TPM_PF_ENABLEREVOKEEK ((UINT32)0x0000000F)
+#define TPM_PF_NV_LOCKED ((UINT32)0x00000010)
+#define TPM_PF_READSRKPUB ((UINT32)0x00000011)
+#define TPM_PF_RESETESTABLISHMENTBIT ((UINT32)0x00000012)
+#define TPM_PF_MAINTENANCEDONE ((UINT32)0x00000013)
+#define TPM_PF_DISABLEFULLDALOGICINFO ((UINT32)0x00000014)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 7.2: TPM_STCLEAR_FLAGS
+
+typedef struct tdTPM_STCLEAR_FLAGS
+{
+ TPM_STRUCTURE_TAG tag;
+ TSS_BOOL deactivated;
+ TSS_BOOL disableForceClear;
+ TSS_BOOL physicalPresence;
+ TSS_BOOL physicalPresenceLock;
+ TSS_BOOL bGlobalLock;
+} TPM_STCLEAR_FLAGS;
+
+#define TPM_SF_DEACTIVATED ((UINT32)0x00000001)
+#define TPM_SF_DISABLEFORCECLEAR ((UINT32)0x00000002)
+#define TPM_SF_PHYSICALPRESENCE ((UINT32)0x00000003)
+#define TPM_SF_PHYSICALPRESENCELOCK ((UINT32)0x00000004)
+#define TPM_SF_GLOBALLOCK ((UINT32)0x00000005)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 7.3: TPM_STANY_FLAGS
+
+typedef struct tdTPM_STANY_FLAGS
+{
+ TPM_STRUCTURE_TAG tag;
+ TSS_BOOL postInitialise;
+ TPM_MODIFIER_INDICATOR localityModifier;
+ TSS_BOOL transportExclusive;
+ TSS_BOOL TOSPresent;
+} TPM_STANY_FLAGS;
+
+#define TPM_AF_POSTINITIALIZE ((UINT32)0x00000001)
+#define TPM_AF_LOCALITYMODIFIER ((UINT32)0x00000002)
+#define TPM_AF_TRANSPORTEXCLUSIVE ((UINT32)0x00000003)
+#define TPM_AF_TOSPRESENT ((UINT32)0x00000004)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 7.4: TPM_PERMANENT_DATA
+// available inside TPM only
+//
+//#define TPM_MIN_COUNTERS 4
+//#define TPM_NUM_PCR 16
+//#define TPM_MAX_NV_WRITE_NOOWNER 64
+//
+//typedef struct tdTPM_PERMANENT_DATA
+//{
+// TPM_STRUCTURE_TAG tag;
+// BYTE revMajor;
+// BYTE revMinor;
+// TPM_NONCE tpmProof;
+// TPM_NONCE ekReset;
+// TPM_SECRET ownerAuth;
+// TPM_SECRET operatorAuth;
+// TPM_DIRVALUE authDIR[1];
+// TPM_PUBKEY manuMaintPub;
+// TPM_KEY endorsementKey;
+// TPM_KEY srk;
+// TPM_KEY contextKey;
+// TPM_KEY delegateKey;
+// TPM_COUNTER_VALUE auditMonotonicCounter;
+// TPM_COUNTER_VALUE monitonicCounter[TPM_MIN_COUNTERS];
+// TPM_PCR_ATTRIBUTES pcrAttrib[TPM_NUM_PCR];
+// BYTE ordinalAuditStatus[];
+// BYTE *rngState;
+// TPM_FAMILY_TABLE familyTable;
+// TPM_DELEGATE_TABLE delegateTable;
+// UINT32 maxNVBufSize;
+// UINT32 lastFamilyID;
+// UINT32 noOwnerNVWrite;
+// TPM_CMK_DELEGATE restrictDelegate;
+// TPM_DAA_TPM_SEED tpmDAASeed;
+// TPM_NONCE daaProof;
+// TPM_NONCE daaBlobKey;
+//} TPM_PERMANENT_DATA;
+
+
+//-------------------------------------------------------------------
+// Part 2, section 7.5: TPM_STCLEAR_DATA
+// available inside TPM only
+//
+//typedef struct tdTPM_STCLEAR_DATA
+//{
+// TPM_STRUCTURE_TAG tag;
+// TPM_NONCE contextNonceKey;
+// TPM_COUNT_ID countID;
+// UINT32 ownerReference;
+// TPM_BOOL disableResetLock;
+// TPM_PCRVALUE PCR[TPM_NUM_PCR];
+// UINT32 deferredPhysicalPresence;
+//} TPM_STCLEAR_DATA;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 7.5: TPM_STANY_DATA
+// available inside TPM only
+//
+//typedef struct tdTPM_STANY_DATA
+//{
+// TPM_STRUCTURE_TAG tag;
+// TPM_NONCE contextNonceSession;
+// TPM_DIGEST auditDigest;
+// TPM_CURRENT_TICKS currentTicks;
+// UINT32 contextCount;
+// UINT32 contextList[TPM_MIN_SESSION_LIST];
+// TPM_SESSION_DATA sessions[TPM_MIN_SESSIONS];
+// // The following appear in section 22.6 but not in 7.5
+// TPM_DAA_ISSUER DAA_issuerSettings;
+// TPM_DAA_TPM DAA_tpmSpecific;
+// TPM_DAA_CONTEXT DAA_session;
+// TPM_DAA_JOINDATA DAA_joinSession;
+//} TPM_STANY_DATA;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 8: PCR Structures
+
+typedef BYTE TPM_LOCALITY_SELECTION;
+#define TPM_LOC_FOUR (((UINT32)1)<<4)
+#define TPM_LOC_THREE (((UINT32)1)<<3)
+#define TPM_LOC_TWO (((UINT32)1)<<2)
+#define TPM_LOC_ONE (((UINT32)1)<<1)
+#define TPM_LOC_ZERO (((UINT32)1)<<0)
+
+typedef struct tdTPM_PCR_SELECTION /* 1.1b */
+{
+ UINT16 sizeOfSelect;
+ SIZEIS(sizeOfSelect)
+ BYTE *pcrSelect;
+} TPM_PCR_SELECTION;
+
+typedef struct tdTPM_PCR_COMPOSITE /* 1.1b */
+{
+ TPM_PCR_SELECTION select;
+ UINT32 valueSize;
+ SIZEIS(valueSize)
+ TPM_PCRVALUE *pcrValue;
+} TPM_PCR_COMPOSITE;
+
+typedef struct tdTPM_PCR_INFO /* 1.1b */
+{
+ TPM_PCR_SELECTION pcrSelection;
+ TPM_COMPOSITE_HASH digestAtRelease;
+ TPM_COMPOSITE_HASH digestAtCreation;
+} TPM_PCR_INFO;
+
+typedef struct tdTPM_PCR_INFO_LONG
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_LOCALITY_SELECTION localityAtCreation;
+ TPM_LOCALITY_SELECTION localityAtRelease;
+ TPM_PCR_SELECTION creationPCRSelection;
+ TPM_PCR_SELECTION releasePCRSelection;
+ TPM_COMPOSITE_HASH digestAtCreation;
+ TPM_COMPOSITE_HASH digestAtRelease;
+} TPM_PCR_INFO_LONG;
+
+typedef struct tdTPM_PCR_INFO_SHORT
+{
+ TPM_PCR_SELECTION pcrSelection;
+ TPM_LOCALITY_SELECTION localityAtRelease;
+ TPM_COMPOSITE_HASH digestAtRelease;
+} TPM_PCR_INFO_SHORT;
+
+typedef struct tdTPM_PCR_ATTRIBUTES
+{
+ BYTE pcrReset;
+ TPM_LOCALITY_SELECTION pcrExtendLocal;
+ TPM_LOCALITY_SELECTION pcrResetLocal;
+} TPM_PCR_ATTRIBUTES;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 9:
+
+typedef struct tdTPM_STORED_DATA /* 1.1b */
+{
+ TPM_STRUCT_VER ver;
+ UINT32 sealInfoSize;
+ SIZEIS(sealInfoSize)
+ BYTE *sealInfo;
+ UINT32 encDataSize;
+ SIZEIS(encDataSize)
+ BYTE *encData;
+} TPM_STORED_DATA;
+
+typedef struct tdTPM_STORED_DATA12
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_ENTITY_TYPE et;
+ UINT32 sealInfoSize;
+ SIZEIS(sealInfoSize)
+ BYTE *sealInfo;
+ UINT32 encDataSize;
+ SIZEIS(encDataSize)
+ BYTE *encData;
+} TPM_STORED_DATA12;
+
+typedef struct tdTPM_SEALED_DATA /* 1.1b */
+{
+ TPM_PAYLOAD_TYPE payload;
+ TPM_SECRET authData;
+ TPM_NONCE tpmProof;
+ TPM_DIGEST storedDigest;
+ UINT32 dataSize;
+ SIZEIS(dataSize)
+ BYTE *data;
+} TPM_SEALED_DATA;
+
+typedef struct tdTPM_SYMMETRIC_KEY /* 1.1b */
+{
+ TPM_ALGORITHM_ID algId;
+ TPM_ENC_SCHEME encScheme;
+ UINT16 size;
+ SIZEIS(size)
+ BYTE *data;
+} TPM_SYMMETRIC_KEY;
+
+typedef struct tdTPM_BOUND_DATA
+{
+ TPM_STRUCT_VER ver;
+ TPM_PAYLOAD_TYPE payload;
+ BYTE *payloadData; // length is implied
+} TPM_BOUND_DATA;
+
+
+//-------------------------------------------------------------------
+// Part 2, section 10: TPM_KEY complex
+
+typedef struct tdTPM_KEY_PARMS /* 1.1b */
+{
+ TPM_ALGORITHM_ID algorithmID;
+ TPM_ENC_SCHEME encScheme;
+ TPM_SIG_SCHEME sigScheme;
+ UINT32 parmSize;
+ SIZEIS(parmSize)
+ BYTE *parms;
+} TPM_KEY_PARMS;
+
+typedef struct tdTPM_RSA_KEY_PARMS /* 1.1b */
+{
+ UINT32 keyLength;
+ UINT32 numPrimes;
+ UINT32 exponentSize;
+ SIZEIS(exponentSize)
+ BYTE *exponent;
+} TPM_RSA_KEY_PARMS;
+
+typedef struct tdTPM_SYMMETRIC_KEY_PARMS
+{
+ UINT32 keyLength;
+ UINT32 blockSize;
+ UINT32 ivSize;
+ SIZEIS(ivSize)
+ BYTE *IV;
+} TPM_SYMMETRIC_KEY_PARMS;
+
+typedef struct tdTPM_STORE_PUBKEY /* 1.1b */
+{
+ UINT32 keyLength;
+ SIZEIS(keyLength)
+ BYTE *key;
+} TPM_STORE_PUBKEY;
+
+typedef struct tdTPM_PUBKEY /* 1.1b */
+{
+ TPM_KEY_PARMS algorithmParms;
+ TPM_STORE_PUBKEY pubKey;
+} TPM_PUBKEY;
+
+typedef struct tdTPM_STORE_PRIVKEY /* 1.1b */
+{
+ UINT32 keyLength;
+ SIZEIS(keyLength)
+ BYTE *key;
+} TPM_STORE_PRIVKEY;
+
+typedef struct tdTPM_STORE_ASYMKEY /* 1.1b */
+{
+ TPM_PAYLOAD_TYPE payload;
+ TPM_SECRET usageAuth;
+ TPM_SECRET migrationAuth;
+ TPM_DIGEST pubDataDigest;
+ TPM_STORE_PRIVKEY privKey;
+} TPM_STORE_ASYMKEY;
+
+typedef struct tdTPM_KEY /* 1.1b */
+{
+ TPM_STRUCT_VER ver;
+ TPM_KEY_USAGE keyUsage;
+ TPM_KEY_FLAGS keyFlags;
+ TPM_AUTH_DATA_USAGE authDataUsage;
+ TPM_KEY_PARMS algorithmParms;
+ UINT32 PCRInfoSize;
+ SIZEIS(PCRInfoSize)
+ BYTE *PCRInfo;
+ TPM_STORE_PUBKEY pubKey;
+ UINT32 encSize;
+ SIZEIS(encSize)
+ BYTE *encData;
+} TPM_KEY;
+
+typedef struct tdTPM_KEY12
+{
+ TPM_STRUCTURE_TAG tag;
+ UINT16 fill;
+ TPM_KEY_USAGE keyUsage;
+ TPM_KEY_FLAGS keyFlags;
+ TPM_AUTH_DATA_USAGE authDataUsage;
+ TPM_KEY_PARMS algorithmParms;
+ UINT32 PCRInfoSize;
+ SIZEIS(PCRInfoSize)
+ BYTE *PCRInfo;
+ TPM_STORE_PUBKEY pubKey;
+ UINT32 encSize;
+ SIZEIS(encSize)
+ BYTE *encData;
+} TPM_KEY12;
+
+typedef struct tdTPM_MIGRATE_ASYMKEY
+{
+ TPM_PAYLOAD_TYPE payload;
+ TPM_SECRET usageAuth;
+ TPM_DIGEST pubDataDigest;
+ UINT32 partPrivKeyLen;
+ SIZEIS(partPrivKeyLen)
+ BYTE *partPrivKey;
+} TPM_MIGRATE_ASYMKEY;
+
+
+typedef UINT32 TPM_KEY_CONTROL;
+#define TPM_KEY_CONTROL_OWNER_EVICT ((UINT32)0x00000001)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH
+
+typedef struct tdTPM_MIGRATIONKEYAUTH /* 1.1b */
+{
+ TPM_PUBKEY migrationKey;
+ TPM_MIGRATE_SCHEME migrationScheme;
+ TPM_DIGEST digest;
+} TPM_MIGRATIONKEYAUTH;
+
+
+//-------------------------------------------------------------------
+// Part 2, section 11: Signed Structures
+
+typedef struct tdTPM_CERTIFY_INFO /* 1.1b */
+{
+ TPM_STRUCT_VER version;
+ TPM_KEY_USAGE keyUsage;
+ TPM_KEY_FLAGS keyFlags;
+ TPM_AUTH_DATA_USAGE authDataUsage;
+ TPM_KEY_PARMS algorithmParms;
+ TPM_DIGEST pubkeyDigest;
+ TPM_NONCE data;
+ TPM_BOOL parentPCRStatus;
+ UINT32 PCRInfoSize;
+ SIZEIS(PCRInfoSize)
+ BYTE *PCRInfo;
+} TPM_CERTIFY_INFO;
+
+typedef struct tdTPM_CERTIFY_INFO2
+{
+ TPM_STRUCTURE_TAG tag;
+ BYTE fill;
+ TPM_PAYLOAD_TYPE payloadType;
+ TPM_KEY_USAGE keyUsage;
+ TPM_KEY_FLAGS keyFlags;
+ TPM_AUTH_DATA_USAGE authDataUsage;
+ TPM_KEY_PARMS algorithmParms;
+ TPM_DIGEST pubkeyDigest;
+ TPM_NONCE data;
+ TPM_BOOL parentPCRStatus;
+ UINT32 PCRInfoSize;
+ SIZEIS(PCRInfoSize)
+ BYTE *PCRInfo;
+ UINT32 migrationAuthoritySize;
+ SIZEIS(migrationAuthoritySize)
+ BYTE *migrationAuthority;
+} TPM_CERTIFY_INFO2;
+
+typedef struct tdTPM_QUOTE_INFO /* 1.1b */
+{
+ TPM_STRUCT_VER version;
+ BYTE fixed[4];
+ TPM_COMPOSITE_HASH compositeHash; /* in 1.2 TPM spec, named digestValue */
+ TPM_NONCE externalData;
+} TPM_QUOTE_INFO;
+
+typedef struct tdTPM_QUOTE_INFO2
+{
+ TPM_STRUCTURE_TAG tag;
+ BYTE fixed[4];
+ TPM_NONCE externalData;
+ TPM_PCR_INFO_SHORT infoShort;
+} TPM_QUOTE_INFO2;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 12: Identity Structures
+
+
+typedef struct tdTPM_EK_BLOB
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_EK_TYPE ekType;
+ UINT32 blobSize;
+ SIZEIS(blobSize)
+ BYTE *blob;
+} TPM_EK_BLOB;
+
+typedef struct tdTPM_EK_BLOB_ACTIVATE
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_SYMMETRIC_KEY sessionKey;
+ TPM_DIGEST idDigest;
+ TPM_PCR_INFO_SHORT pcrInfo;
+} TPM_EK_BLOB_ACTIVATE;
+
+typedef struct tdTPM_EK_BLOB_AUTH
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_SECRET authValue;
+} TPM_EK_BLOB_AUTH;
+
+
+typedef struct tdTPM_IDENTITY_CONTENTS
+{
+ TPM_STRUCT_VER ver;
+ UINT32 ordinal;
+ TPM_CHOSENID_HASH labelPrivCADigest;
+ TPM_PUBKEY identityPubKey;
+} TPM_IDENTITY_CONTENTS;
+
+typedef struct tdTPM_IDENTITY_REQ /* 1.1b */
+{
+ UINT32 asymSize;
+ UINT32 symSize;
+ TPM_KEY_PARMS asymAlgorithm;
+ TPM_KEY_PARMS symAlgorithm;
+ SIZEIS(asymSize)
+ BYTE *asymBlob;
+ SIZEIS(symSize)
+ BYTE *symBlob;
+} TPM_IDENTITY_REQ;
+
+typedef struct tdTPM_IDENTITY_PROOF /* 1.1b */
+{
+ TPM_STRUCT_VER ver;
+ UINT32 labelSize;
+ UINT32 identityBindingSize;
+ UINT32 endorsementSize;
+ UINT32 platformSize;
+ UINT32 conformanceSize;
+ TPM_PUBKEY identityKey;
+ SIZEIS(labelSize)
+ BYTE *labelArea;
+ SIZEIS(identityBindingSize)
+ BYTE *identityBinding;
+ SIZEIS(endorsementSize)
+ BYTE *endorsementCredential;
+ SIZEIS(platformSize)
+ BYTE *platformCredential;
+ SIZEIS(conformanceSize)
+ BYTE *conformanceCredential;
+} TPM_IDENTITY_PROOF;
+
+typedef struct tdTPM_ASYM_CA_CONTENTS /* 1.1b */
+{
+ TPM_SYMMETRIC_KEY sessionKey;
+ TPM_DIGEST idDigest;
+} TPM_ASYM_CA_CONTENTS;
+
+typedef struct tdTPM_SYM_CA_ATTESTATION
+{
+ UINT32 credSize;
+ TPM_KEY_PARMS algorithm;
+ SIZEIS(credSize)
+ BYTE *credential;
+} TPM_SYM_CA_ATTESTATION;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 15: Tick Structures
+// Placed here out of order because definitions are used in section 13.
+
+typedef struct tdTPM_CURRENT_TICKS
+{
+ TPM_STRUCTURE_TAG tag;
+ UINT64 currentTicks;
+ UINT16 tickRate;
+ TPM_NONCE tickNonce;
+} TPM_CURRENT_TICKS;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 13: Transport structures
+
+typedef UINT32 TPM_TRANSPORT_ATTRIBUTES;
+#define TPM_TRANSPORT_ENCRYPT ((UINT32)0x00000001)
+#define TPM_TRANSPORT_LOG ((UINT32)0x00000002)
+#define TPM_TRANSPORT_EXCLUSIVE ((UINT32)0x00000004)
+
+typedef struct tdTPM_TRANSPORT_PUBLIC
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_TRANSPORT_ATTRIBUTES transAttributes;
+ TPM_ALGORITHM_ID algId;
+ TPM_ENC_SCHEME encScheme;
+} TPM_TRANSPORT_PUBLIC;
+
+typedef struct tdTPM_TRANSPORT_INTERNAL
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_AUTHDATA authData;
+ TPM_TRANSPORT_PUBLIC transPublic;
+ TPM_TRANSHANDLE transHandle;
+ TPM_NONCE transNonceEven;
+ TPM_DIGEST transDigest;
+} TPM_TRANSPORT_INTERNAL;
+
+typedef struct tdTPM_TRANSPORT_LOG_IN
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST parameters;
+ TPM_DIGEST pubKeyHash;
+} TPM_TRANSPORT_LOG_IN;
+
+typedef struct tdTPM_TRANSPORT_LOG_OUT
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_CURRENT_TICKS currentTicks;
+ TPM_DIGEST parameters;
+ TPM_MODIFIER_INDICATOR locality;
+} TPM_TRANSPORT_LOG_OUT;
+
+typedef struct tdTPM_TRANSPORT_AUTH
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_AUTHDATA authData;
+} TPM_TRANSPORT_AUTH;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 14: Audit Structures
+
+typedef struct tdTPM_AUDIT_EVENT_IN
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST inputParms;
+ TPM_COUNTER_VALUE auditCount;
+} TPM_AUDIT_EVENT_IN;
+
+typedef struct tdTPM_AUDIT_EVENT_OUT
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_COMMAND_CODE ordinal;
+ TPM_DIGEST outputParms;
+ TPM_COUNTER_VALUE auditCount;
+ TPM_RESULT returnCode;
+} TPM_AUDIT_EVENT_OUT;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 16: Return codes
+
+#include <tss/tpm_error.h>
+
+
+//-------------------------------------------------------------------
+// Part 2, section 17: Ordinals
+
+#include <tss/tpm_ordinal.h>
+
+//-------------------------------------------------------------------
+// Part 2, section 18: Context structures
+
+typedef struct tdTPM_CONTEXT_BLOB
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_RESOURCE_TYPE resourceType;
+ TPM_HANDLE handle;
+ BYTE label[16];
+ UINT32 contextCount;
+ TPM_DIGEST integrityDigest;
+ UINT32 additionalSize;
+ SIZEIS(additionalSize)
+ BYTE *additionalData;
+ UINT32 sensitiveSize;
+ SIZEIS(sensitiveSize)
+ BYTE *sensitiveData;
+} TPM_CONTEXT_BLOB;
+
+typedef struct tdTPM_CONTEXT_SENSITIVE
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_NONCE contextNonce;
+ UINT32 internalSize;
+ SIZEIS(internalSize)
+ BYTE *internalData;
+} TPM_CONTEXT_SENSITIVE;
+
+//-------------------------------------------------------------------
+// Part 2, section 19: NV Structures
+
+typedef UINT32 TPM_NV_INDEX;
+#define TPM_NV_INDEX_LOCK ((UINT32)0xffffffff)
+#define TPM_NV_INDEX0 ((UINT32)0x00000000)
+#define TPM_NV_INDEX_DIR ((UINT32)0x10000001)
+#define TPM_NV_INDEX_EKCert ((UINT32)0x0000f000)
+#define TPM_NV_INDEX_TPM_CC ((UINT32)0x0000f001)
+#define TPM_NV_INDEX_PlatformCert ((UINT32)0x0000f002)
+#define TPM_NV_INDEX_Platform_CC ((UINT32)0x0000f003)
+// The following define ranges of reserved indices.
+#define TPM_NV_INDEX_TSS_BASE ((UINT32)0x00011100)
+#define TPM_NV_INDEX_PC_BASE ((UINT32)0x00011200)
+#define TPM_NV_INDEX_SERVER_BASE ((UINT32)0x00011300)
+#define TPM_NV_INDEX_MOBILE_BASE ((UINT32)0x00011400)
+#define TPM_NV_INDEX_PERIPHERAL_BASE ((UINT32)0x00011500)
+#define TPM_NV_INDEX_GROUP_RESV_BASE ((UINT32)0x00010000)
+
+
+typedef UINT32 TPM_NV_PER_ATTRIBUTES;
+#define TPM_NV_PER_READ_STCLEAR (((UINT32)1)<<31)
+#define TPM_NV_PER_AUTHREAD (((UINT32)1)<<18)
+#define TPM_NV_PER_OWNERREAD (((UINT32)1)<<17)
+#define TPM_NV_PER_PPREAD (((UINT32)1)<<16)
+#define TPM_NV_PER_GLOBALLOCK (((UINT32)1)<<15)
+#define TPM_NV_PER_WRITE_STCLEAR (((UINT32)1)<<14)
+#define TPM_NV_PER_WRITEDEFINE (((UINT32)1)<<13)
+#define TPM_NV_PER_WRITEALL (((UINT32)1)<<12)
+#define TPM_NV_PER_AUTHWRITE (((UINT32)1)<<2)
+#define TPM_NV_PER_OWNERWRITE (((UINT32)1)<<1)
+#define TPM_NV_PER_PPWRITE (((UINT32)1)<<0)
+
+typedef struct tdTPM_NV_ATTRIBUTES
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_NV_PER_ATTRIBUTES attributes;
+} TPM_NV_ATTRIBUTES;
+
+
+typedef struct tdTPM_NV_DATA_PUBLIC
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_NV_INDEX nvIndex;
+ TPM_PCR_INFO_SHORT pcrInfoRead;
+ TPM_PCR_INFO_SHORT pcrInfoWrite;
+ TPM_NV_ATTRIBUTES permission;
+ TPM_BOOL bReadSTClear;
+ TPM_BOOL bWriteSTClear;
+ TPM_BOOL bWriteDefine;
+ UINT32 dataSize;
+} TPM_NV_DATA_PUBLIC;
+
+
+#if 0
+// Internal to TPM:
+typedef struct tdTPM_NV_DATA_SENSITIVE
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_NV_DATA_PUBLIC pubInfo;
+ TPM_AUTHDATA authValue;
+ SIZEIS(pubInfo.dataSize)
+ BYTE *data;
+} TPM_NV_DATA_SENSITIVE;
+#endif
+
+
+//-------------------------------------------------------------------
+// Part 2, section 20: Delegation
+
+//-------------------------------------------------------------------
+// Part 2, section 20.3: Owner Permissions Settings for per1 bits
+#define TPM_DELEGATE_SetOrdinalAuditStatus (((UINT32)1)<<30)
+#define TPM_DELEGATE_DirWriteAuth (((UINT32)1)<<29)
+#define TPM_DELEGATE_CMK_ApproveMA (((UINT32)1)<<28)
+#define TPM_DELEGATE_NV_WriteValue (((UINT32)1)<<27)
+#define TPM_DELEGATE_CMK_CreateTicket (((UINT32)1)<<26)
+#define TPM_DELEGATE_NV_ReadValue (((UINT32)1)<<25)
+#define TPM_DELEGATE_Delegate_LoadOwnerDelegation (((UINT32)1)<<24)
+#define TPM_DELEGATE_DAA_Join (((UINT32)1)<<23)
+#define TPM_DELEGATE_AuthorizeMigrationKey (((UINT32)1)<<22)
+#define TPM_DELEGATE_CreateMaintenanceArchive (((UINT32)1)<<21)
+#define TPM_DELEGATE_LoadMaintenanceArchive (((UINT32)1)<<20)
+#define TPM_DELEGATE_KillMaintenanceFeature (((UINT32)1)<<19)
+#define TPM_DELEGATE_OwnerReadInternalPub (((UINT32)1)<<18)
+#define TPM_DELEGATE_ResetLockValue (((UINT32)1)<<17)
+#define TPM_DELEGATE_OwnerClear (((UINT32)1)<<16)
+#define TPM_DELEGATE_DisableOwnerClear (((UINT32)1)<<15)
+#define TPM_DELEGATE_NV_DefineSpace (((UINT32)1)<<14)
+#define TPM_DELEGATE_OwnerSetDisable (((UINT32)1)<<13)
+#define TPM_DELEGATE_SetCapability (((UINT32)1)<<12)
+#define TPM_DELEGATE_MakeIdentity (((UINT32)1)<<11)
+#define TPM_DELEGATE_ActivateIdentity (((UINT32)1)<<10)
+#define TPM_DELEGATE_OwnerReadPubek (((UINT32)1)<<9)
+#define TPM_DELEGATE_DisablePubekRead (((UINT32)1)<<8)
+#define TPM_DELEGATE_SetRedirection (((UINT32)1)<<7)
+#define TPM_DELEGATE_FieldUpgrade (((UINT32)1)<<6)
+#define TPM_DELEGATE_Delegate_UpdateVerification (((UINT32)1)<<5)
+#define TPM_DELEGATE_CreateCounter (((UINT32)1)<<4)
+#define TPM_DELEGATE_ReleaseCounterOwner (((UINT32)1)<<3)
+#define TPM_DELEGATE_DelegateManage (((UINT32)1)<<2)
+#define TPM_DELEGATE_Delegate_CreateOwnerDelegation (((UINT32)1)<<1)
+#define TPM_DELEGATE_DAA_Sign (((UINT32)1)<<0)
+
+//-------------------------------------------------------------------
+// Part 2, section 20.3: Key Permissions Settings for per1 bits
+#define TPM_KEY_DELEGATE_CMK_ConvertMigration (((UINT32)1)<<28)
+#define TPM_KEY_DELEGATE_TickStampBlob (((UINT32)1)<<27)
+#define TPM_KEY_DELEGATE_ChangeAuthAsymStart (((UINT32)1)<<26)
+#define TPM_KEY_DELEGATE_ChangeAuthAsymFinish (((UINT32)1)<<25)
+#define TPM_KEY_DELEGATE_CMK_CreateKey (((UINT32)1)<<24)
+#define TPM_KEY_DELEGATE_MigrateKey (((UINT32)1)<<23)
+#define TPM_KEY_DELEGATE_LoadKey2 (((UINT32)1)<<22)
+#define TPM_KEY_DELEGATE_EstablishTransport (((UINT32)1)<<21)
+#define TPM_KEY_DELEGATE_ReleaseTransportSigned (((UINT32)1)<<20)
+#define TPM_KEY_DELEGATE_Quote2 (((UINT32)1)<<19)
+#define TPM_KEY_DELEGATE_Sealx (((UINT32)1)<<18)
+#define TPM_KEY_DELEGATE_MakeIdentity (((UINT32)1)<<17)
+#define TPM_KEY_DELEGATE_ActivateIdentity (((UINT32)1)<<16)
+#define TPM_KEY_DELEGATE_GetAuditDigestSigned (((UINT32)1)<<15)
+#define TPM_KEY_DELEGATE_Sign (((UINT32)1)<<14)
+#define TPM_KEY_DELEGATE_CertifyKey2 (((UINT32)1)<<13)
+#define TPM_KEY_DELEGATE_CertifyKey (((UINT32)1)<<12)
+#define TPM_KEY_DELEGATE_CreateWrapKey (((UINT32)1)<<11)
+#define TPM_KEY_DELEGATE_CMK_CreateBlob (((UINT32)1)<<10)
+#define TPM_KEY_DELEGATE_CreateMigrationBlob (((UINT32)1)<<9)
+#define TPM_KEY_DELEGATE_ConvertMigrationBlob (((UINT32)1)<<8)
+#define TPM_KEY_DELEGATE_CreateKeyDelegation (((UINT32)1)<<7)
+#define TPM_KEY_DELEGATE_ChangeAuth (((UINT32)1)<<6)
+#define TPM_KEY_DELEGATE_GetPubKey (((UINT32)1)<<5)
+#define TPM_KEY_DELEGATE_UnBind (((UINT32)1)<<4)
+#define TPM_KEY_DELEGATE_Quote (((UINT32)1)<<3)
+#define TPM_KEY_DELEGATE_Unseal (((UINT32)1)<<2)
+#define TPM_KEY_DELEGATE_Seal (((UINT32)1)<<1)
+#define TPM_KEY_DELEGATE_LoadKey (((UINT32)1)<<0)
+
+typedef UINT32 TPM_FAMILY_VERIFICATION;
+
+typedef UINT32 TPM_FAMILY_ID;
+
+typedef UINT32 TPM_DELEGATE_INDEX;
+
+typedef UINT32 TPM_FAMILY_OPERATION;
+#define TPM_FAMILY_CREATE ((UINT32)0x00000001)
+#define TPM_FAMILY_ENABLE ((UINT32)0x00000002)
+#define TPM_FAMILY_ADMIN ((UINT32)0x00000003)
+#define TPM_FAMILY_INVALIDATE ((UINT32)0x00000004)
+
+typedef UINT32 TPM_FAMILY_FLAGS;
+#define TPM_FAMFLAG_DELEGATE_ADMIN_LOCK (((UINT32)1)<<1)
+#define TPM_FAMFLAG_ENABLE (((UINT32)1)<<0)
+
+typedef struct tdTPM_FAMILY_LABEL
+{
+ BYTE label;
+} TPM_FAMILY_LABEL;
+
+typedef struct tdTPM_FAMILY_TABLE_ENTRY
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_FAMILY_LABEL label;
+ TPM_FAMILY_ID familyID;
+ TPM_FAMILY_VERIFICATION verificationCount;
+ TPM_FAMILY_FLAGS flags;
+} TPM_FAMILY_TABLE_ENTRY;
+
+
+#define TPM_FAMILY_TABLE_ENTRY_MIN 8
+//typedef struct tdTPM_FAMILY_TABLE
+//{
+// TPM_FAMILY_TABLE_ENTRY FamTableRow[TPM_NUM_FAMILY_TABLE_ENTRY_MIN];
+//} TPM_FAMILY_TABLE;
+
+
+typedef struct tdTPM_DELEGATE_LABEL
+{
+ BYTE label;
+} TPM_DELEGATE_LABEL;
+
+
+typedef UINT32 TPM_DELEGATE_TYPE;
+#define TPM_DEL_OWNER_BITS ((UINT32)0x00000001)
+#define TPM_DEL_KEY_BITS ((UINT32)0x00000002)
+
+typedef struct tdTPM_DELEGATIONS
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DELEGATE_TYPE delegateType;
+ UINT32 per1;
+ UINT32 per2;
+} TPM_DELEGATIONS;
+
+typedef struct tdTPM_DELEGATE_PUBLIC
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DELEGATE_LABEL label;
+ TPM_PCR_INFO_SHORT pcrInfo;
+ TPM_DELEGATIONS permissions;
+ TPM_FAMILY_ID familyID;
+ TPM_FAMILY_VERIFICATION verificationCount;
+} TPM_DELEGATE_PUBLIC;
+
+typedef struct tdTPM_DELEGATE_TABLE_ROW
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DELEGATE_PUBLIC pub;
+ TPM_SECRET authValue;
+} TPM_DELEGATE_TABLE_ROW;
+
+
+#define TPM_NUM_DELEGATE_TABLE_ENTRY_MIN 2
+//typedef struct tdTPM_DELEGATE_TABLE
+//{
+// TPM_DELEGATE_TABLE_ROW delRow[TPM_NUM_DELEGATE_TABLE_ENTRY_MIN];
+//} TPM_DELEGATE_TABLE;
+
+typedef struct tdTPM_DELEGATE_SENSITIVE
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_SECRET authValue;
+} TPM_DELEGATE_SENSITIVE;
+
+typedef struct tdTPM_DELEGATE_OWNER_BLOB
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DELEGATE_PUBLIC pub;
+ TPM_DIGEST integrityDigest;
+ UINT32 additionalSize;
+ SIZEIS(additionalSize)
+ BYTE *additionalArea;
+ UINT32 sensitiveSize;
+ SIZEIS(sensitiveSize)
+ BYTE *sensitiveArea;
+} TPM_DELEGATE_OWNER_BLOB;
+
+typedef struct tdTPM_DELEGATE_KEY_BLOB
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DELEGATE_PUBLIC pub;
+ TPM_DIGEST integrityDigest;
+ TPM_DIGEST pubKeyDigest;
+ UINT32 additionalSize;
+ SIZEIS(additionalSize)
+ BYTE *additionalArea;
+ UINT32 sensitiveSize;
+ SIZEIS(sensitiveSize)
+ BYTE *sensitiveArea;
+} TPM_DELEGATE_KEY_BLOB;
+
+
+//-------------------------------------------------------------------
+// Part 2, section 21.1: TPM_CAPABILITY_AREA
+
+typedef UINT32 TPM_CAPABILITY_AREA; /* 1.1b */
+#define TPM_CAP_ORD ((UINT32)0x00000001) /* 1.1b */
+#define TPM_CAP_ALG ((UINT32)0x00000002) /* 1.1b */
+#define TPM_CAP_PID ((UINT32)0x00000003) /* 1.1b */
+#define TPM_CAP_FLAG ((UINT32)0x00000004) /* 1.1b */
+#define TPM_CAP_PROPERTY ((UINT32)0x00000005) /* 1.1b */
+#define TPM_CAP_VERSION ((UINT32)0x00000006) /* 1.1b */
+#define TPM_CAP_KEY_HANDLE ((UINT32)0x00000007) /* 1.1b */
+#define TPM_CAP_CHECK_LOADED ((UINT32)0x00000008) /* 1.1b */
+#define TPM_CAP_SYM_MODE ((UINT32)0x00000009)
+#define TPM_CAP_KEY_STATUS ((UINT32)0x0000000C)
+#define TPM_CAP_NV_LIST ((UINT32)0x0000000D)
+#define TPM_CAP_MFR ((UINT32)0x00000010)
+#define TPM_CAP_NV_INDEX ((UINT32)0x00000011)
+#define TPM_CAP_TRANS_ALG ((UINT32)0x00000012)
+#define TPM_CAP_HANDLE ((UINT32)0x00000014)
+#define TPM_CAP_TRANS_ES ((UINT32)0x00000015)
+#define TPM_CAP_AUTH_ENCRYPT ((UINT32)0x00000017)
+#define TPM_CAP_SELECT_SIZE ((UINT32)0x00000018)
+#define TPM_CAP_DA_LOGIC ((UINT32)0x00000019)
+#define TPM_CAP_VERSION_VAL ((UINT32)0x0000001A)
+
+// Part 2, section 21.1: Subcap values for CAP_FLAG
+#define TPM_CAP_FLAG_PERMANENT ((UINT32)0x00000108)
+#define TPM_CAP_FLAG_VOLATILE ((UINT32)0x00000109)
+
+//-------------------------------------------------------------------
+// Part 2, section 21.2: Subcap values for CAP_PROPERTY
+
+#define TPM_CAP_PROP_PCR ((UINT32)0x00000101) /* 1.1b */
+#define TPM_CAP_PROP_DIR ((UINT32)0x00000102) /* 1.1b */
+#define TPM_CAP_PROP_MANUFACTURER ((UINT32)0x00000103) /* 1.1b */
+#define TPM_CAP_PROP_KEYS ((UINT32)0x00000104)
+#define TPM_CAP_PROP_SLOTS (TPM_CAP_PROP_KEYS)
+#define TPM_CAP_PROP_MIN_COUNTER ((UINT32)0x00000107)
+#define TPM_CAP_PROP_AUTHSESS ((UINT32)0x0000010A)
+#define TPM_CAP_PROP_TRANSSESS ((UINT32)0x0000010B)
+#define TPM_CAP_PROP_COUNTERS ((UINT32)0x0000010C)
+#define TPM_CAP_PROP_MAX_AUTHSESS ((UINT32)0x0000010D)
+#define TPM_CAP_PROP_MAX_TRANSSESS ((UINT32)0x0000010E)
+#define TPM_CAP_PROP_MAX_COUNTERS ((UINT32)0x0000010F)
+#define TPM_CAP_PROP_MAX_KEYS ((UINT32)0x00000110)
+#define TPM_CAP_PROP_OWNER ((UINT32)0x00000111)
+#define TPM_CAP_PROP_CONTEXT ((UINT32)0x00000112)
+#define TPM_CAP_PROP_MAX_CONTEXT ((UINT32)0x00000113)
+#define TPM_CAP_PROP_FAMILYROWS ((UINT32)0x00000114)
+#define TPM_CAP_PROP_TIS_TIMEOUT ((UINT32)0x00000115)
+#define TPM_CAP_PROP_STARTUP_EFFECT ((UINT32)0x00000116)
+#define TPM_CAP_PROP_DELEGATE_ROW ((UINT32)0x00000117)
+#define TPM_CAP_PROP_MAX_DAASESS ((UINT32)0x00000119)
+#define TPM_CAP_PROP_DAA_MAX TPM_CAP_PROP_MAX_DAASESS
+#define TPM_CAP_PROP_DAASESS ((UINT32)0x0000011A)
+#define TPM_CAP_PROP_SESSION_DAA TPM_CAP_PROP_DAASESS
+#define TPM_CAP_PROP_CONTEXT_DIST ((UINT32)0x0000011B)
+#define TPM_CAP_PROP_DAA_INTERRUPT ((UINT32)0x0000011C)
+#define TPM_CAP_PROP_SESSIONS ((UINT32)0x0000011D)
+#define TPM_CAP_PROP_MAX_SESSIONS ((UINT32)0x0000011E)
+#define TPM_CAP_PROP_CMK_RESTRICTION ((UINT32)0x0000011F)
+#define TPM_CAP_PROP_DURATION ((UINT32)0x00000120)
+#define TPM_CAP_PROP_ACTIVE_COUNTER ((UINT32)0x00000122)
+#define TPM_CAP_PROP_NV_AVAILABLE ((UINT32)0x00000123)
+#define TPM_CAP_PROP_INPUT_BUFFER ((UINT32)0x00000124)
+
+
+// Part 2, section 21.4: SetCapability Values
+#define TPM_SET_PERM_FLAGS ((UINT32)0x00000001)
+#define TPM_SET_PERM_DATA ((UINT32)0x00000002)
+#define TPM_SET_STCLEAR_FLAGS ((UINT32)0x00000003)
+#define TPM_SET_STCLEAR_DATA ((UINT32)0x00000004)
+#define TPM_SET_STANY_FLAGS ((UINT32)0x00000005)
+#define TPM_SET_STANY_DATA ((UINT32)0x00000006)
+#define TPM_SET_VENDOR ((UINT32)0x00000007)
+
+
+// Part 2, section 21.6: TPM_CAP_VERSION_INFO
+typedef struct tdTPM_CAP_VERSION_INFO
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_VERSION version;
+ UINT16 specLevel;
+ BYTE errataRev;
+ BYTE tpmVendorID[4];
+ UINT16 vendorSpecificSize;
+ SIZEIS(vendorSpecificSize)
+ BYTE *vendorSpecific;
+} TPM_CAP_VERSION_INFO;
+
+
+// Part 2, section 21.9: TPM_DA_STATE
+// out of order to make it available for structure definitions
+typedef BYTE TPM_DA_STATE;
+#define TPM_DA_STATE_INACTIVE (0x00)
+#define TPM_DA_STATE_ACTIVE (0x01)
+
+// Part 2, section 21.10: TPM_DA_ACTION_TYPE
+typedef struct tdTPM_DA_ACTION_TYPE
+{
+ TPM_STRUCTURE_TAG tag;
+ UINT32 actions;
+} TPM_DA_ACTION_TYPE;
+#define TPM_DA_ACTION_TIMEOUT ((UINT32)0x00000001)
+#define TPM_DA_ACTION_DISABLE ((UINT32)0x00000002)
+#define TPM_DA_ACTION_DEACTIVATE ((UINT32)0x00000004)
+#define TPM_DA_ACTION_FAILURE_MODE ((UINT32)0x00000008)
+
+// Part 2, section 21.7: TPM_DA_INFO
+typedef struct tdTPM_DA_INFO
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DA_STATE state;
+ UINT16 currentCount;
+ UINT16 threshholdCount;
+ TPM_DA_ACTION_TYPE actionAtThreshold;
+ UINT32 actionDependValue;
+ UINT32 vendorDataSize;
+ SIZEIS(vendorDataSize)
+ BYTE *vendorData;
+} TPM_DA_INFO;
+
+// Part 2, section 21.8: TPM_DA_INFO_LIMITED
+typedef struct tdTPM_DA_INFO_LIMITED
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DA_STATE state;
+ TPM_DA_ACTION_TYPE actionAtThreshold;
+ UINT32 vendorDataSize;
+ SIZEIS(vendorDataSize)
+ BYTE *vendorData;
+} TPM_DA_INFO_LIMITED;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 22: DAA Structures
+
+#define TPM_DAA_SIZE_r0 (43)
+#define TPM_DAA_SIZE_r1 (43)
+#define TPM_DAA_SIZE_r2 (128)
+#define TPM_DAA_SIZE_r3 (168)
+#define TPM_DAA_SIZE_r4 (219)
+#define TPM_DAA_SIZE_NT (20)
+#define TPM_DAA_SIZE_v0 (128)
+#define TPM_DAA_SIZE_v1 (192)
+#define TPM_DAA_SIZE_NE (256)
+#define TPM_DAA_SIZE_w (256)
+#define TPM_DAA_SIZE_issuerModulus (256)
+#define TPM_DAA_power0 (104)
+#define TPM_DAA_power1 (1024)
+
+typedef struct tdTPM_DAA_ISSUER
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST DAA_digest_R0;
+ TPM_DIGEST DAA_digest_R1;
+ TPM_DIGEST DAA_digest_S0;
+ TPM_DIGEST DAA_digest_S1;
+ TPM_DIGEST DAA_digest_n;
+ TPM_DIGEST DAA_digest_gamma;
+ BYTE DAA_generic_q[26];
+} TPM_DAA_ISSUER;
+
+
+typedef struct tdTPM_DAA_TPM
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST DAA_digestIssuer;
+ TPM_DIGEST DAA_digest_v0;
+ TPM_DIGEST DAA_digest_v1;
+ TPM_DIGEST DAA_rekey;
+ UINT32 DAA_count;
+} TPM_DAA_TPM;
+
+typedef struct tdTPM_DAA_CONTEXT
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_DIGEST DAA_digestContext;
+ TPM_DIGEST DAA_digest;
+ TPM_DAA_CONTEXT_SEED DAA_contextSeed;
+ BYTE DAA_scratch[256];
+ BYTE DAA_stage;
+} TPM_DAA_CONTEXT;
+
+typedef struct tdTPM_DAA_JOINDATA
+{
+ BYTE DAA_join_u0[128];
+ BYTE DAA_join_u1[138];
+ TPM_DIGEST DAA_digest_n0;
+} TPM_DAA_JOINDATA;
+
+typedef struct tdTPM_DAA_BLOB
+{
+ TPM_STRUCTURE_TAG tag;
+ TPM_RESOURCE_TYPE resourceType;
+ BYTE label[16];
+ TPM_DIGEST blobIntegrity;
+ UINT32 additionalSize;
+ SIZEIS(additionalSize)
+ BYTE *additionalData;
+ UINT32 sensitiveSize;
+ SIZEIS(sensitiveSize)
+ BYTE *sensitiveData;
+} TPM_DAA_BLOB;
+
+typedef struct tdTPM_DAA_SENSITIVE
+{
+ TPM_STRUCTURE_TAG tag;
+ UINT32 internalSize;
+ SIZEIS(internalSize)
+ BYTE *internalData;
+} TPM_DAA_SENSITIVE;
+
+
+
+//-------------------------------------------------------------------
+// Part 2, section 23: Redirection
+
+// This section of the TPM spec defines exactly one value but does not
+// give it a name. The definition of TPM_SetRedirection in Part3
+// refers to exactly one name but does not give its value. We join
+// them here.
+#define TPM_REDIR_GPIO (0x00000001)
+
+
+//-------------------------------------------------------------------
+// Part 2, section 24.6: TPM_SYM_MODE
+// Deprecated by TPM 1.2 spec
+
+typedef UINT32 TPM_SYM_MODE;
+#define TPM_SYM_MODE_ECB (0x00000001)
+#define TPM_SYM_MODE_CBC (0x00000002)
+#define TPM_SYM_MODE_CFB (0x00000003)
+
+#endif // __TPM_H__
+
diff --git a/src/include/tss/tpm_error.h b/src/include/tss/tpm_error.h
new file mode 100644
index 0000000..ccd4af4
--- /dev/null
+++ b/src/include/tss/tpm_error.h
@@ -0,0 +1,963 @@
+/*
+ * The TPM error codes extracted from the TPM main specification
+ * version 1.2 revision 85.
+ */
+
+#ifndef __TPM_ERROR_H__
+#define __TPM_ERROR_H__
+
+
+#ifndef TPM_E_BASE
+#define TPM_E_BASE ((UINT32)0)
+#endif
+
+#ifndef TPM_E_NON_FATAL
+#define TPM_E_NON_FATAL ((UINT32)0x00000800)
+#endif
+
+
+// Successful completion of the TPM operation.
+#define TPM_SUCCESS TPM_E_BASE
+
+//
+// MessageId: TPM_E_AUTHFAIL
+//
+// MessageText:
+//
+// Authentication failed
+//
+#define TPM_E_AUTHFAIL ((UINT32)(TPM_E_BASE + 0x00000001))
+
+//
+// MessageId: TPM_E_BADINDEX
+//
+// MessageText:
+//
+// The index to a PCR, DIR or other register is incorrect
+//
+#define TPM_E_BADINDEX ((UINT32)(TPM_E_BASE + 0x00000002))
+
+//
+// MessageId: TPM_E_BAD_PARAMETER
+//
+// MessageText:
+//
+// One or more parameter is bad
+//
+#define TPM_E_BAD_PARAMETER ((UINT32)(TPM_E_BASE + 0x00000003))
+
+//
+// MessageId: TPM_E_AUDITFAILURE
+//
+// MessageText:
+//
+// An operation completed successfully but the auditing of that
+// operation failed.
+//
+#define TPM_E_AUDITFAILURE ((UINT32)(TPM_E_BASE + 0x00000004))
+
+//
+// MessageId: TPM_E_CLEAR_DISABLED
+//
+// MessageText:
+//
+// The clear disable flag is set and all clear operations now require
+// physical access
+//
+#define TPM_E_CLEAR_DISABLED ((UINT32)(TPM_E_BASE + 0x00000005))
+
+//
+// MessageId: TPM_E_DEACTIVATED
+//
+// MessageText:
+//
+// The TPM is deactivated
+//
+#define TPM_E_DEACTIVATED ((UINT32)(TPM_E_BASE + 0x00000006))
+
+//
+// MessageId: TPM_E_DISABLED
+//
+// MessageText:
+//
+// The TPM is disabled
+//
+#define TPM_E_DISABLED ((UINT32)(TPM_E_BASE + 0x00000007))
+
+//
+// MessageId: TPM_E_DISABLED_CMD
+//
+// MessageText:
+//
+// The target command has been disabled
+//
+#define TPM_E_DISABLED_CMD ((UINT32)(TPM_E_BASE + 0x00000008))
+
+//
+// MessageId: TPM_E_FAIL
+//
+// MessageText:
+//
+// The operation failed
+//
+#define TPM_E_FAIL ((UINT32)(TPM_E_BASE + 0x00000009))
+
+//
+// MessageId: TPM_E_BAD_ORDINAL
+//
+// MessageText:
+//
+// The ordinal was unknown or inconsistent
+//
+#define TPM_E_BAD_ORDINAL ((UINT32)(TPM_E_BASE + 0x0000000a))
+
+//
+// MessageId: TPM_E_INSTALL_DISABLED
+//
+// MessageText:
+//
+// The ability to install an owner is disabled
+//
+#define TPM_E_INSTALL_DISABLED ((UINT32)(TPM_E_BASE + 0x0000000b))
+
+//
+// MessageId: TPM_E_INVALID_KEYHANDLE
+//
+// MessageText:
+//
+// The key handle can not be interpreted
+//
+#define TPM_E_INVALID_KEYHANDLE ((UINT32)(TPM_E_BASE + 0x0000000c))
+
+//
+// MessageId: TPM_E_KEYNOTFOUND
+//
+// MessageText:
+//
+// The key handle points to an invalid key
+//
+#define TPM_E_KEYNOTFOUND ((UINT32)(TPM_E_BASE + 0x0000000d))
+
+//
+// MessageId: TPM_E_INAPPROPRIATE_ENC
+//
+// MessageText:
+//
+// Unacceptable encryption scheme
+//
+#define TPM_E_INAPPROPRIATE_ENC ((UINT32)(TPM_E_BASE + 0x0000000e))
+
+//
+// MessageId: TPM_E_MIGRATEFAIL
+//
+// MessageText:
+//
+// Migration authorization failed
+//
+#define TPM_E_MIGRATEFAIL ((UINT32)(TPM_E_BASE + 0x0000000f))
+
+//
+// MessageId: TPM_E_INVALID_PCR_INFO
+//
+// MessageText:
+//
+// PCR information could not be interpreted
+//
+#define TPM_E_INVALID_PCR_INFO ((UINT32)(TPM_E_BASE + 0x00000010))
+
+//
+// MessageId: TPM_E_NOSPACE
+//
+// MessageText:
+//
+// No room to load key.
+//
+#define TPM_E_NOSPACE ((UINT32)(TPM_E_BASE + 0x00000011))
+
+//
+// MessageId: TPM_E_NOSRK
+//
+// MessageText:
+//
+// There is no SRK set
+//
+#define TPM_E_NOSRK ((UINT32)(TPM_E_BASE + 0x00000012))
+
+//
+// MessageId: TPM_E_NOTSEALED_BLOB
+//
+// MessageText:
+//
+// An encrypted blob is invalid or was not created by this TPM
+//
+#define TPM_E_NOTSEALED_BLOB ((UINT32)(TPM_E_BASE + 0x00000013))
+
+//
+// MessageId: TPM_E_OWNER_SET
+//
+// MessageText:
+//
+// There is already an Owner
+//
+#define TPM_E_OWNER_SET ((UINT32)(TPM_E_BASE + 0x00000014))
+
+//
+// MessageId: TPM_E_RESOURCES
+//
+// MessageText:
+//
+// The TPM has insufficient internal resources to perform the
+// requested action.
+//
+#define TPM_E_RESOURCES ((UINT32)(TPM_E_BASE + 0x00000015))
+
+//
+// MessageId: TPM_E_SHORTRANDOM
+//
+// MessageText:
+//
+// A random string was too short
+//
+#define TPM_E_SHORTRANDOM ((UINT32)(TPM_E_BASE + 0x00000016))
+
+//
+// MessageId: TPM_E_SIZE
+//
+// MessageText:
+//
+// The TPM does not have the space to perform the operation.
+//
+#define TPM_E_SIZE ((UINT32)(TPM_E_BASE + 0x00000017))
+
+//
+// MessageId: TPM_E_WRONGPCRVAL
+//
+// MessageText:
+//
+// The named PCR value does not match the current PCR value.
+//
+#define TPM_E_WRONGPCRVAL ((UINT32)(TPM_E_BASE + 0x00000018))
+
+//
+// MessageId: TPM_E_BAD_PARAM_SIZE
+//
+// MessageText:
+//
+// The paramSize argument to the command has the incorrect value
+//
+#define TPM_E_BAD_PARAM_SIZE ((UINT32)(TPM_E_BASE + 0x00000019))
+
+//
+// MessageId: TPM_E_SHA_THREAD
+//
+// MessageText:
+//
+// There is no existing SHA-1 thread.
+//
+#define TPM_E_SHA_THREAD ((UINT32)(TPM_E_BASE + 0x0000001a))
+
+//
+// MessageId: TPM_E_SHA_ERROR
+//
+// MessageText:
+//
+// The calculation is unable to proceed because the existing SHA-1
+// thread has already encountered an error.
+//
+#define TPM_E_SHA_ERROR ((UINT32)(TPM_E_BASE + 0x0000001b))
+
+//
+// MessageId: TPM_E_FAILEDSELFTEST
+//
+// MessageText:
+//
+// Self-test has failed and the TPM has shutdown.
+//
+#define TPM_E_FAILEDSELFTEST ((UINT32)(TPM_E_BASE + 0x0000001c))
+
+//
+// MessageId: TPM_E_AUTH2FAIL
+//
+// MessageText:
+//
+// The authorization for the second key in a 2 key function failed
+// authorization
+//
+#define TPM_E_AUTH2FAIL ((UINT32)(TPM_E_BASE + 0x0000001d))
+
+//
+// MessageId: TPM_E_BADTAG
+//
+// MessageText:
+//
+// The tag value sent to for a command is invalid
+//
+#define TPM_E_BADTAG ((UINT32)(TPM_E_BASE + 0x0000001e))
+
+//
+// MessageId: TPM_E_IOERROR
+//
+// MessageText:
+//
+// An IO error occurred transmitting information to the TPM
+//
+#define TPM_E_IOERROR ((UINT32)(TPM_E_BASE + 0x0000001f))
+
+//
+// MessageId: TPM_E_ENCRYPT_ERROR
+//
+// MessageText:
+//
+// The encryption process had a problem.
+//
+#define TPM_E_ENCRYPT_ERROR ((UINT32)(TPM_E_BASE + 0x00000020))
+
+//
+// MessageId: TPM_E_DECRYPT_ERROR
+//
+// MessageText:
+//
+// The decryption process did not complete.
+//
+#define TPM_E_DECRYPT_ERROR ((UINT32)(TPM_E_BASE + 0x00000021))
+
+//
+// MessageId: TPM_E_INVALID_AUTHHANDLE
+//
+// MessageText:
+//
+// An invalid handle was used.
+//
+#define TPM_E_INVALID_AUTHHANDLE ((UINT32)(TPM_E_BASE + 0x00000022))
+
+//
+// MessageId: TPM_E_NO_ENDORSEMENT
+//
+// MessageText:
+//
+// The TPM does not a EK installed
+//
+#define TPM_E_NO_ENDORSEMENT ((UINT32)(TPM_E_BASE + 0x00000023))
+
+//
+// MessageId: TPM_E_INVALID_KEYUSAGE
+//
+// MessageText:
+//
+// The usage of a key is not allowed
+//
+#define TPM_E_INVALID_KEYUSAGE ((UINT32)(TPM_E_BASE + 0x00000024))
+
+//
+// MessageId: TPM_E_WRONG_ENTITYTYPE
+//
+// MessageText:
+//
+// The submitted entity type is not allowed
+//
+#define TPM_E_WRONG_ENTITYTYPE ((UINT32)(TPM_E_BASE + 0x00000025))
+
+//
+// MessageId: TPM_E_INVALID_POSTINIT
+//
+// MessageText:
+//
+// The command was received in the wrong sequence relative to TPM_Init
+// and a subsequent TPM_Startup
+//
+#define TPM_E_INVALID_POSTINIT ((UINT32)(TPM_E_BASE + 0x00000026))
+
+//
+// MessageId: TPM_E_INAPPROPRIATE_SIG
+//
+// MessageText:
+//
+// Signed data cannot include additional DER information
+//
+#define TPM_E_INAPPROPRIATE_SIG ((UINT32)(TPM_E_BASE + 0x00000027))
+
+//
+// MessageId: TPM_E_BAD_KEY_PROPERTY
+//
+// MessageText:
+//
+// The key properties in TPM_KEY_PARMs are not supported by this TPM
+//
+#define TPM_E_BAD_KEY_PROPERTY ((UINT32)(TPM_E_BASE + 0x00000028))
+
+//
+// MessageId: TPM_E_BAD_MIGRATION
+//
+// MessageText:
+//
+// The migration properties of this key are incorrect.
+//
+#define TPM_E_BAD_MIGRATION ((UINT32)(TPM_E_BASE + 0x00000029))
+
+//
+// MessageId: TPM_E_BAD_SCHEME
+//
+// MessageText:
+//
+// The signature or encryption scheme for this key is incorrect or not
+// permitted in this situation.
+//
+#define TPM_E_BAD_SCHEME ((UINT32)(TPM_E_BASE + 0x0000002a))
+
+//
+// MessageId: TPM_E_BAD_DATASIZE
+//
+// MessageText:
+//
+// The size of the data (or blob) parameter is bad or inconsistent
+// with the referenced key
+//
+#define TPM_E_BAD_DATASIZE ((UINT32)(TPM_E_BASE + 0x0000002b))
+
+//
+// MessageId: TPM_E_BAD_MODE
+//
+// MessageText:
+//
+// A mode parameter is bad, such as capArea or subCapArea for
+// TPM_GetCapability, physicalPresence parameter for
+// TPM_PhysicalPresence, or migrationType for TPM_CreateMigrationBlob.
+//
+#define TPM_E_BAD_MODE ((UINT32)(TPM_E_BASE + 0x0000002c))
+
+//
+// MessageId: TPM_E_BAD_PRESENCE
+//
+// MessageText:
+//
+// Either the physicalPresence or physicalPresenceLock bits have the
+// wrong value
+//
+#define TPM_E_BAD_PRESENCE ((UINT32)(TPM_E_BASE + 0x0000002d))
+
+//
+// MessageId: TPM_E_BAD_VERSION
+//
+// MessageText:
+//
+// The TPM cannot perform this version of the capability
+//
+#define TPM_E_BAD_VERSION ((UINT32)(TPM_E_BASE + 0x0000002e))
+
+//
+// MessageId: TPM_E_NO_WRAP_TRANSPORT
+//
+// MessageText:
+//
+// The TPM does not allow for wrapped transport sessions
+//
+#define TPM_E_NO_WRAP_TRANSPORT ((UINT32)(TPM_E_BASE + 0x0000002f))
+
+//
+// MessageId: TPM_E_AUDITFAIL_UNSUCCESSFUL
+//
+// MessageText:
+//
+// TPM audit construction failed and the underlying command was
+// returning a failure code also
+//
+#define TPM_E_AUDITFAIL_UNSUCCESSFUL ((UINT32)(TPM_E_BASE + 0x00000030))
+
+//
+// MessageId: TPM_E_AUDITFAIL_SUCCESSFUL
+//
+// MessageText:
+//
+// TPM audit construction failed and the underlying command was
+// returning success
+//
+#define TPM_E_AUDITFAIL_SUCCESSFUL ((UINT32)(TPM_E_BASE + 0x00000031))
+
+//
+// MessageId: TPM_E_NOTRESETABLE
+//
+// MessageText:
+//
+// Attempt to reset a PCR register that does not have the resettable
+// attribute
+//
+#define TPM_E_NOTRESETABLE ((UINT32)(TPM_E_BASE + 0x00000032))
+
+//
+// MessageId: TPM_E_NOTLOCAL
+//
+// MessageText:
+//
+// Attempt to reset a PCR register that requires locality and locality
+// modifier not part of command transport
+//
+#define TPM_E_NOTLOCAL ((UINT32)(TPM_E_BASE + 0x00000033))
+
+//
+// MessageId: TPM_E_BAD_TYPE
+//
+// MessageText:
+//
+// Make identity blob not properly typed
+//
+#define TPM_E_BAD_TYPE ((UINT32)(TPM_E_BASE + 0x00000034))
+
+//
+// MessageId: TPM_E_INVALID_RESOURCE
+//
+// MessageText:
+//
+// When saving context identified resource type does not match actual
+// resource
+//
+#define TPM_E_INVALID_RESOURCE ((UINT32)(TPM_E_BASE + 0x00000035))
+
+//
+// MessageId: TPM_E_NOTFIPS
+//
+// MessageText:
+//
+// The TPM is attempting to execute a command only available when in
+// FIPS mode
+//
+#define TPM_E_NOTFIPS ((UINT32)(TPM_E_BASE + 0x00000036))
+
+//
+// MessageId: TPM_E_INVALID_FAMILY
+//
+// MessageText:
+//
+// The command is attempting to use an invalid family ID
+//
+#define TPM_E_INVALID_FAMILY ((UINT32)(TPM_E_BASE + 0x00000037))
+
+//
+// MessageId: TPM_E_NO_NV_PERMISSION
+//
+// MessageText:
+//
+// The permission to manipulate the NV storage is not available
+//
+#define TPM_E_NO_NV_PERMISSION ((UINT32)(TPM_E_BASE + 0x00000038))
+
+//
+// MessageId: TPM_E_REQUIRES_SIGN
+//
+// MessageText:
+//
+// The operation requires a signed command
+//
+#define TPM_E_REQUIRES_SIGN ((UINT32)(TPM_E_BASE + 0x00000039))
+
+//
+// MessageId: TPM_E_KEY_NOTSUPPORTED
+//
+// MessageText:
+//
+// Wrong operation to load an NV key
+//
+#define TPM_E_KEY_NOTSUPPORTED ((UINT32)(TPM_E_BASE + 0x0000003a))
+
+//
+// MessageId: TPM_E_AUTH_CONFLICT
+//
+// MessageText:
+//
+// NV_LoadKey blob requires both owner and blob authorization
+//
+#define TPM_E_AUTH_CONFLICT ((UINT32)(TPM_E_BASE + 0x0000003b))
+
+//
+// MessageId: TPM_E_AREA_LOCKED
+//
+// MessageText:
+//
+// The NV area is locked and not writable
+//
+#define TPM_E_AREA_LOCKED ((UINT32)(TPM_E_BASE + 0x0000003c))
+
+//
+// MessageId: TPM_E_BAD_LOCALITY
+//
+// MessageText:
+//
+// The locality is incorrect for the attempted operation
+//
+#define TPM_E_BAD_LOCALITY ((UINT32)(TPM_E_BASE + 0x0000003d))
+
+//
+// MessageId: TPM_E_READ_ONLY
+//
+// MessageText:
+//
+// The NV area is read only and can't be written to
+//
+#define TPM_E_READ_ONLY ((UINT32)(TPM_E_BASE + 0x0000003e))
+
+//
+// MessageId: TPM_E_PER_NOWRITE
+//
+// MessageText:
+//
+// There is no protection on the write to the NV area
+//
+#define TPM_E_PER_NOWRITE ((UINT32)(TPM_E_BASE + 0x0000003f))
+
+//
+// MessageId: TPM_E_FAMILYCOUNT
+//
+// MessageText:
+//
+// The family count value does not match
+//
+#define TPM_E_FAMILYCOUNT ((UINT32)(TPM_E_BASE + 0x00000040))
+
+//
+// MessageId: TPM_E_WRITE_LOCKED
+//
+// MessageText:
+//
+// The NV area has already been written to
+//
+#define TPM_E_WRITE_LOCKED ((UINT32)(TPM_E_BASE + 0x00000041))
+
+//
+// MessageId: TPM_E_BAD_ATTRIBUTES
+//
+// MessageText:
+//
+// The NV area attributes conflict
+//
+#define TPM_E_BAD_ATTRIBUTES ((UINT32)(TPM_E_BASE + 0x00000042))
+
+//
+// MessageId: TPM_E_INVALID_STRUCTURE
+//
+// MessageText:
+//
+// The structure tag and version are invalid or inconsistent
+//
+#define TPM_E_INVALID_STRUCTURE ((UINT32)(TPM_E_BASE + 0x00000043))
+
+//
+// MessageId: TPM_E_KEY_OWNER_CONTROL
+//
+// MessageText:
+//
+// The key is under control of the TPM Owner and can only be evicted
+// by the TPM Owner.
+//
+#define TPM_E_KEY_OWNER_CONTROL ((UINT32)(TPM_E_BASE + 0x00000044))
+
+//
+// MessageId: TPM_E_BAD_COUNTER
+//
+// MessageText:
+//
+// The counter handle is incorrect
+//
+#define TPM_E_BAD_COUNTER ((UINT32)(TPM_E_BASE + 0x00000045))
+
+//
+// MessageId: TPM_E_NOT_FULLWRITE
+//
+// MessageText:
+//
+// The write is not a complete write of the area
+//
+#define TPM_E_NOT_FULLWRITE ((UINT32)(TPM_E_BASE + 0x00000046))
+
+//
+// MessageId: TPM_E_CONTEXT_GAP
+//
+// MessageText:
+//
+// The gap between saved context counts is too large
+//
+#define TPM_E_CONTEXT_GAP ((UINT32)(TPM_E_BASE + 0x00000047))
+
+//
+// MessageId: TPM_E_MAXNVWRITES
+//
+// MessageText:
+//
+// The maximum number of NV writes without an owner has been exceeded
+//
+#define TPM_E_MAXNVWRITES ((UINT32)(TPM_E_BASE + 0x00000048))
+
+//
+// MessageId: TPM_E_NOOPERATOR
+//
+// MessageText:
+//
+// No operator AuthData value is set
+//
+#define TPM_E_NOOPERATOR ((UINT32)(TPM_E_BASE + 0x00000049))
+
+//
+// MessageId: TPM_E_RESOURCEMISSING
+//
+// MessageText:
+//
+// The resource pointed to by context is not loaded
+//
+#define TPM_E_RESOURCEMISSING ((UINT32)(TPM_E_BASE + 0x0000004a))
+
+//
+// MessageId: TPM_E_DELEGATE_LOCK
+//
+// MessageText:
+//
+// The delegate administration is locked
+//
+#define TPM_E_DELEGATE_LOCK ((UINT32)(TPM_E_BASE + 0x0000004b))
+
+//
+// MessageId: TPM_E_DELEGATE_FAMILY
+//
+// MessageText:
+//
+// Attempt to manage a family other then the delegated family
+//
+#define TPM_E_DELEGATE_FAMILY ((UINT32)(TPM_E_BASE + 0x0000004c))
+
+//
+// MessageId: TPM_E_DELEGATE_ADMIN
+//
+// MessageText:
+//
+// Delegation table management not enabled
+//
+#define TPM_E_DELEGATE_ADMIN ((UINT32)(TPM_E_BASE + 0x0000004d))
+
+//
+// MessageId: TPM_E_TRANSPORT_NOTEXCLUSIVE
+//
+// MessageText:
+//
+// There was a command executed outside of an exclusive transport session
+//
+#define TPM_E_TRANSPORT_NOTEXCLUSIVE ((UINT32)(TPM_E_BASE + 0x0000004e))
+
+//
+// MessageId: TPM_E_OWNER_CONTROL
+//
+// MessageText:
+//
+// Attempt to context save a owner evict controlled key
+//
+#define TPM_E_OWNER_CONTROL ((UINT32)(TPM_E_BASE + 0x0000004f))
+
+//
+// MessageId: TPM_E_DAA_RESOURCES
+//
+// MessageText:
+//
+// The DAA command has no resources available to execute the command
+//
+#define TPM_E_DAA_RESOURCES ((UINT32)(TPM_E_BASE + 0x00000050))
+
+//
+// MessageId: TPM_E_DAA_INPUT_DATA0
+//
+// MessageText:
+//
+// The consistency check on DAA parameter inputData0 has failed.
+//
+#define TPM_E_DAA_INPUT_DATA0 ((UINT32)(TPM_E_BASE + 0x00000051))
+
+//
+// MessageId: TPM_E_DAA_INPUT_DATA1
+//
+// MessageText:
+//
+// The consistency check on DAA parameter inputData1 has failed.
+//
+#define TPM_E_DAA_INPUT_DATA1 ((UINT32)(TPM_E_BASE + 0x00000052))
+
+//
+// MessageId: TPM_E_DAA_ISSUER_SETTINGS
+//
+// MessageText:
+//
+// The consistency check on DAA_issuerSettings has failed.
+//
+#define TPM_E_DAA_ISSUER_SETTINGS ((UINT32)(TPM_E_BASE + 0x00000053))
+
+//
+// MessageId: TPM_E_DAA_TPM_SETTINGS
+//
+// MessageText:
+//
+// The consistency check on DAA_tpmSpecific has failed.
+//
+#define TPM_E_DAA_TPM_SETTINGS ((UINT32)(TPM_E_BASE + 0x00000054))
+
+//
+// MessageId: TPM_E_DAA_STAGE
+//
+// MessageText:
+//
+// The atomic process indicated by the submitted DAA command is not
+// the expected process.
+//
+#define TPM_E_DAA_STAGE ((UINT32)(TPM_E_BASE + 0x00000055))
+
+//
+// MessageId: TPM_E_DAA_ISSUER_VALIDITY
+//
+// MessageText:
+//
+// The issuer's validity check has detected an inconsistency
+//
+#define TPM_E_DAA_ISSUER_VALIDITY ((UINT32)(TPM_E_BASE + 0x00000056))
+
+//
+// MessageId: TPM_E_DAA_WRONG_W
+//
+// MessageText:
+//
+// The consistency check on w has failed.
+//
+#define TPM_E_DAA_WRONG_W ((UINT32)(TPM_E_BASE + 0x00000057))
+
+//
+// MessageId: TPM_E_BAD_HANDLE
+//
+// MessageText:
+//
+// The handle is incorrect
+//
+#define TPM_E_BAD_HANDLE ((UINT32)(TPM_E_BASE + 0x00000058))
+
+//
+// MessageId: TPM_E_BAD_DELEGATE
+//
+// MessageText:
+//
+// Delegation is not correct
+//
+#define TPM_E_BAD_DELEGATE ((UINT32)(TPM_E_BASE + 0x00000059))
+
+//
+// MessageId: TPM_E_BADCONTEXT
+//
+// MessageText:
+//
+// The context blob is invalid
+//
+#define TPM_E_BADCONTEXT ((UINT32)(TPM_E_BASE + 0x0000005a))
+
+//
+// MessageId: TPM_E_TOOMANYCONTEXTS
+//
+// MessageText:
+//
+// Too many contexts held by the TPM
+//
+#define TPM_E_TOOMANYCONTEXTS ((UINT32)(TPM_E_BASE + 0x0000005b))
+
+//
+// MessageId: TPM_E_MA_TICKET_SIGNATURE
+//
+// MessageText:
+//
+// Migration authority signature validation failure
+//
+#define TPM_E_MA_TICKET_SIGNATURE ((UINT32)(TPM_E_BASE + 0x0000005c))
+
+//
+// MessageId: TPM_E_MA_DESTINATION
+//
+// MessageText:
+//
+// Migration destination not authenticated
+//
+#define TPM_E_MA_DESTINATION ((UINT32)(TPM_E_BASE + 0x0000005d))
+
+//
+// MessageId: TPM_E_MA_SOURCE
+//
+// MessageText:
+//
+// Migration source incorrect
+//
+#define TPM_E_MA_SOURCE ((UINT32)(TPM_E_BASE + 0x0000005e))
+
+//
+// MessageId: TPM_E_MA_AUTHORITY
+//
+// MessageText:
+//
+// Incorrect migration authority
+//
+#define TPM_E_MA_AUTHORITY ((UINT32)(TPM_E_BASE + 0x0000005f))
+
+//
+// MessageId: TPM_E_PERMANENTEK
+//
+// MessageText:
+//
+// Attempt to revoke the EK and the EK is not revocable
+//
+#define TPM_E_PERMANENTEK ((UINT32)(TPM_E_BASE + 0x00000061))
+
+//
+// MessageId: TPM_E_BAD_SIGNATURE
+//
+// MessageText:
+//
+// Bad signature of CMK ticket
+//
+#define TPM_E_BAD_SIGNATURE ((UINT32)(TPM_E_BASE + 0x00000062))
+
+//
+// MessageId: TPM_E_NOCONTEXTSPACE
+//
+// MessageText:
+//
+// There is no room in the context list for additional contexts
+//
+#define TPM_E_NOCONTEXTSPACE ((UINT32)(TPM_E_BASE + 0x00000063))
+
+
+//
+// MessageId: TPM_E_RETRY
+//
+// MessageText:
+//
+// The TPM is too busy to respond to the command immediately, but the
+// command could be resubmitted at a later time. The TPM MAY return
+// TPM_Retry for any command at any time.
+//
+#define TPM_E_RETRY ((UINT32)(TPM_E_BASE + TPM_E_NON_FATAL))
+
+//
+// MessageId: TPM_E_NEEDS_SELFTEST
+//
+// MessageText:
+//
+// SelfTestFull has not been run
+//
+#define TPM_E_NEEDS_SELFTEST ((UINT32)(TPM_E_BASE + TPM_E_NON_FATAL + 1))
+
+//
+// MessageId: TPM_E_DOING_SELFTEST
+//
+// MessageText:
+//
+// The TPM is currently executing a full selftest
+//
+#define TPM_E_DOING_SELFTEST ((UINT32)(TPM_E_BASE + TPM_E_NON_FATAL + 2))
+
+//
+// MessageId: TPM_E_DEFEND_LOCK_RUNNING
+//
+// MessageText:
+//
+// The TPM is defending against dictionary attacks and is in some
+// time-out period.
+//
+#define TPM_E_DEFEND_LOCK_RUNNING ((UINT32)(TPM_E_BASE + TPM_E_NON_FATAL + 3))
+
+#endif /* __TPM_ERROR_H__ */
diff --git a/src/include/tss/tpm_ordinal.h b/src/include/tss/tpm_ordinal.h
new file mode 100644
index 0000000..9df9959
--- /dev/null
+++ b/src/include/tss/tpm_ordinal.h
@@ -0,0 +1,151 @@
+/*
+ * TPM Ordinal definitions extracted from the TPM 1.2 specification, rev 85.
+ */
+
+#ifndef __TPM_ORDINAL_H__
+#define __TPM_ORDINAL_H__
+
+#define TPM_PROTECTED_COMMAND ((UINT32)(0x00000000))
+#define TPM_UNPROTECTED_COMMAND ((UINT32)(0x80000000))
+#define TPM_CONNECTION_COMMAND ((UINT32)(0x40000000))
+#define TPM_VENDOR_COMMAND ((UINT32)(0x20000000))
+
+#define TPM_MAIN ((UINT16)(0x0000))
+#define TPM_PC ((UINT16)(0x0001))
+#define TPM_PDA ((UINT16)(0x0002))
+#define TPM_CELL_PHONE ((UINT16)(0x0003))
+#define TPM_SERVER ((UINT16)(0x0004))
+
+#define TPM_PROTECTED_ORDINAL (TPM_MAIN | TPM_PROTECTED_COMMAND)
+#define TPM_UNPROTECTED_ORDINAL (TPM_MAIN | TPM_UNPROTECTED_COMMAND)
+#define TPM_CONNECTION_ORDINAL (TPM_MAIN | TPM_CONNECTION_COMMAND)
+
+
+#define TPM_ORD_OIAP ((UINT32)0x0000000A)
+#define TPM_ORD_OSAP ((UINT32)0x0000000B)
+#define TPM_ORD_ChangeAuth ((UINT32)0x0000000C)
+#define TPM_ORD_TakeOwnership ((UINT32)0x0000000D)
+#define TPM_ORD_ChangeAuthAsymStart ((UINT32)0x0000000E)
+#define TPM_ORD_ChangeAuthAsymFinish ((UINT32)0x0000000F)
+#define TPM_ORD_ChangeAuthOwner ((UINT32)0x00000010)
+#define TPM_ORD_DSAP ((UINT32)0x00000011)
+#define TPM_ORD_CMK_CreateTicket ((UINT32)0x00000012)
+#define TPM_ORD_CMK_CreateKey ((UINT32)0x00000013)
+#define TPM_ORD_Extend ((UINT32)0x00000014)
+#define TPM_ORD_PcrRead ((UINT32)0x00000015)
+#define TPM_ORD_Quote ((UINT32)0x00000016)
+#define TPM_ORD_Seal ((UINT32)0x00000017)
+#define TPM_ORD_Unseal ((UINT32)0x00000018)
+#define TPM_ORD_DirWriteAuth ((UINT32)0x00000019)
+#define TPM_ORD_DirRead ((UINT32)0x0000001A)
+#define TPM_ORD_CMK_CreateBlob ((UINT32)0x0000001B)
+#define TPM_ORD_CMK_SetRestrictions ((UINT32)0x0000001C)
+#define TPM_ORD_CMK_ApproveMA ((UINT32)0x0000001D)
+#define TPM_ORD_UnBind ((UINT32)0x0000001E)
+#define TPM_ORD_CreateWrapKey ((UINT32)0x0000001F)
+#define TPM_ORD_LoadKey ((UINT32)0x00000020)
+#define TPM_ORD_GetPubKey ((UINT32)0x00000021)
+#define TPM_ORD_EvictKey ((UINT32)0x00000022)
+#define TPM_ORD_KeyControlOwner ((UINT32)0x00000023)
+#define TPM_ORD_CMK_ConvertMigration ((UINT32)0x00000024)
+#define TPM_ORD_MigrateKey ((UINT32)0x00000025)
+#define TPM_ORD_CreateMigrationBlob ((UINT32)0x00000028)
+#define TPM_ORD_DAA_Join ((UINT32)0x00000029)
+#define TPM_ORD_ConvertMigrationBlob ((UINT32)0x0000002A)
+#define TPM_ORD_AuthorizeMigrationKey ((UINT32)0x0000002B)
+#define TPM_ORD_CreateMaintenanceArchive ((UINT32)0x0000002C)
+#define TPM_ORD_LoadMaintenanceArchive ((UINT32)0x0000002D)
+#define TPM_ORD_KillMaintenanceFeature ((UINT32)0x0000002E)
+#define TPM_ORD_LoadManuMaintPub ((UINT32)0x0000002F)
+#define TPM_ORD_ReadManuMaintPub ((UINT32)0x00000030)
+#define TPM_ORD_DAA_Sign ((UINT32)0x00000031)
+#define TPM_ORD_CertifyKey ((UINT32)0x00000032)
+#define TPM_ORD_CertifyKey2 ((UINT32)0x00000033)
+#define TPM_ORD_Sign ((UINT32)0x0000003C)
+#define TPM_ORD_Sealx ((UINT32)0x0000003D)
+#define TPM_ORD_Quote2 ((UINT32)0x0000003E)
+#define TPM_ORD_SetCapability ((UINT32)0x0000003F)
+#define TPM_ORD_ResetLockValue ((UINT32)0x00000040)
+#define TPM_ORD_LoadKey2 ((UINT32)0x00000041)
+#define TPM_ORD_GetRandom ((UINT32)0x00000046)
+#define TPM_ORD_StirRandom ((UINT32)0x00000047)
+#define TPM_ORD_SelfTestFull ((UINT32)0x00000050)
+#define TPM_ORD_CertifySelfTest ((UINT32)0x00000052)
+#define TPM_ORD_ContinueSelfTest ((UINT32)0x00000053)
+#define TPM_ORD_GetTestResult ((UINT32)0x00000054)
+#define TPM_ORD_Reset ((UINT32)0x0000005A)
+#define TPM_ORD_OwnerClear ((UINT32)0x0000005B)
+#define TPM_ORD_DisableOwnerClear ((UINT32)0x0000005C)
+#define TPM_ORD_ForceClear ((UINT32)0x0000005D)
+#define TPM_ORD_DisableForceClear ((UINT32)0x0000005E)
+#define TPM_ORD_GetCapabilitySigned ((UINT32)0x00000064)
+#define TPM_ORD_GetCapability ((UINT32)0x00000065)
+#define TPM_ORD_GetCapabilityOwner ((UINT32)0x00000066)
+#define TPM_ORD_OwnerSetDisable ((UINT32)0x0000006E)
+#define TPM_ORD_PhysicalEnable ((UINT32)0x0000006F)
+#define TPM_ORD_PhysicalDisable ((UINT32)0x00000070)
+#define TPM_ORD_SetOwnerInstall ((UINT32)0x00000071)
+#define TPM_ORD_PhysicalSetDeactivated ((UINT32)0x00000072)
+#define TPM_ORD_SetTempDeactivated ((UINT32)0x00000073)
+#define TPM_ORD_SetOperatorAuth ((UINT32)0x00000074)
+#define TPM_ORD_SetOwnerPointer ((UINT32)0x00000075)
+#define TPM_ORD_CreateEndorsementKeyPair ((UINT32)0x00000078)
+#define TPM_ORD_MakeIdentity ((UINT32)0x00000079)
+#define TPM_ORD_ActivateIdentity ((UINT32)0x0000007A)
+#define TPM_ORD_ReadPubek ((UINT32)0x0000007C)
+#define TPM_ORD_OwnerReadPubek ((UINT32)0x0000007D)
+#define TPM_ORD_DisablePubekRead ((UINT32)0x0000007E)
+#define TPM_ORD_CreateRevocableEK ((UINT32)0x0000007F)
+#define TPM_ORD_RevokeTrust ((UINT32)0x00000080)
+#define TPM_ORD_OwnerReadInternalPub ((UINT32)0x00000081)
+#define TPM_ORD_GetAuditEvent ((UINT32)0x00000082)
+#define TPM_ORD_GetAuditEventSigned ((UINT32)0x00000083)
+#define TPM_ORD_GetAuditDigest ((UINT32)0x00000085)
+#define TPM_ORD_GetAuditDigestSigned ((UINT32)0x00000086)
+#define TPM_ORD_GetOrdinalAuditStatus ((UINT32)0x0000008C)
+#define TPM_ORD_SetOrdinalAuditStatus ((UINT32)0x0000008D)
+#define TPM_ORD_Terminate_Handle ((UINT32)0x00000096)
+#define TPM_ORD_Init ((UINT32)0x00000097)
+#define TPM_ORD_SaveState ((UINT32)0x00000098)
+#define TPM_ORD_Startup ((UINT32)0x00000099)
+#define TPM_ORD_SetRedirection ((UINT32)0x0000009A)
+#define TPM_ORD_SHA1Start ((UINT32)0x000000A0)
+#define TPM_ORD_SHA1Update ((UINT32)0x000000A1)
+#define TPM_ORD_SHA1Complete ((UINT32)0x000000A2)
+#define TPM_ORD_SHA1CompleteExtend ((UINT32)0x000000A3)
+#define TPM_ORD_FieldUpgrade ((UINT32)0x000000AA)
+#define TPM_ORD_SaveKeyContext ((UINT32)0x000000B4)
+#define TPM_ORD_LoadKeyContext ((UINT32)0x000000B5)
+#define TPM_ORD_SaveAuthContext ((UINT32)0x000000B6)
+#define TPM_ORD_LoadAuthContext ((UINT32)0x000000B7)
+#define TPM_ORD_SaveContext ((UINT32)0x000000B8)
+#define TPM_ORD_LoadContext ((UINT32)0x000000B9)
+#define TPM_ORD_FlushSpecific ((UINT32)0x000000BA)
+#define TPM_ORD_PCR_Reset ((UINT32)0x000000C8)
+#define TPM_ORD_NV_DefineSpace ((UINT32)0x000000CC)
+#define TPM_ORD_NV_WriteValue ((UINT32)0x000000CD)
+#define TPM_ORD_NV_WriteValueAuth ((UINT32)0x000000CE)
+#define TPM_ORD_NV_ReadValue ((UINT32)0x000000CF)
+#define TPM_ORD_NV_ReadValueAuth ((UINT32)0x000000D0)
+#define TPM_ORD_Delegate_UpdateVerification ((UINT32)0x000000D1)
+#define TPM_ORD_Delegate_Manage ((UINT32)0x000000D2)
+#define TPM_ORD_Delegate_CreateKeyDelegation ((UINT32)0x000000D4)
+#define TPM_ORD_Delegate_CreateOwnerDelegation ((UINT32)0x000000D5)
+#define TPM_ORD_Delegate_VerifyDelegation ((UINT32)0x000000D6)
+#define TPM_ORD_Delegate_LoadOwnerDelegation ((UINT32)0x000000D8)
+#define TPM_ORD_Delegate_ReadTable ((UINT32)0x000000DB)
+#define TPM_ORD_CreateCounter ((UINT32)0x000000DC)
+#define TPM_ORD_IncrementCounter ((UINT32)0x000000DD)
+#define TPM_ORD_ReadCounter ((UINT32)0x000000DE)
+#define TPM_ORD_ReleaseCounter ((UINT32)0x000000DF)
+#define TPM_ORD_ReleaseCounterOwner ((UINT32)0x000000E0)
+#define TPM_ORD_EstablishTransport ((UINT32)0x000000E6)
+#define TPM_ORD_ExecuteTransport ((UINT32)0x000000E7)
+#define TPM_ORD_ReleaseTransportSigned ((UINT32)0x000000E8)
+#define TPM_ORD_GetTicks ((UINT32)0x000000F1)
+#define TPM_ORD_TickStampBlob ((UINT32)0x000000F2)
+
+#define TSC_ORD_PhysicalPresence ((UINT32)0x4000000A)
+#define TSC_ORD_ResetEstablishmentBit ((UINT32)0x4000000B)
+
+#endif // __TPM_ORDINAL_H__
diff --git a/src/include/tss/tspi.h b/src/include/tss/tspi.h
new file mode 100644
index 0000000..1d188f7
--- /dev/null
+++ b/src/include/tss/tspi.h
@@ -0,0 +1,1198 @@
+#if !defined(_TSPI_H_)
+#define _TSPI_H_
+
+#include <tss/tss_defines.h>
+#include <tss/tss_typedef.h>
+#include <tss/tss_structs.h>
+#include <tss/tss_error.h>
+#include <tss/tss_error_basics.h>
+
+#if !defined( TSPICALL )
+ #if !defined(WIN32) || defined (TSP_STATIC)
+ // Linux, or a Win32 static library
+ #define TSPICALL extern TSS_RESULT
+ #elif defined (TSPDLL_EXPORTS)
+ // Win32 DLL build
+ #define TSPICALL extern __declspec(dllexport) TSS_RESULT
+ #else
+ // Win32 DLL import
+ #define TSPICALL extern __declspec(dllimport) TSS_RESULT
+ #endif
+#endif /* TSPICALL */
+
+#if defined ( __cplusplus )
+extern "C" {
+#endif /* __cplusplus */
+
+
+// Class-independent ASN.1 conversion functions
+TSPICALL Tspi_EncodeDER_TssBlob
+(
+ UINT32 rawBlobSize, // in
+ BYTE* rawBlob, // in
+ UINT32 blobType, // in
+ UINT32* derBlobSize, // in, out
+ BYTE* derBlob // out
+);
+
+TSPICALL Tspi_DecodeBER_TssBlob
+(
+ UINT32 berBlobSize, // in
+ BYTE* berBlob, // in
+ UINT32* blobType, // out
+ UINT32* rawBlobSize, // in, out
+ BYTE* rawBlob // out
+);
+
+
+
+// Common Methods
+TSPICALL Tspi_SetAttribUint32
+(
+ TSS_HOBJECT hObject, // in
+ TSS_FLAG attribFlag, // in
+ TSS_FLAG subFlag, // in
+ UINT32 ulAttrib // in
+);
+
+TSPICALL Tspi_GetAttribUint32
+(
+ TSS_HOBJECT hObject, // in
+ TSS_FLAG attribFlag, // in
+ TSS_FLAG subFlag, // in
+ UINT32* pulAttrib // out
+);
+
+TSPICALL Tspi_SetAttribData
+(
+ TSS_HOBJECT hObject, // in
+ TSS_FLAG attribFlag, // in
+ TSS_FLAG subFlag, // in
+ UINT32 ulAttribDataSize, // in
+ BYTE* rgbAttribData // in
+);
+
+TSPICALL Tspi_GetAttribData
+(
+ TSS_HOBJECT hObject, // in
+ TSS_FLAG attribFlag, // in
+ TSS_FLAG subFlag, // in
+ UINT32* pulAttribDataSize, // out
+ BYTE** prgbAttribData // out
+);
+
+TSPICALL Tspi_ChangeAuth
+(
+ TSS_HOBJECT hObjectToChange, // in
+ TSS_HOBJECT hParentObject, // in
+ TSS_HPOLICY hNewPolicy // in
+);
+
+TSPICALL Tspi_ChangeAuthAsym
+(
+ TSS_HOBJECT hObjectToChange, // in
+ TSS_HOBJECT hParentObject, // in
+ TSS_HKEY hIdentKey, // in
+ TSS_HPOLICY hNewPolicy // in
+);
+
+TSPICALL Tspi_GetPolicyObject
+(
+ TSS_HOBJECT hObject, // in
+ TSS_FLAG policyType, // in
+ TSS_HPOLICY* phPolicy // out
+);
+
+
+
+// Tspi_Context Class Definitions
+TSPICALL Tspi_Context_Create
+(
+ TSS_HCONTEXT* phContext // out
+);
+
+TSPICALL Tspi_Context_Close
+(
+ TSS_HCONTEXT hContext // in
+);
+
+TSPICALL Tspi_Context_Connect
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_UNICODE* wszDestination // in
+);
+
+TSPICALL Tspi_Context_FreeMemory
+(
+ TSS_HCONTEXT hContext, // in
+ BYTE* rgbMemory // in
+);
+
+TSPICALL Tspi_Context_GetDefaultPolicy
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_HPOLICY* phPolicy // out
+);
+
+TSPICALL Tspi_Context_CreateObject
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG objectType, // in
+ TSS_FLAG initFlags, // in
+ TSS_HOBJECT* phObject // out
+);
+
+TSPICALL Tspi_Context_CloseObject
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_HOBJECT hObject // in
+);
+
+TSPICALL Tspi_Context_GetCapability
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG capArea, // in
+ UINT32 ulSubCapLength, // in
+ BYTE* rgbSubCap, // in
+ UINT32* pulRespDataLength, // out
+ BYTE** prgbRespData // out
+);
+
+TSPICALL Tspi_Context_GetTpmObject
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_HTPM* phTPM // out
+);
+
+TSPICALL Tspi_Context_SetTransEncryptionKey
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_HKEY hKey // in
+);
+
+TSPICALL Tspi_Context_CloseSignTransport
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_HKEY hSigningKey, // in
+ TSS_VALIDATION* pValidationData // in, out
+);
+
+TSPICALL Tspi_Context_LoadKeyByBlob
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_HKEY hUnwrappingKey, // in
+ UINT32 ulBlobLength, // in
+ BYTE* rgbBlobData, // in
+ TSS_HKEY* phKey // out
+);
+
+TSPICALL Tspi_Context_LoadKeyByUUID
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG persistentStorageType, // in
+ TSS_UUID uuidData, // in
+ TSS_HKEY* phKey // out
+);
+
+TSPICALL Tspi_Context_RegisterKey
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_HKEY hKey, // in
+ TSS_FLAG persistentStorageType, // in
+ TSS_UUID uuidKey, // in
+ TSS_FLAG persistentStorageTypeParent, // in
+ TSS_UUID uuidParentKey // in
+);
+
+TSPICALL Tspi_Context_UnregisterKey
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG persistentStorageType, // in
+ TSS_UUID uuidKey, // in
+ TSS_HKEY* phkey // out
+);
+
+TSPICALL Tspi_Context_GetKeyByUUID
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG persistentStorageType, // in
+ TSS_UUID uuidData, // in
+ TSS_HKEY* phKey // out
+);
+
+TSPICALL Tspi_Context_GetKeyByPublicInfo
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG persistentStorageType, // in
+ TSS_ALGORITHM_ID algID, // in
+ UINT32 ulPublicInfoLength, // in
+ BYTE* rgbPublicInfo, // in
+ TSS_HKEY* phKey // out
+);
+
+TSPICALL Tspi_Context_GetRegisteredKeysByUUID
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG persistentStorageType, // in
+ TSS_UUID* pUuidData, // in
+ UINT32* pulKeyHierarchySize, // out
+ TSS_KM_KEYINFO** ppKeyHierarchy // out
+);
+
+TSPICALL Tspi_Context_GetRegisteredKeysByUUID2
+(
+ TSS_HCONTEXT hContext, // in
+ TSS_FLAG persistentStorageType, // in
+ TSS_UUID* pUuidData, // in
+ UINT32* pulKeyHierarchySize, // out
+ TSS_KM_KEYINFO2** ppKeyHierarchy // out
+);
+
+
+// Policy class definitions
+TSPICALL Tspi_Policy_SetSecret
+(
+ TSS_HPOLICY hPolicy, // in
+ TSS_FLAG secretMode, // in
+ UINT32 ulSecretLength, // in
+ BYTE* rgbSecret // in
+);
+
+TSPICALL Tspi_Policy_FlushSecret
+(
+ TSS_HPOLICY hPolicy // in
+);
+
+TSPICALL Tspi_Policy_AssignToObject
+(
+ TSS_HPOLICY hPolicy, // in
+ TSS_HOBJECT hObject // in
+);
+
+
+
+// TPM Class Definitions
+TSPICALL Tspi_TPM_KeyControlOwner
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKey, // in
+ UINT32 attribName, // in
+ TSS_BOOL attribValue, // in
+ TSS_UUID* pUuidData // out
+);
+
+TSPICALL Tspi_TPM_CreateEndorsementKey
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKey, // in
+ TSS_VALIDATION* pValidationData // in, out
+);
+
+TSPICALL Tspi_TPM_CreateRevocableEndorsementKey
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKey, // in
+ TSS_VALIDATION* pValidationData, // in, out
+ UINT32* pulEkResetDataLength, // in, out
+ BYTE** rgbEkResetData // in, out
+);
+
+TSPICALL Tspi_TPM_RevokeEndorsementKey
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulEkResetDataLength, // in
+ BYTE* rgbEkResetData // in
+);
+
+TSPICALL Tspi_TPM_GetPubEndorsementKey
+(
+ TSS_HTPM hTPM, // in
+ TSS_BOOL fOwnerAuthorized, // in
+ TSS_VALIDATION* pValidationData, // in, out
+ TSS_HKEY* phEndorsementPubKey // out
+);
+
+TSPICALL Tspi_TPM_OwnerGetSRKPubKey
+(
+ TSS_HTPM hTPM, // in
+ UINT32* pulPubKeyLength, // out
+ BYTE** prgbPubKey // out
+);
+
+TSPICALL Tspi_TPM_TakeOwnership
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKeySRK, // in
+ TSS_HKEY hEndorsementPubKey // in
+);
+
+TSPICALL Tspi_TPM_ClearOwner
+(
+ TSS_HTPM hTPM, // in
+ TSS_BOOL fForcedClear // in
+);
+
+TSPICALL Tspi_TPM_CollateIdentityRequest
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKeySRK, // in
+ TSS_HKEY hCAPubKey, // in
+ UINT32 ulIdentityLabelLength, // in
+ BYTE* rgbIdentityLabelData, // in
+ TSS_HKEY hIdentityKey, // in
+ TSS_ALGORITHM_ID algID, // in
+ UINT32* pulTCPAIdentityReqLength, // out
+ BYTE** prgbTCPAIdentityReq // out
+);
+
+TSPICALL Tspi_TPM_ActivateIdentity
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hIdentKey, // in
+ UINT32 ulAsymCAContentsBlobLength, // in
+ BYTE* rgbAsymCAContentsBlob, // in
+ UINT32 ulSymCAAttestationBlobLength, // in
+ BYTE* rgbSymCAAttestationBlob, // in
+ UINT32* pulCredentialLength, // out
+ BYTE** prgbCredential // out
+);
+
+TSPICALL Tspi_TPM_CreateMaintenanceArchive
+(
+ TSS_HTPM hTPM, // in
+ TSS_BOOL fGenerateRndNumber, // in
+ UINT32* pulRndNumberLength, // out
+ BYTE** prgbRndNumber, // out
+ UINT32* pulArchiveDataLength, // out
+ BYTE** prgbArchiveData // out
+);
+
+TSPICALL Tspi_TPM_KillMaintenanceFeature
+(
+ TSS_HTPM hTPM // in
+);
+
+TSPICALL Tspi_TPM_LoadMaintenancePubKey
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hMaintenanceKey, // in
+ TSS_VALIDATION* pValidationData // in, out
+);
+
+TSPICALL Tspi_TPM_CheckMaintenancePubKey
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hMaintenanceKey, // in
+ TSS_VALIDATION* pValidationData // in, out
+);
+
+TSPICALL Tspi_TPM_SetOperatorAuth
+(
+ TSS_HTPM hTPM, // in
+ TSS_HPOLICY hOperatorPolicy // in
+);
+
+TSPICALL Tspi_TPM_SetStatus
+(
+ TSS_HTPM hTPM, // in
+ TSS_FLAG statusFlag, // in
+ TSS_BOOL fTpmState // in
+);
+
+TSPICALL Tspi_TPM_GetStatus
+(
+ TSS_HTPM hTPM, // in
+ TSS_FLAG statusFlag, // in
+ TSS_BOOL* pfTpmState // out
+);
+
+TSPICALL Tspi_TPM_GetCapability
+(
+ TSS_HTPM hTPM, // in
+ TSS_FLAG capArea, // in
+ UINT32 ulSubCapLength, // in
+ BYTE* rgbSubCap, // in
+ UINT32* pulRespDataLength, // out
+ BYTE** prgbRespData // out
+);
+
+TSPICALL Tspi_TPM_GetCapabilitySigned
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKey, // in
+ TSS_FLAG capArea, // in
+ UINT32 ulSubCapLength, // in
+ BYTE* rgbSubCap, // in
+ TSS_VALIDATION* pValidationData, // in, out
+ UINT32* pulRespDataLength, // out
+ BYTE** prgbRespData // out
+);
+
+TSPICALL Tspi_TPM_SelfTestFull
+(
+ TSS_HTPM hTPM // in
+);
+
+TSPICALL Tspi_TPM_CertifySelfTest
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKey, // in
+ TSS_VALIDATION* pValidationData // in, out
+);
+
+TSPICALL Tspi_TPM_GetTestResult
+(
+ TSS_HTPM hTPM, // in
+ UINT32* pulTestResultLength, // out
+ BYTE** prgbTestResult // out
+);
+
+TSPICALL Tspi_TPM_GetRandom
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulRandomDataLength, // in
+ BYTE** prgbRandomData // out
+);
+
+TSPICALL Tspi_TPM_StirRandom
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulEntropyDataLength, // in
+ BYTE* rgbEntropyData // in
+);
+
+TSPICALL Tspi_TPM_GetEvent
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulPcrIndex, // in
+ UINT32 ulEventNumber, // in
+ TSS_PCR_EVENT* pPcrEvent // out
+);
+
+TSPICALL Tspi_TPM_GetEvents
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulPcrIndex, // in
+ UINT32 ulStartNumber, // in
+ UINT32* pulEventNumber, // in, out
+ TSS_PCR_EVENT** prgPcrEvents // out
+);
+
+TSPICALL Tspi_TPM_GetEventLog
+(
+ TSS_HTPM hTPM, // in
+ UINT32* pulEventNumber, // out
+ TSS_PCR_EVENT** prgPcrEvents // out
+);
+
+TSPICALL Tspi_TPM_Quote
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hIdentKey, // in
+ TSS_HPCRS hPcrComposite, // in
+ TSS_VALIDATION* pValidationData // in, out
+);
+
+TSPICALL Tspi_TPM_Quote2
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hIdentKey, // in
+ TSS_BOOL fAddVersion, // in
+ TSS_HPCRS hPcrComposite, // in
+ TSS_VALIDATION* pValidationData, // in, out
+ UINT32* versionInfoSize, // out
+ BYTE** versionInfo // out
+);
+
+TSPICALL Tspi_TPM_PcrExtend
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulPcrIndex, // in
+ UINT32 ulPcrDataLength, // in
+ BYTE* pbPcrData, // in
+ TSS_PCR_EVENT* pPcrEvent, // in
+ UINT32* pulPcrValueLength, // out
+ BYTE** prgbPcrValue // out
+);
+
+TSPICALL Tspi_TPM_PcrRead
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulPcrIndex, // in
+ UINT32* pulPcrValueLength, // out
+ BYTE** prgbPcrValue // out
+);
+
+TSPICALL Tspi_TPM_PcrReset
+(
+ TSS_HTPM hTPM, // in
+ TSS_HPCRS hPcrComposite // in
+);
+
+TSPICALL Tspi_TPM_AuthorizeMigrationTicket
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hMigrationKey, // in
+ TSS_MIGRATE_SCHEME migrationScheme, // in
+ UINT32* pulMigTicketLength, // out
+ BYTE** prgbMigTicket // out
+);
+
+TSPICALL Tspi_TPM_CMKSetRestrictions
+(
+ TSS_HTPM hTPM, // in
+ TSS_CMK_DELEGATE CmkDelegate // in
+);
+
+TSPICALL Tspi_TPM_CMKApproveMA
+(
+ TSS_HTPM hTPM, // in
+ TSS_HMIGDATA hMaAuthData // in
+);
+
+TSPICALL Tspi_TPM_CMKCreateTicket
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hVerifyKey, // in
+ TSS_HMIGDATA hSigData // in
+);
+
+TSPICALL Tspi_TPM_ReadCounter
+(
+ TSS_HTPM hTPM, // in
+ UINT32* counterValue // out
+);
+
+TSPICALL Tspi_TPM_ReadCurrentTicks
+(
+ TSS_HTPM hTPM, // in
+ TPM_CURRENT_TICKS* tickCount // out
+);
+
+TSPICALL Tspi_TPM_DirWrite
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulDirIndex, // in
+ UINT32 ulDirDataLength, // in
+ BYTE* rgbDirData // in
+);
+
+TSPICALL Tspi_TPM_DirRead
+(
+ TSS_HTPM hTPM, // in
+ UINT32 ulDirIndex, // in
+ UINT32* pulDirDataLength, // out
+ BYTE** prgbDirData // out
+);
+
+TSPICALL Tspi_TPM_Delegate_AddFamily
+(
+ TSS_HTPM hTPM, // in, must not be NULL
+ BYTE bLabel, // in
+ TSS_HDELFAMILY* phFamily // out
+);
+
+TSPICALL Tspi_TPM_Delegate_GetFamily
+(
+ TSS_HTPM hTPM, // in, must not NULL
+ UINT32 ulFamilyID, // in
+ TSS_HDELFAMILY* phFamily // out
+);
+
+TSPICALL Tspi_TPM_Delegate_InvalidateFamily
+(
+ TSS_HTPM hTPM, // in, must not be NULL
+ TSS_HDELFAMILY hFamily // in
+);
+
+TSPICALL Tspi_TPM_Delegate_CreateDelegation
+(
+ TSS_HOBJECT hObject, // in
+ BYTE bLabel, // in
+ UINT32 ulFlags, // in
+ TSS_HPCRS hPcr, // in, may be NULL
+ TSS_HDELFAMILY hFamily, // in
+ TSS_HPOLICY hDelegation // in, out
+);
+
+TSPICALL Tspi_TPM_Delegate_CacheOwnerDelegation
+(
+ TSS_HTPM hTPM, // in, must not be NULL
+ TSS_HPOLICY hDelegation, // in, out
+ UINT32 ulIndex, // in
+ UINT32 ulFlags // in
+);
+
+TSPICALL Tspi_TPM_Delegate_UpdateVerificationCount
+(
+ TSS_HTPM hTPM, // in
+ TSS_HPOLICY hDelegation // in, out
+);
+
+TSPICALL Tspi_TPM_Delegate_VerifyDelegation
+(
+ TSS_HPOLICY hDelegation // in, out
+);
+
+TSPICALL Tspi_TPM_Delegate_ReadTables
+(
+ TSS_HCONTEXT hContext, // in
+ UINT32* pulFamilyTableSize, // out
+ TSS_FAMILY_TABLE_ENTRY** ppFamilyTable, // out
+ UINT32* pulDelegateTableSize, // out
+ TSS_DELEGATION_TABLE_ENTRY** ppDelegateTable // out
+);
+
+TSPICALL Tspi_TPM_DAA_JoinInit
+(
+ TSS_HTPM hTPM, // in
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ UINT32 daaCounter, // in
+ UINT32 issuerAuthPKsLength, // in
+ TSS_HKEY* issuerAuthPKs, // in
+ UINT32 issuerAuthPKSignaturesLength, // in
+ UINT32 issuerAuthPKSignaturesLength2, // in
+ BYTE** issuerAuthPKSignatures, // in
+ UINT32* capitalUprimeLength, // out
+ BYTE** capitalUprime, // out
+ TSS_DAA_IDENTITY_PROOF** identityProof, // out
+ UINT32* joinSessionLength, // out
+ BYTE** joinSession // out
+);
+
+TSPICALL Tspi_TPM_DAA_JoinCreateDaaPubKey
+(
+ TSS_HTPM hTPM, // in
+ TSS_HDAA_CREDENTIAL hDAACredential, // in
+ UINT32 authenticationChallengeLength, // in
+ BYTE* authenticationChallenge, // in
+ UINT32 nonceIssuerLength, // in
+ BYTE* nonceIssuer, // in
+ UINT32 attributesPlatformLength, // in
+ UINT32 attributesPlatformLength2, // in
+ BYTE** attributesPlatform, // in
+ UINT32 joinSessionLength, // in
+ BYTE* joinSession, // in
+ TSS_DAA_CREDENTIAL_REQUEST** credentialRequest // out
+);
+
+TSPICALL Tspi_TPM_DAA_JoinStoreCredential
+(
+ TSS_HTPM hTPM, // in
+ TSS_HDAA_CREDENTIAL hDAACredential, // in
+ TSS_DAA_CRED_ISSUER* credIssuer, // in
+ UINT32 joinSessionLength, // in
+ BYTE* joinSession // in
+);
+
+TSPICALL Tspi_TPM_DAA_Sign
+(
+ TSS_HTPM hTPM, // in
+ TSS_HDAA_CREDENTIAL hDAACredential, // in
+ TSS_HDAA_ARA_KEY hARAKey, // in
+ TSS_DAA_SELECTED_ATTRIB* revealAttributes, // in
+ UINT32 verifierNonceLength, // in
+ BYTE* verifierNonce, // in
+ UINT32 verifierBaseNameLength, // in
+ BYTE* verifierBaseName, // in
+ TSS_HOBJECT signData, // in
+ TSS_DAA_SIGNATURE** daaSignature // out
+);
+
+TSPICALL Tspi_TPM_GetAuditDigest
+(
+ TSS_HTPM hTPM, // in
+ TSS_HKEY hKey, // in
+ TSS_BOOL closeAudit, // in
+ UINT32* pulAuditDigestSize, // out
+ BYTE** prgbAuditDigest, // out
+ TPM_COUNTER_VALUE* pCounterValue, // out
+ TSS_VALIDATION* pValidationData, // out
+ UINT32* ordSize, // out
+ UINT32** ordList // out
+);
+
+
+
+// PcrComposite Class Definitions
+TSPICALL Tspi_PcrComposite_SelectPcrIndex
+(
+ TSS_HPCRS hPcrComposite, // in
+ UINT32 ulPcrIndex // in
+);
+
+TSPICALL Tspi_PcrComposite_SelectPcrIndexEx
+(
+ TSS_HPCRS hPcrComposite, // in
+ UINT32 ulPcrIndex, // in
+ UINT32 direction // in
+);
+
+TSPICALL Tspi_PcrComposite_SetPcrValue
+(
+ TSS_HPCRS hPcrComposite, // in
+ UINT32 ulPcrIndex, // in
+ UINT32 ulPcrValueLength, // in
+ BYTE* rgbPcrValue // in
+);
+
+TSPICALL Tspi_PcrComposite_GetPcrValue
+(
+ TSS_HPCRS hPcrComposite, // in
+ UINT32 ulPcrIndex, // in
+ UINT32* pulPcrValueLength, // out
+ BYTE** prgbPcrValue // out
+);
+
+TSPICALL Tspi_PcrComposite_SetPcrLocality
+(
+ TSS_HPCRS hPcrComposite, // in
+ UINT32 LocalityValue // in
+);
+
+TSPICALL Tspi_PcrComposite_GetPcrLocality
+(
+ TSS_HPCRS hPcrComposite, // in
+ UINT32* pLocalityValue // out
+);
+
+TSPICALL Tspi_PcrComposite_GetCompositeHash
+(
+ TSS_HPCRS hPcrComposite, // in
+ UINT32* pLen, // in
+ BYTE** ppbHashData // out
+);
+
+
+
+// Key Class Definition
+TSPICALL Tspi_Key_LoadKey
+(
+ TSS_HKEY hKey, // in
+ TSS_HKEY hUnwrappingKey // in
+);
+
+TSPICALL Tspi_Key_UnloadKey
+(
+ TSS_HKEY hKey // in
+);
+
+TSPICALL Tspi_Key_GetPubKey
+(
+ TSS_HKEY hKey, // in
+ UINT32* pulPubKeyLength, // out
+ BYTE** prgbPubKey // out
+);
+
+TSPICALL Tspi_Key_CertifyKey
+(
+ TSS_HKEY hKey, // in
+ TSS_HKEY hCertifyingKey, // in
+ TSS_VALIDATION* pValidationData // in, out
+);
+
+TSPICALL Tspi_Key_CreateKey
+(
+ TSS_HKEY hKey, // in
+ TSS_HKEY hWrappingKey, // in
+ TSS_HPCRS hPcrComposite // in, may be NULL
+);
+
+TSPICALL Tspi_Key_WrapKey
+(
+ TSS_HKEY hKey, // in
+ TSS_HKEY hWrappingKey, // in
+ TSS_HPCRS hPcrComposite // in, may be NULL
+);
+
+TSPICALL Tspi_Key_CreateMigrationBlob
+(
+ TSS_HKEY hKeyToMigrate, // in
+ TSS_HKEY hParentKey, // in
+ UINT32 ulMigTicketLength, // in
+ BYTE* rgbMigTicket, // in
+ UINT32* pulRandomLength, // out
+ BYTE** prgbRandom, // out
+ UINT32* pulMigrationBlobLength, // out
+ BYTE** prgbMigrationBlob // out
+);
+
+TSPICALL Tspi_Key_ConvertMigrationBlob
+(
+ TSS_HKEY hKeyToMigrate, // in
+ TSS_HKEY hParentKey, // in
+ UINT32 ulRandomLength, // in
+ BYTE* rgbRandom, // in
+ UINT32 ulMigrationBlobLength, // in
+ BYTE* rgbMigrationBlob // in
+);
+
+TSPICALL Tspi_Key_MigrateKey
+(
+ TSS_HKEY hMaKey, // in
+ TSS_HKEY hPublicKey, // in
+ TSS_HKEY hMigData // in
+);
+
+TSPICALL Tspi_Key_CMKCreateBlob
+(
+ TSS_HKEY hKeyToMigrate, // in
+ TSS_HKEY hParentKey, // in
+ TSS_HMIGDATA hMigrationData, // in
+ UINT32* pulRandomLength, // out
+ BYTE** prgbRandom // out
+);
+
+TSPICALL Tspi_Key_CMKConvertMigration
+(
+ TSS_HKEY hKeyToMigrate, // in
+ TSS_HKEY hParentKey, // in
+ TSS_HMIGDATA hMigrationData, // in
+ UINT32 ulRandomLength, // in
+ BYTE* rgbRandom // in
+);
+
+
+
+// Hash Class Definition
+TSPICALL Tspi_Hash_Sign
+(
+ TSS_HHASH hHash, // in
+ TSS_HKEY hKey, // in
+ UINT32* pulSignatureLength, // out
+ BYTE** prgbSignature // out
+);
+
+TSPICALL Tspi_Hash_VerifySignature
+(
+ TSS_HHASH hHash, // in
+ TSS_HKEY hKey, // in
+ UINT32 ulSignatureLength, // in
+ BYTE* rgbSignature // in
+);
+
+TSPICALL Tspi_Hash_SetHashValue
+(
+ TSS_HHASH hHash, // in
+ UINT32 ulHashValueLength, // in
+ BYTE* rgbHashValue // in
+);
+
+TSPICALL Tspi_Hash_GetHashValue
+(
+ TSS_HHASH hHash, // in
+ UINT32* pulHashValueLength, // out
+ BYTE** prgbHashValue // out
+);
+
+TSPICALL Tspi_Hash_UpdateHashValue
+(
+ TSS_HHASH hHash, // in
+ UINT32 ulDataLength, // in
+ BYTE* rgbData // in
+);
+
+TSPICALL Tspi_Hash_TickStampBlob
+(
+ TSS_HHASH hHash, // in
+ TSS_HKEY hIdentKey, // in
+ TSS_VALIDATION* pValidationData // in
+);
+
+
+
+// EncData Class Definition
+TSPICALL Tspi_Data_Bind
+(
+ TSS_HENCDATA hEncData, // in
+ TSS_HKEY hEncKey, // in
+ UINT32 ulDataLength, // in
+ BYTE* rgbDataToBind // in
+);
+
+TSPICALL Tspi_Data_Unbind
+(
+ TSS_HENCDATA hEncData, // in
+ TSS_HKEY hKey, // in
+ UINT32* pulUnboundDataLength, // out
+ BYTE** prgbUnboundData // out
+);
+
+TSPICALL Tspi_Data_Seal
+(
+ TSS_HENCDATA hEncData, // in
+ TSS_HKEY hEncKey, // in
+ UINT32 ulDataLength, // in
+ BYTE* rgbDataToSeal, // in
+ TSS_HPCRS hPcrComposite // in
+);
+
+TSPICALL Tspi_Data_Unseal
+(
+ TSS_HENCDATA hEncData, // in
+ TSS_HKEY hKey, // in
+ UINT32* pulUnsealedDataLength, // out
+ BYTE** prgbUnsealedData // out
+);
+
+
+
+// NV Class Definition
+TSPICALL Tspi_NV_DefineSpace
+(
+ TSS_HNVSTORE hNVStore, // in
+ TSS_HPCRS hReadPcrComposite, // in, may be NULL
+ TSS_HPCRS hWritePcrComposite // in, may be NULL
+);
+
+TSPICALL Tspi_NV_ReleaseSpace
+(
+ TSS_HNVSTORE hNVStore // in
+);
+
+TSPICALL Tspi_NV_WriteValue
+(
+ TSS_HNVSTORE hNVStore, // in
+ UINT32 offset, // in
+ UINT32 ulDataLength, // in
+ BYTE* rgbDataToWrite // in
+);
+
+TSPICALL Tspi_NV_ReadValue
+(
+ TSS_HNVSTORE hNVStore, // in
+ UINT32 offset, // in
+ UINT32* ulDataLength, // in, out
+ BYTE** rgbDataRead // out
+);
+
+
+// DAA Utility functions (optional, do not require a TPM or TCS)
+TSPICALL Tspi_DAA_IssuerKeyVerify
+(
+ TSS_HDAA_CREDENTIAL hDAACredential, // in
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ TSS_BOOL* isCorrect // out
+);
+
+TSPICALL Tspi_DAA_Issuer_GenerateKey
+(
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ UINT32 issuerBaseNameLength, // in
+ BYTE* issuerBaseName // in
+);
+
+TSPICALL Tspi_DAA_Issuer_InitCredential
+(
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ TSS_HKEY issuerAuthPK, // in
+ TSS_DAA_IDENTITY_PROOF* identityProof, // in
+ UINT32 capitalUprimeLength, // in
+ BYTE* capitalUprime, // in
+ UINT32 daaCounter, // in
+ UINT32* nonceIssuerLength, // out
+ BYTE** nonceIssuer, // out
+ UINT32* authenticationChallengeLength, // out
+ BYTE** authenticationChallenge, // out
+ UINT32* joinSessionLength, // out
+ BYTE** joinSession // out
+);
+
+TSPICALL Tspi_DAA_Issuer_IssueCredential
+(
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ TSS_DAA_CREDENTIAL_REQUEST* credentialRequest, // in
+ UINT32 issuerJoinSessionLength, // in
+ BYTE* issuerJoinSession, // in
+ TSS_DAA_CRED_ISSUER** credIssuer // out
+);
+
+TSPICALL Tspi_DAA_Verifier_Init
+(
+ TSS_HDAA_CREDENTIAL hDAACredential, // in
+ UINT32* nonceVerifierLength, // out
+ BYTE** nonceVerifier, // out
+ UINT32* baseNameLength, // out
+ BYTE** baseName // out
+);
+
+TSPICALL Tspi_DAA_VerifySignature
+(
+ TSS_HDAA_CREDENTIAL hDAACredential, // in
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ TSS_HDAA_ARA_KEY hARAKey, // in
+ TSS_HHASH hARACondition, // in
+ UINT32 attributesLength, // in
+ UINT32 attributesLength2, // in
+ BYTE** attributes, // in
+ UINT32 verifierNonceLength, // in
+ BYTE* verifierNonce, // in
+ UINT32 verifierBaseNameLength, // in
+ BYTE* verifierBaseName, // in
+ TSS_HOBJECT signData, // in
+ TSS_DAA_SIGNATURE* daaSignature, // in
+ TSS_BOOL* isCorrect // out
+);
+
+TSPICALL Tspi_DAA_ARA_GenerateKey
+(
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ TSS_HDAA_ARA_KEY hARAKey // in
+);
+
+TSPICALL Tspi_DAA_ARA_RevokeAnonymity
+(
+ TSS_HDAA_ARA_KEY hARAKey, // in
+ TSS_HHASH hARACondition, // in
+ TSS_HDAA_ISSUER_KEY hIssuerKey, // in
+ TSS_DAA_PSEUDONYM_ENCRYPTED* encryptedPseudonym, // in
+ TSS_DAA_PSEUDONYM_PLAIN** pseudonym // out
+);
+
+
+
+// Callback typedefs
+typedef TSS_RESULT (*Tspicb_CallbackHMACAuth)
+(
+ PVOID lpAppData, // in
+ TSS_HOBJECT hAuthorizedObject, // in
+ TSS_BOOL ReturnOrVerify, // in
+ UINT32 ulPendingFunction, // in
+ TSS_BOOL ContinueUse, // in
+ UINT32 ulSizeNonces, // in
+ BYTE* rgbNonceEven, // in
+ BYTE* rgbNonceOdd, // in
+ BYTE* rgbNonceEvenOSAP, // in
+ BYTE* rgbNonceOddOSAP, // in
+ UINT32 ulSizeDigestHmac, // in
+ BYTE* rgbParamDigest, // in
+ BYTE* rgbHmacData // in, out
+);
+
+typedef TSS_RESULT (*Tspicb_CallbackXorEnc)
+(
+ PVOID lpAppData, // in
+ TSS_HOBJECT hOSAPObject, // in
+ TSS_HOBJECT hObject, // in
+ TSS_FLAG PurposeSecret, // in
+ UINT32 ulSizeNonces, // in
+ BYTE* rgbNonceEven, // in
+ BYTE* rgbNonceOdd, // in
+ BYTE* rgbNonceEvenOSAP, // in
+ BYTE* rgbNonceOddOSAP, // in
+ UINT32 ulSizeEncAuth, // in
+ BYTE* rgbEncAuthUsage, // out
+ BYTE* rgbEncAuthMigration // out
+);
+
+typedef TSS_RESULT (*Tspicb_CallbackTakeOwnership)
+(
+ PVOID lpAppData, // in
+ TSS_HOBJECT hObject, // in
+ TSS_HKEY hObjectPubKey, // in
+ UINT32 ulSizeEncAuth, // in
+ BYTE* rgbEncAuth // out
+);
+
+typedef TSS_RESULT (*Tspicb_CallbackSealxMask)
+(
+ PVOID lpAppData, // in
+ TSS_HKEY hKey, // in
+ TSS_HENCDATA hEncData, // in
+ TSS_ALGORITHM_ID algID, // in
+ UINT32 ulSizeNonces, // in
+ BYTE* rgbNonceEven, // in
+ BYTE* rgbNonceOdd, // in
+ BYTE* rgbNonceEvenOSAP, // in
+ BYTE* rgbNonceOddOSAP, // in
+ UINT32 ulDataLength, // in
+ BYTE* rgbDataToMask, // in
+ BYTE* rgbMaskedData // out
+);
+
+typedef TSS_RESULT (*Tspicb_CallbackChangeAuthAsym)
+(
+ PVOID lpAppData, // in
+ TSS_HOBJECT hObject, // in
+ TSS_HKEY hObjectPubKey, // in
+ UINT32 ulSizeEncAuth, // in
+ UINT32 ulSizeAuthLink, // in
+ BYTE* rgbEncAuth, // out
+ BYTE* rgbAuthLink // out
+);
+
+typedef TSS_RESULT (*Tspicb_CollateIdentity)
+(
+ PVOID lpAppData, // in
+ UINT32 ulTCPAPlainIdentityProofLength, // in
+ BYTE* rgbTCPAPlainIdentityProof, // in
+ TSS_ALGORITHM_ID algID, // in
+ UINT32 ulSessionKeyLength, // out
+ BYTE* rgbSessionKey, // out
+ UINT32* pulTCPAIdentityProofLength, // out
+ BYTE* rgbTCPAIdentityProof // out
+);
+
+
+typedef TSS_RESULT (*Tspicb_ActivateIdentity)
+(
+ PVOID lpAppData, // in
+ UINT32 ulSessionKeyLength, // in
+ BYTE* rgbSessionKey, // in
+ UINT32 ulSymCAAttestationBlobLength, // in
+ BYTE* rgbSymCAAttestationBlob, // in
+ UINT32* pulCredentialLength, // out
+ BYTE* rgbCredential // out
+);
+
+
+typedef TSS_RESULT (*Tspicb_DAA_Sign)
+(
+ PVOID lpAppData, // in
+ TSS_HDAA_ISSUER_KEY daaPublicKey, // in
+ UINT32 gammasLength, // in
+ BYTE** gammas, // in
+ UINT32 attributesLength, // in
+ BYTE** attributes, // in
+ UINT32 randomAttributesLength, // in
+ BYTE** randomAttributes, // in
+ UINT32 attributeCommitmentsLength,// in
+ TSS_DAA_ATTRIB_COMMIT* attributeCommitments, // in
+ TSS_DAA_ATTRIB_COMMIT* attributeCommitmentsProof, // in
+ TSS_DAA_PSEUDONYM_PLAIN* pseudonym, // in
+ TSS_DAA_PSEUDONYM_PLAIN* pseudonymTilde, // in
+ TSS_DAA_PSEUDONYM_ENCRYPTED* pseudonymEncrypted, // in
+ TSS_DAA_PSEUDONYM_ENCRYPTED* pseudonymEncProof, // in
+ TSS_DAA_SIGN_CALLBACK** additionalProof // out
+);
+
+typedef TSS_RESULT (*Tspicb_DAA_VerifySignature)
+(
+ PVOID lpAppData, // in
+ UINT32 challengeLength, // in
+ BYTE* challenge, // in
+ TSS_DAA_SIGN_CALLBACK* additionalProof, // in
+ TSS_HDAA_ISSUER_KEY daaPublicKey, // in
+ UINT32 gammasLength, // in
+ BYTE** gammas, // in
+ UINT32 sAttributesLength, // in
+ BYTE** sAttributes, // in
+ UINT32 attributeCommitmentsLength,// in
+ TSS_DAA_ATTRIB_COMMIT* attributeCommitments, // in
+ TSS_DAA_ATTRIB_COMMIT* attributeCommitmentsProof, // in
+ UINT32 zetaLength, // in
+ BYTE* zeta, // in
+ UINT32 sFLength, // in
+ BYTE* sF, // in
+ TSS_DAA_PSEUDONYM* pseudonym, // in
+ TSS_DAA_PSEUDONYM* pseudonymProof, // in
+ TSS_BOOL* isCorrect // out
+);
+
+
+#if defined ( __cplusplus )
+}
+#endif /* __cplusplus */
+
+
+#endif /* _TSPI_H_ */
diff --git a/src/include/tss/tss_defines.h b/src/include/tss/tss_defines.h
new file mode 100644
index 0000000..a525a6a
--- /dev/null
+++ b/src/include/tss/tss_defines.h
@@ -0,0 +1,1288 @@
+/*++
+
+Global defines for TSS.
+
+--*/
+
+#ifndef __TSS_DEFINES_H__
+#define __TSS_DEFINES_H__
+
+#include <tss/platform.h>
+#include <tss/tpm.h>
+
+
+//////////////////////////////////////////////////////////////////////////
+// Object types:
+//////////////////////////////////////////////////////////////////////////
+
+//
+// definition of the object types that can be created via CreateObject
+//
+#define TSS_OBJECT_TYPE_POLICY (0x01) // Policy object
+#define TSS_OBJECT_TYPE_RSAKEY (0x02) // RSA-Key object
+#define TSS_OBJECT_TYPE_ENCDATA (0x03) // Encrypted data object
+#define TSS_OBJECT_TYPE_PCRS (0x04) // PCR composite object
+#define TSS_OBJECT_TYPE_HASH (0x05) // Hash object
+#define TSS_OBJECT_TYPE_DELFAMILY (0x06) // Delegation Family object
+#define TSS_OBJECT_TYPE_NV (0x07) // NV object
+#define TSS_OBJECT_TYPE_MIGDATA (0x08) // CMK Migration data object
+#define TSS_OBJECT_TYPE_DAA_CERTIFICATE (0x09) // DAA credential
+#define TSS_OBJECT_TYPE_DAA_ISSUER_KEY (0x0a) // DAA cred. issuer keypair
+#define TSS_OBJECT_TYPE_DAA_ARA_KEY (0x0b) // DAA anonymity revocation
+ // authority keypair
+
+
+//////////////////////////////////////////////////////////////////////////
+// CreateObject: Flags
+//////////////////////////////////////////////////////////////////////////
+
+
+//************************************
+// Flags for creating RSAKEY object: *
+//************************************
+
+//
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+// |x x|Auth
+// |x| Volatility
+// |x| Migration
+// |x x x x| Type
+// |x x x x| Size
+// |x x| CMK
+// |x x x| Version
+// |0 0 0 0 0 0 0 0 0| Reserved
+// |x x x x x x| Fixed Type
+//
+
+// Authorization:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// Never |0 0|
+// Always |0 1|
+// Private key always |1 0|
+//
+#define TSS_KEY_NO_AUTHORIZATION (0x00000000) // no auth needed
+ // for this key
+#define TSS_KEY_AUTHORIZATION (0x00000001) // key needs auth
+ // for all ops
+#define TSS_KEY_AUTHORIZATION_PRIV_USE_ONLY (0x00000002) // key needs auth
+ // for privkey ops,
+ // noauth for pubkey
+
+//
+// Volatility
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// Non Volatile |0|
+// Volatile |1|
+//
+#define TSS_KEY_NON_VOLATILE (0x00000000) // Key is non-volatile
+#define TSS_KEY_VOLATILE (0x00000004) // Key is volatile
+
+//
+// Migration
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// Non Migratable |0|
+// Migratable |1|
+//
+#define TSS_KEY_NOT_MIGRATABLE (0x00000000) // key is not migratable
+#define TSS_KEY_MIGRATABLE (0x00000008) // key is migratable
+
+//
+// Usage
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// Default (Legacy) |0 0 0 0|
+// Signing |0 0 0 1|
+// Storage |0 0 1 0|
+// Identity |0 0 1 1|
+// AuthChange |0 1 0 0|
+// Bind |0 1 0 1|
+// Legacy |0 1 1 0|
+//
+#define TSS_KEY_TYPE_DEFAULT (0x00000000) // indicate a default key
+ // (Legacy-Key)
+#define TSS_KEY_TYPE_SIGNING (0x00000010) // indicate a signing key
+#define TSS_KEY_TYPE_STORAGE (0x00000020) // used as storage key
+#define TSS_KEY_TYPE_IDENTITY (0x00000030) // indicate an idendity key
+#define TSS_KEY_TYPE_AUTHCHANGE (0x00000040) // indicate an ephemeral key
+#define TSS_KEY_TYPE_BIND (0x00000050) // indicate a key for TPM_Bind
+#define TSS_KEY_TYPE_LEGACY (0x00000060) // indicate a key that can
+ // perform signing and binding
+#define TSS_KEY_TYPE_MIGRATE (0x00000070) // indicate a key that can
+ // act as a CMK MA
+#define TSS_KEY_TYPE_BITMASK (0x000000F0) // mask to extract key type
+
+//
+// Key size
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// DEFAULT |0 0 0 0|
+// 512 |0 0 0 1|
+// 1024 |0 0 1 0|
+// 2048 |0 0 1 1|
+// 4096 |0 1 0 0|
+// 8192 |0 1 0 1|
+// 16384 |0 1 1 0|
+//
+#define TSS_KEY_SIZE_DEFAULT (UINT32)(0x00000000) // indicate tpm-specific size
+#define TSS_KEY_SIZE_512 (UINT32)(0x00000100) // indicate a 512-bit key
+#define TSS_KEY_SIZE_1024 (UINT32)(0x00000200) // indicate a 1024-bit key
+#define TSS_KEY_SIZE_2048 (UINT32)(0x00000300) // indicate a 2048-bit key
+#define TSS_KEY_SIZE_4096 (UINT32)(0x00000400) // indicate a 4096-bit key
+#define TSS_KEY_SIZE_8192 (UINT32)(0x00000500) // indicate a 8192-bit key
+#define TSS_KEY_SIZE_16384 (UINT32)(0x00000600) // indicate a 16384-bit key
+#define TSS_KEY_SIZE_BITMASK (UINT32)(0x00000F00) // mask to extract key size
+
+//
+// Certified Migratability
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// DEFAULT |0 0|
+// Not Certified Migratable |0 0|
+// Certified Migratable |0 1|
+//
+#define TSS_KEY_NOT_CERTIFIED_MIGRATABLE (UINT32)(0x00000000)
+#define TSS_KEY_CERTIFIED_MIGRATABLE (UINT32)(0x00001000)
+
+//
+// Specification version
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// Context default |0 0 0|
+// TPM_KEY 1.1b key |0 0 1|
+// TPM_KEY12 1.2 key |0 1 0|
+//
+#define TSS_KEY_STRUCT_DEFAULT (UINT32)(0x00000000)
+#define TSS_KEY_STRUCT_KEY (UINT32)(0x00004000)
+#define TSS_KEY_STRUCT_KEY12 (UINT32)(0x00008000)
+#define TSS_KEY_STRUCT_BITMASK (UINT32)(0x0001C000)
+
+
+//
+// fixed KeyTypes (templates)
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// |0 0 0 0 0 0| Empty Key
+// |0 0 0 0 0 1| Storage Root Key
+//
+#define TSS_KEY_EMPTY_KEY (0x00000000) // no TPM key template
+ // (empty TSP key object)
+#define TSS_KEY_TSP_SRK (0x04000000) // use a TPM SRK template
+ // (TSP key object for SRK)
+#define TSS_KEY_TEMPLATE_BITMASK (0xFC000000) // bitmask to extract key
+ // template
+
+
+//*************************************
+// Flags for creating ENCDATA object: *
+//*************************************
+
+//
+// Type
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// Seal |0 0 1|
+// Bind |0 1 0|
+// Legacy |0 1 1|
+//
+// ENCDATA Reserved:
+// |x x x x x x x x x x x x x x x x x x x x x x x x x x x x x|
+//
+#define TSS_ENCDATA_SEAL (0x00000001) // data for seal operation
+#define TSS_ENCDATA_BIND (0x00000002) // data for bind operation
+#define TSS_ENCDATA_LEGACY (0x00000003) // data for legacy bind operation
+
+
+//**********************************
+// Flags for creating HASH object: *
+//**********************************
+
+//
+// Algorithm
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// DEFAULT
+// |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|
+// SHA1
+// |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1|
+// OTHER
+// |1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1|
+//
+#define TSS_HASH_DEFAULT (0x00000000) // Default hash algorithm
+#define TSS_HASH_SHA1 (0x00000001) // SHA-1 with 20 bytes
+#define TSS_HASH_OTHER (0xFFFFFFFF) // Not-specified hash algorithm
+
+
+//************************************
+// Flags for creating POLICY object: *
+//************************************
+
+//
+// Type
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+//
+// Usage |0 0 1|
+// Migration |0 1 0|
+// Operator |0 1 1|
+//
+// POLICY Reserved:
+// |x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x|
+
+#define TSS_POLICY_USAGE (0x00000001) // usage policy object
+#define TSS_POLICY_MIGRATION (0x00000002) // migration policy object
+#define TSS_POLICY_OPERATOR (0x00000003) // migration policy object
+
+
+//******************************************
+// Flags for creating PCRComposite object: *
+//******************************************
+
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+// |x x| Struct
+// |x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x| Reserved
+//
+
+// PCRComposite Version:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// ---------------------------------------------------------------
+// TPM_PCR_DEFAULT |0 0 0|
+// TPM_PCR_INFO |0 0 1|
+// TPM_PCR_INFO_LONG |0 1 0|
+// TPM_PCR_INFO_SHORT |0 1 1|
+//
+
+#define TSS_PCRS_STRUCT_DEFAULT (0x00000000) // depends on context
+#define TSS_PCRS_STRUCT_INFO (0x00000001) // TPM_PCR_INFO
+#define TSS_PCRS_STRUCT_INFO_LONG (0x00000002) // TPM_PCR_INFO_LONG
+#define TSS_PCRS_STRUCT_INFO_SHORT (0x00000003) // TPM_PCR_INFO_SHORT
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// Attribute Flags, Subflags, and Values
+//////////////////////////////////////////////////////////////////////////
+
+
+//******************
+// Context object: *
+//******************
+
+//
+// Attributes
+//
+#define TSS_TSPATTRIB_CONTEXT_SILENT_MODE (0x00000001)
+ // dialog display control
+#define TSS_TSPATTRIB_CONTEXT_MACHINE_NAME (0x00000002)
+ // remote machine name
+#define TSS_TSPATTRIB_CONTEXT_VERSION_MODE (0x00000003)
+ // context version
+#define TSS_TSPATTRIB_CONTEXT_TRANSPORT (0x00000004)
+ // transport control
+#define TSS_TSPATTRIB_CONTEXT_CONNECTION_VERSION (0x00000005)
+ // connection version
+#define TSS_TSPATTRIB_SECRET_HASH_MODE (0x00000006)
+ // flag indicating whether
+ // NUL is included in the
+ // hash of the password
+//
+// SubFlags for Flag TSS_TSPATTRIB_CONTEXT_TRANSPORT
+//
+#define TSS_TSPATTRIB_CONTEXTTRANS_CONTROL (0x00000008)
+#define TSS_TSPATTRIB_CONTEXTTRANS_MODE (0x00000010)
+
+//
+// Values for the TSS_TSPATTRIB_CONTEXT_SILENT_MODE attribute
+//
+#define TSS_TSPATTRIB_CONTEXT_NOT_SILENT (0x00000000) // TSP dialogs enabled
+#define TSS_TSPATTRIB_CONTEXT_SILENT (0x00000001) // TSP dialogs disabled
+
+//
+// Values for the TSS_TSPATTRIB_CONTEXT_VERSION_MODE attribute
+//
+#define TSS_TSPATTRIB_CONTEXT_VERSION_AUTO (0x00000001)
+#define TSS_TSPATTRIB_CONTEXT_VERSION_V1_1 (0x00000002)
+#define TSS_TSPATTRIB_CONTEXT_VERSION_V1_2 (0x00000003)
+
+//
+// Values for the subflag TSS_TSPATTRIB_CONTEXT_TRANS_CONTROL
+//
+#define TSS_TSPATTRIB_DISABLE_TRANSPORT (0x00000016)
+#define TSS_TSPATTRIB_ENABLE_TRANSPORT (0x00000032)
+
+//
+// Values for the subflag TSS_TSPATTRIB_CONTEXT_TRANS_MODE
+//
+#define TSS_TSPATTRIB_TRANSPORT_NO_DEFAULT_ENCRYPTION (0x00000000)
+#define TSS_TSPATTRIB_TRANSPORT_DEFAULT_ENCRYPTION (0x00000001)
+#define TSS_TSPATTRIB_TRANSPORT_AUTHENTIC_CHANNEL (0x00000002)
+#define TSS_TSPATTRIB_TRANSPORT_EXCLUSIVE (0x00000004)
+#define TSS_TSPATTRIB_TRANSPORT_STATIC_AUTH (0x00000008)
+
+//
+// Values for the TSS_TSPATTRIB_CONTEXT_CONNECTION_VERSION attribute
+//
+#define TSS_CONNECTION_VERSION_1_1 (0x00000001)
+#define TSS_CONNECTION_VERSION_1_2 (0x00000002)
+
+
+//
+// Subflags of TSS_TSPATTRIB_SECRET_HASH_MODE
+//
+#define TSS_TSPATTRIB_SECRET_HASH_MODE_POPUP (0x00000001)
+
+//
+// Values for TSS_TSPATTRIB_SECRET_HASH_MODE_POPUP subflag
+//
+#define TSS_TSPATTRIB_HASH_MODE_NOT_NULL (0x00000000)
+#define TSS_TSPATTRIB_HASH_MODE_NULL (0x00000001)
+
+
+// *************
+// TPM object: *
+// *************
+
+//
+// Attributes:
+//
+#define TSS_TSPATTRIB_TPM_CALLBACK_COLLATEIDENTITY 0x00000001
+#define TSS_TSPATTRIB_TPM_CALLBACK_ACTIVATEIDENTITY 0x00000002
+#define TSS_TSPATTRIB_TPM_ORDINAL_AUDIT_STATUS 0x00000003
+#define TSS_TSPATTRIB_TPM_CREDENTIAL 0x00001000
+
+//
+// Subflags for TSS_TSPATTRIB_TPM_ORDINAL_AUDIT_STATUS
+//
+#define TPM_CAP_PROP_TPM_CLEAR_ORDINAL_AUDIT 0x00000000
+#define TPM_CAP_PROP_TPM_SET_ORDINAL_AUDIT 0x00000001
+
+//
+// Subflags for TSS_TSPATTRIB_TPM_CREDENTIAL
+//
+#define TSS_TPMATTRIB_EKCERT 0x00000001
+#define TSS_TPMATTRIB_TPM_CC 0x00000002
+#define TSS_TPMATTRIB_PLATFORMCERT 0x00000003
+#define TSS_TPMATTRIB_PLATFORM_CC 0x00000004
+
+
+//*****************
+// Policy object: *
+//*****************
+
+//
+// Attributes
+//
+#define TSS_TSPATTRIB_POLICY_CALLBACK_HMAC (0x00000080)
+ // enable/disable callback function
+
+#define TSS_TSPATTRIB_POLICY_CALLBACK_XOR_ENC (0x00000100)
+ // enable/disable callback function
+
+#define TSS_TSPATTRIB_POLICY_CALLBACK_TAKEOWNERSHIP (0x00000180)
+ // enable/disable callback function
+
+#define TSS_TSPATTRIB_POLICY_CALLBACK_CHANGEAUTHASYM (0x00000200)
+ // enable/disable callback function
+
+#define TSS_TSPATTRIB_POLICY_SECRET_LIFETIME (0x00000280)
+ // set lifetime mode for policy secret
+
+#define TSS_TSPATTRIB_POLICY_POPUPSTRING (0x00000300)
+ // set a NULL terminated UNICODE string
+ // which is displayed in the TSP policy
+ // popup dialog
+#define TSS_TSPATTRIB_POLICY_CALLBACK_SEALX_MASK (0x00000380)
+ // enable/disable callback function
+#if 0
+/* This attribute flag is defined earlier with the context attributes.
+ * It is valid for both context and policy objects. It is copied
+ * here as a reminder to avoid collisions.
+ */
+#define TSS_TSPATTRIB_SECRET_HASH_MODE (0x00000006)
+ // flag indicating whether
+ // NUL is included in the
+ // hash of the password
+#endif
+
+
+#define TSS_TSPATTRIB_POLICY_DELEGATION_INFO (0x00000001)
+#define TSS_TSPATTRIB_POLICY_DELEGATION_PCR (0x00000002)
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_POLICY_SECRET_LIFETIME
+//
+#define TSS_SECRET_LIFETIME_ALWAYS (0x00000001) // secret will not be
+ // invalidated
+#define TSS_SECRET_LIFETIME_COUNTER (0x00000002) // secret lifetime
+ // controlled by counter
+#define TSS_SECRET_LIFETIME_TIMER (0x00000003) // secret lifetime
+ // controlled by time
+#define TSS_TSPATTRIB_POLSECRET_LIFETIME_ALWAYS TSS_SECRET_LIFETIME_ALWAYS
+#define TSS_TSPATTRIB_POLSECRET_LIFETIME_COUNTER TSS_SECRET_LIFETIME_COUNTER
+#define TSS_TSPATTRIB_POLSECRET_LIFETIME_TIMER TSS_SECRET_LIFETIME_TIMER
+
+// Alternate names misspelled in the 1.1 TSS spec.
+#define TSS_TSPATTRIB_POLICYSECRET_LIFETIME_ALWAYS TSS_SECRET_LIFETIME_ALWAYS
+#define TSS_TSPATTRIB_POLICYSECRET_LIFETIME_COUNTER TSS_SECRET_LIFETIME_COUNTER
+#define TSS_TSPATTRIB_POLICYSECRET_LIFETIME_TIMER TSS_SECRET_LIFETIME_TIMER
+
+//
+// Subflags of TSS_TSPATTRIB_POLICY_DELEGATION_INFO
+//
+#define TSS_TSPATTRIB_POLDEL_TYPE (0x00000001)
+#define TSS_TSPATTRIB_POLDEL_INDEX (0x00000002)
+#define TSS_TSPATTRIB_POLDEL_PER1 (0x00000003)
+#define TSS_TSPATTRIB_POLDEL_PER2 (0x00000004)
+#define TSS_TSPATTRIB_POLDEL_LABEL (0x00000005)
+#define TSS_TSPATTRIB_POLDEL_FAMILYID (0x00000006)
+#define TSS_TSPATTRIB_POLDEL_VERCOUNT (0x00000007)
+#define TSS_TSPATTRIB_POLDEL_OWNERBLOB (0x00000008)
+#define TSS_TSPATTRIB_POLDEL_KEYBLOB (0x00000009)
+
+//
+// Subflags of TSS_TSPATTRIB_POLICY_DELEGATION_PCR
+//
+#define TSS_TSPATTRIB_POLDELPCR_LOCALITY (0x00000001)
+#define TSS_TSPATTRIB_POLDELPCR_DIGESTATRELEASE (0x00000002)
+#define TSS_TSPATTRIB_POLDELPCR_SELECTION (0x00000003)
+
+//
+// Values for the Policy TSS_TSPATTRIB_POLDEL_TYPE attribute
+//
+#define TSS_DELEGATIONTYPE_NONE (0x00000001)
+#define TSS_DELEGATIONTYPE_OWNER (0x00000002)
+#define TSS_DELEGATIONTYPE_KEY (0x00000003)
+
+
+
+//
+// Flags used for the 'mode' parameter in Tspi_Policy_SetSecret()
+//
+#define TSS_SECRET_MODE_NONE (0x00000800) // No authorization will be
+ // processed
+#define TSS_SECRET_MODE_SHA1 (0x00001000) // Secret string will not be
+ // touched by TSP
+#define TSS_SECRET_MODE_PLAIN (0x00001800) // Secret string will be hashed
+ // using SHA1
+#define TSS_SECRET_MODE_POPUP (0x00002000) // TSS SP will ask for a secret
+#define TSS_SECRET_MODE_CALLBACK (0x00002800) // Application has to provide a
+ // call back function
+
+
+
+//******************
+// EncData object: *
+//******************
+
+//
+// Attributes
+//
+#define TSS_TSPATTRIB_ENCDATA_BLOB (0x00000008)
+#define TSS_TSPATTRIB_ENCDATA_PCR (0x00000010)
+#define TSS_TSPATTRIB_ENCDATA_PCR_LONG (0x00000018)
+#define TSS_TSPATTRIB_ENCDATA_SEAL (0x00000020)
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_ENCDATA_BLOB
+//
+#define TSS_TSPATTRIB_ENCDATABLOB_BLOB (0x00000001) // encrypted data blob
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_ENCDATA_PCR
+//
+#define TSS_TSPATTRIB_ENCDATAPCR_DIGEST_ATCREATION (0x00000002)
+#define TSS_TSPATTRIB_ENCDATAPCR_DIGEST_ATRELEASE (0x00000003)
+#define TSS_TSPATTRIB_ENCDATAPCR_SELECTION (0x00000004)
+// support typo from 1.1 headers
+#define TSS_TSPATTRIB_ENCDATAPCR_DIGEST_RELEASE \
+ TSS_TSPATTRIB_ENCDATAPCR_DIGEST_ATRELEASE
+
+#define TSS_TSPATTRIB_ENCDATAPCRLONG_LOCALITY_ATCREATION (0x00000005)
+#define TSS_TSPATTRIB_ENCDATAPCRLONG_LOCALITY_ATRELEASE (0x00000006)
+#define TSS_TSPATTRIB_ENCDATAPCRLONG_CREATION_SELECTION (0x00000007)
+#define TSS_TSPATTRIB_ENCDATAPCRLONG_RELEASE_SELECTION (0x00000008)
+#define TSS_TSPATTRIB_ENCDATAPCRLONG_DIGEST_ATCREATION (0x00000009)
+#define TSS_TSPATTRIB_ENCDATAPCRLONG_DIGEST_ATRELEASE (0x0000000A)
+
+
+//
+// Attribute subflags TSS_TSPATTRIB_ENCDATA_SEAL
+//
+#define TSS_TSPATTRIB_ENCDATASEAL_PROTECT_MODE (0x00000001)
+
+//
+// Attribute values for
+// TSS_TSPATTRIB_ENCDATA_SEAL/TSS_TSPATTRIB_ENCDATASEAL_PROTECT_MODE
+//
+#define TSS_TSPATTRIB_ENCDATASEAL_NOPROTECT (0x00000000)
+#define TSS_TSPATTRIB_ENCDATASEAL_PROTECT (0x00000001)
+
+// Accounting for typos in original header files
+#define TSS_TSPATTRIB_ENCDATASEAL_NO_PROTECT \
+ TSS_TSPATTRIB_ENCDATASEAL_NOPROTECT
+
+//*************
+// NV object: *
+//*************
+
+//
+// Attributes
+//
+#define TSS_TSPATTRIB_NV_INDEX (0x00000001)
+#define TSS_TSPATTRIB_NV_PERMISSIONS (0x00000002)
+#define TSS_TSPATTRIB_NV_STATE (0x00000003)
+#define TSS_TSPATTRIB_NV_DATASIZE (0x00000004)
+#define TSS_TSPATTRIB_NV_PCR (0x00000005)
+
+#define TSS_TSPATTRIB_NVSTATE_READSTCLEAR (0x00100000)
+#define TSS_TSPATTRIB_NVSTATE_WRITESTCLEAR (0x00200000)
+#define TSS_TSPATTRIB_NVSTATE_WRITEDEFINE (0x00300000)
+
+#define TSS_TSPATTRIB_NVPCR_READPCRSELECTION (0x01000000)
+#define TSS_TSPATTRIB_NVPCR_READDIGESTATRELEASE (0x02000000)
+#define TSS_TSPATTRIB_NVPCR_READLOCALITYATRELEASE (0x03000000)
+#define TSS_TSPATTRIB_NVPCR_WRITEPCRSELECTION (0x04000000)
+#define TSS_TSPATTRIB_NVPCR_WRITEDIGESTATRELEASE (0x05000000)
+#define TSS_TSPATTRIB_NVPCR_WRITELOCALITYATRELEASE (0x06000000)
+
+/* NV index flags
+ *
+ * From the TPM spec, Part 2, Section 19.1.
+ *
+ * 3 2 1
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |T|P|U|D| resvd | Purview | Index |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+#define TSS_NV_TPM (0x80000000) // TPM mfr reserved bit
+#define TSS_NV_PLATFORM (0x40000000) // Platform mfr reserved bit
+#define TSS_NV_USER (0x20000000) // User reserved bit
+#define TSS_NV_DEFINED (0x10000000) // "Defined permanently" flag
+#define TSS_NV_MASK_TPM (0x80000000) // mask to extract 'T'
+#define TSS_NV_MASK_PLATFORM (0x40000000) // mask to extract 'P'
+#define TSS_NV_MASK_USER (0x20000000) // mask to extract 'U'
+#define TSS_NV_MASK_DEFINED (0x10000000) // mask to extract 'D'
+#define TSS_NV_MASK_RESERVED (0x0f000000) // mask to extract reserved bits
+#define TSS_NV_MASK_PURVIEW (0x00ff0000) // mask to extract purview byte
+#define TSS_NV_MASK_INDEX (0x0000ffff) // mask to extract index byte
+
+// This is the index of the NV storage area where the number of sessions
+// per locality is stored.
+#define TSS_NV_INDEX_SESSIONS (0x00011101)
+
+
+//******************
+// MigData object: *
+//******************
+
+//
+// Attributes
+//
+#define TSS_MIGATTRIB_MIGRATIONBLOB (0x00000010)
+#define TSS_MIGATTRIB_MIGRATIONTICKET (0x00000020)
+#define TSS_MIGATTRIB_AUTHORITY_DATA (0x00000030)
+#define TSS_MIGATTRIB_MIG_AUTH_DATA (0x00000040)
+#define TSS_MIGATTRIB_TICKET_DATA (0x00000050)
+#define TSS_MIGATTRIB_PAYLOAD_TYPE (0x00000060)
+
+//
+// Attribute subflags TSS_MIGATTRIB_MIGRATIONBLOB
+//
+#define TSS_MIGATTRIB_MIGRATION_XOR_BLOB (0x00000101)
+#define TSS_MIGATTRIB_MIGRATION_REWRAPPED_BLOB (0x00000102)
+#define TSS_MIGATTRIB_MIG_MSALIST_PUBKEY_BLOB (0x00000103)
+#define TSS_MIGATTRIB_MIG_AUTHORITY_PUBKEY_BLOB (0x00000104)
+#define TSS_MIGATTRIB_MIG_DESTINATION_PUBKEY_BLOB (0x00000105)
+#define TSS_MIGATTRIB_MIG_SOURCE_PUBKEY_BLOB (0x00000106)
+#define TSS_MIGATTRIB_MIG_REWRAPPED_BLOB TSS_MIGATTRIB_MIGRATION_REWRAPPED_BLOB
+#define TSS_MIGATTRIB_MIG_XOR_BLOB TSS_MIGATTRIB_MIGRATION_XOR_BLOB
+
+//
+// Attribute subflags TSS_MIGATTRIB_MIGRATIONTICKET
+//
+// none
+
+//
+// Attribute subflags TSS_MIGATTRIB_AUTHORITY_DATA
+//
+#define TSS_MIGATTRIB_AUTHORITY_DIGEST (0x00000301)
+#define TSS_MIGATTRIB_AUTHORITY_APPROVAL_HMAC (0x00000302)
+#define TSS_MIGATTRIB_AUTHORITY_MSALIST (0x00000303)
+
+//
+// Attribute subflags TSS_MIGATTRIB_MIG_AUTH_DATA
+//
+#define TSS_MIGATTRIB_MIG_AUTH_AUTHORITY_DIGEST (0x00000401)
+#define TSS_MIGATTRIB_MIG_AUTH_DESTINATION_DIGEST (0x00000402)
+#define TSS_MIGATTRIB_MIG_AUTH_SOURCE_DIGEST (0x00000403)
+
+//
+// Attribute subflags TSS_MIGATTRIB_TICKET_DATA
+//
+#define TSS_MIGATTRIB_TICKET_SIG_DIGEST (0x00000501)
+#define TSS_MIGATTRIB_TICKET_SIG_VALUE (0x00000502)
+#define TSS_MIGATTRIB_TICKET_SIG_TICKET (0x00000503)
+#define TSS_MIGATTRIB_TICKET_RESTRICT_TICKET (0x00000504)
+
+//
+// Attribute subflags TSS_MIGATTRIB_PAYLOAD_TYPE
+//
+#define TSS_MIGATTRIB_PT_MIGRATE_RESTRICTED (0x00000601)
+#define TSS_MIGATTRIB_PT_MIGRATE_EXTERNAL (0x00000602)
+
+
+
+
+//***************
+// Hash object: *
+//***************
+
+//
+// Attributes
+//
+#define TSS_TSPATTRIB_HASH_IDENTIFIER (0x00001000) // Hash algorithm identifier
+#define TSS_TSPATTRIB_ALG_IDENTIFIER (0x00002000) // ASN.1 alg identifier
+
+
+
+//***************
+// PCRs object: *
+//***************
+
+//
+// Attributes
+//
+#define TSS_TSPATTRIB_PCRS_INFO (0x00000001) // info
+
+//
+// Subflags for TSS_TSPATTRIB_PCRS_INFO flag
+//
+#define TSS_TSPATTRIB_PCRSINFO_PCRSTRUCT (0x00000001) // type of pcr struct
+ // TSS_PCRS_STRUCT_TYPE_XX
+
+//****************************
+// Delegation Family object: *
+//****************************
+
+//
+// Attributes
+//
+#define TSS_TSPATTRIB_DELFAMILY_STATE (0x00000001)
+#define TSS_TSPATTRIB_DELFAMILY_INFO (0x00000002)
+
+// DELFAMILY_STATE sub-attributes
+#define TSS_TSPATTRIB_DELFAMILYSTATE_LOCKED (0x00000001)
+#define TSS_TSPATTRIB_DELFAMILYSTATE_ENABLED (0x00000002)
+
+// DELFAMILY_INFO sub-attributes
+#define TSS_TSPATTRIB_DELFAMILYINFO_LABEL (0x00000003)
+#define TSS_TSPATTRIB_DELFAMILYINFO_VERCOUNT (0x00000004)
+#define TSS_TSPATTRIB_DELFAMILYINFO_FAMILYID (0x00000005)
+
+// Bitmasks for the 'ulFlags' argument to Tspi_TPM_Delegate_CreateDelegation.
+// Only one bit used for now.
+#define TSS_DELEGATE_INCREMENTVERIFICATIONCOUNT ((UINT32)1)
+
+// Bitmasks for the 'ulFlags' argument to
+// Tspi_TPM_Delegate_CacheOwnerDelegation. Only 1 bit is used for now.
+#define TSS_DELEGATE_CACHEOWNERDELEGATION_OVERWRITEEXISTING ((UINT32)1)
+
+
+
+//*************************
+// DAA Credential Object: *
+//*************************
+
+//
+// Attribute flags
+//
+#define TSS_TSPATTRIB_DAACRED_COMMIT (0x00000001)
+#define TSS_TSPATTRIB_DAACRED_ATTRIB_GAMMAS (0x00000002)
+#define TSS_TSPATTRIB_DAACRED_CREDENTIAL_BLOB (0x00000003)
+#define TSS_TSPATTRIB_DAACRED_CALLBACK_SIGN (0x00000004)
+#define TSS_TSPATTRIB_DAACRED_CALLBACK_VERIFYSIGNATURE (0x00000005)
+
+//
+// Subflags for TSS_TSPATTRIB_DAACRED_COMMIT
+//
+#define TSS_TSPATTRIB_DAACOMMIT_NUMBER (0x00000001)
+#define TSS_TSPATTRIB_DAACOMMIT_SELECTION (0x00000002)
+#define TSS_TSPATTRIB_DAACOMMIT_COMMITMENTS (0x00000003)
+
+//
+// Subflags for TSS_TSPATTRIB_DAACRED_ATTRIB_GAMMAS
+//
+#define TSS_TSPATTRIB_DAAATTRIBGAMMAS_BLOB (0xffffffff)
+
+
+
+//*************************
+// DAA Issuer Key Object: *
+//*************************
+
+//
+// Attribute flags
+//
+#define TSS_TSPATTRIB_DAAISSUERKEY_BLOB (0x00000001)
+#define TSS_TSPATTRIB_DAAISSUERKEY_PUBKEY (0x00000002)
+
+//
+// Subflags for TSS_TSPATTRIB_DAAISSUERKEY_BLOB
+//
+#define TSS_TSPATTRIB_DAAISSUERKEYBLOB_PUBLIC_KEY (0x00000001)
+#define TSS_TSPATTRIB_DAAISSUERKEYBLOB_SECRET_KEY (0x00000002)
+#define TSS_TSPATTRIB_DAAISSUERKEYBLOB_KEYBLOB (0x00000003)
+#define TSS_TSPATTRIB_DAAISSUERKEYBLOB_PROOF (0x00000004)
+
+//
+// Subflags for TSS_TSPATTRIB_DAAISSUERKEY_PUBKEY
+//
+#define TSS_TSPATTRIB_DAAISSUERKEYPUBKEY_NUM_ATTRIBS (0x00000001)
+#define TSS_TSPATTRIB_DAAISSUERKEYPUBKEY_NUM_PLATFORM_ATTRIBS (0x00000002)
+#define TSS_TSPATTRIB_DAAISSUERKEYPUBKEY_NUM_ISSUER_ATTRIBS (0x00000003)
+
+
+
+//***************************************
+// DAA Anonymity Revocation Key Object: *
+//***************************************
+
+//
+// Attribute flags
+//
+#define TSS_TSPATTRIB_DAAARAKEY_BLOB (0x00000001)
+
+//
+// Subflags for TSS_TSPATTRIB_DAAARAKEY_BLOB
+//
+#define TSS_TSPATTRIB_DAAARAKEYBLOB_PUBLIC_KEY (0x00000001)
+#define TSS_TSPATTRIB_DAAARAKEYBLOB_SECRET_KEY (0x00000002)
+#define TSS_TSPATTRIB_DAAARAKEYBLOB_KEYBLOB (0x00000003)
+
+
+
+//
+// Structure payload flags for TSS_DAA_PSEUDONYM,
+// (TSS_DAA_PSEUDONYM.payloadFlag)
+//
+#define TSS_FLAG_DAA_PSEUDONYM_PLAIN (0x00000000)
+#define TSS_FLAG_DAA_PSEUDONYM_ENCRYPTED (0x00000001)
+
+
+//**************
+// Key Object: *
+//**************
+
+//
+// Attribute flags
+//
+#define TSS_TSPATTRIB_KEY_BLOB (0x00000040) // key info as blob data
+#define TSS_TSPATTRIB_KEY_INFO (0x00000080) // keyparam info as blob data
+#define TSS_TSPATTRIB_KEY_UUID (0x000000C0) // key UUID info as blob data
+#define TSS_TSPATTRIB_KEY_PCR (0x00000100) // composite digest value for
+ // the key
+#define TSS_TSPATTRIB_RSAKEY_INFO (0x00000140) // public key info
+#define TSS_TSPATTRIB_KEY_REGISTER (0x00000180) // register location
+#define TSS_TSPATTRIB_KEY_PCR_LONG (0x000001c0) // PCR_INFO_LONG for the key
+#define TSS_TSPATTRIB_KEY_CONTROLBIT (0x00000200) // key control flags
+#define TSS_TSPATTRIB_KEY_CMKINFO (0x00000400) // CMK info
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_KEY_BLOB
+//
+#define TSS_TSPATTRIB_KEYBLOB_BLOB (0x00000008) // key info using the
+ // key blob
+#define TSS_TSPATTRIB_KEYBLOB_PUBLIC_KEY (0x00000010) // public key info
+ // using the blob
+#define TSS_TSPATTRIB_KEYBLOB_PRIVATE_KEY (0x00000028) // encrypted private key
+ // blob
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_KEY_INFO
+//
+#define TSS_TSPATTRIB_KEYINFO_SIZE (0x00000080) // key size in bits
+#define TSS_TSPATTRIB_KEYINFO_USAGE (0x00000100) // key usage info
+#define TSS_TSPATTRIB_KEYINFO_KEYFLAGS (0x00000180) // key flags
+#define TSS_TSPATTRIB_KEYINFO_AUTHUSAGE (0x00000200) // key auth usage info
+#define TSS_TSPATTRIB_KEYINFO_ALGORITHM (0x00000280) // key algorithm ID
+#define TSS_TSPATTRIB_KEYINFO_SIGSCHEME (0x00000300) // key sig scheme
+#define TSS_TSPATTRIB_KEYINFO_ENCSCHEME (0x00000380) // key enc scheme
+#define TSS_TSPATTRIB_KEYINFO_MIGRATABLE (0x00000400) // if true then key is
+ // migratable
+#define TSS_TSPATTRIB_KEYINFO_REDIRECTED (0x00000480) // key is redirected
+#define TSS_TSPATTRIB_KEYINFO_VOLATILE (0x00000500) // if true key is
+ // volatile
+#define TSS_TSPATTRIB_KEYINFO_AUTHDATAUSAGE (0x00000580) // if true auth is
+ // required
+#define TSS_TSPATTRIB_KEYINFO_VERSION (0x00000600) // version info as TSS
+ // version struct
+#define TSS_TSPATTRIB_KEYINFO_CMK (0x00000680) // if true then key
+ // is certified
+ // migratable
+#define TSS_TSPATTRIB_KEYINFO_KEYSTRUCT (0x00000700) // type of key struct
+ // used for this key
+ // (TPM_KEY or
+ // TPM_KEY12)
+#define TSS_TSPATTRIB_KEYCONTROL_OWNEREVICT (0x00000780) // Get current status
+ // of owner evict flag
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_RSAKEY_INFO
+//
+#define TSS_TSPATTRIB_KEYINFO_RSA_EXPONENT (0x00001000)
+#define TSS_TSPATTRIB_KEYINFO_RSA_MODULUS (0x00002000)
+#define TSS_TSPATTRIB_KEYINFO_RSA_KEYSIZE (0x00003000)
+#define TSS_TSPATTRIB_KEYINFO_RSA_PRIMES (0x00004000)
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_KEY_PCR
+//
+#define TSS_TSPATTRIB_KEYPCR_DIGEST_ATCREATION (0x00008000)
+#define TSS_TSPATTRIB_KEYPCR_DIGEST_ATRELEASE (0x00010000)
+#define TSS_TSPATTRIB_KEYPCR_SELECTION (0x00018000)
+
+//
+// SubFlags for TSS_TSPATTRIB_KEY_REGISTER
+//
+#define TSS_TSPATTRIB_KEYREGISTER_USER (0x02000000)
+#define TSS_TSPATTRIB_KEYREGISTER_SYSTEM (0x04000000)
+#define TSS_TSPATTRIB_KEYREGISTER_NO (0x06000000)
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_KEY_PCR_LONG
+//
+#define TSS_TSPATTRIB_KEYPCRLONG_LOCALITY_ATCREATION (0x00040000) /* UINT32 */
+#define TSS_TSPATTRIB_KEYPCRLONG_LOCALITY_ATRELEASE (0x00080000) /* UINT32 */
+#define TSS_TSPATTRIB_KEYPCRLONG_CREATION_SELECTION (0x000C0000) /* DATA */
+#define TSS_TSPATTRIB_KEYPCRLONG_RELEASE_SELECTION (0x00100000) /* DATA */
+#define TSS_TSPATTRIB_KEYPCRLONG_DIGEST_ATCREATION (0x00140000) /* DATA */
+#define TSS_TSPATTRIB_KEYPCRLONG_DIGEST_ATRELEASE (0x00180000) /* DATA */
+
+//
+// SubFlags for Flag TSS_TSPATTRIB_KEY_CMKINFO
+//
+#define TSS_TSPATTRIB_KEYINFO_CMK_MA_APPROVAL (0x00000010)
+#define TSS_TSPATTRIB_KEYINFO_CMK_MA_DIGEST (0x00000020)
+
+
+//
+// Attribute Values
+//
+
+//
+// key size definitions
+//
+#define TSS_KEY_SIZEVAL_512BIT (0x0200)
+#define TSS_KEY_SIZEVAL_1024BIT (0x0400)
+#define TSS_KEY_SIZEVAL_2048BIT (0x0800)
+#define TSS_KEY_SIZEVAL_4096BIT (0x1000)
+#define TSS_KEY_SIZEVAL_8192BIT (0x2000)
+#define TSS_KEY_SIZEVAL_16384BIT (0x4000)
+
+//
+// key usage definitions
+// Values intentionally moved away from corresponding TPM values to avoid
+// possible misuse
+//
+#define TSS_KEYUSAGE_BIND (0x00)
+#define TSS_KEYUSAGE_IDENTITY (0x01)
+#define TSS_KEYUSAGE_LEGACY (0x02)
+#define TSS_KEYUSAGE_SIGN (0x03)
+#define TSS_KEYUSAGE_STORAGE (0x04)
+#define TSS_KEYUSAGE_AUTHCHANGE (0x05)
+#define TSS_KEYUSAGE_MIGRATE (0x06)
+
+//
+// key flag definitions
+//
+#define TSS_KEYFLAG_REDIRECTION (0x00000001)
+#define TSS_KEYFLAG_MIGRATABLE (0x00000002)
+#define TSS_KEYFLAG_VOLATILEKEY (0x00000004)
+#define TSS_KEYFLAG_CERTIFIED_MIGRATABLE (0x00000008)
+
+//
+// algorithm ID definitions
+//
+// This table defines the algo id's
+// Values intentionally moved away from corresponding TPM values to avoid
+// possible misuse
+//
+#define TSS_ALG_RSA (0x20)
+#define TSS_ALG_DES (0x21)
+#define TSS_ALG_3DES (0x22)
+#define TSS_ALG_SHA (0x23)
+#define TSS_ALG_HMAC (0x24)
+#define TSS_ALG_AES128 (0x25)
+#define TSS_ALG_AES192 (0x26)
+#define TSS_ALG_AES256 (0x27)
+#define TSS_ALG_XOR (0x28)
+#define TSS_ALG_MGF1 (0x29)
+
+#define TSS_ALG_AES TSS_ALG_AES128
+
+// Special values for
+// Tspi_Context_GetCapability(TSS_TSPCAP_ALG)
+// Tspi_Context_GetCapability(TSS_TCSCAP_ALG)
+#define TSS_ALG_DEFAULT (0xfe)
+#define TSS_ALG_DEFAULT_SIZE (0xff)
+
+
+//
+// key signature scheme definitions
+//
+#define TSS_SS_NONE (0x10)
+#define TSS_SS_RSASSAPKCS1V15_SHA1 (0x11)
+#define TSS_SS_RSASSAPKCS1V15_DER (0x12)
+#define TSS_SS_RSASSAPKCS1V15_INFO (0x13)
+
+//
+// key encryption scheme definitions
+//
+#define TSS_ES_NONE (0x10)
+#define TSS_ES_RSAESPKCSV15 (0x11)
+#define TSS_ES_RSAESOAEP_SHA1_MGF1 (0x12)
+#define TSS_ES_SYM_CNT (0x13)
+#define TSS_ES_SYM_OFB (0x14)
+#define TSS_ES_SYM_CBC_PKCS5PAD (0x15)
+
+
+//
+// persistent storage registration definitions
+//
+#define TSS_PS_TYPE_USER (1) // Key is registered persistantly in the user
+ // storage database.
+#define TSS_PS_TYPE_SYSTEM (2) // Key is registered persistantly in the system
+ // storage database.
+
+//
+// migration scheme definitions
+// Values intentionally moved away from corresponding TPM values to avoid
+// possible misuse
+//
+#define TSS_MS_MIGRATE (0x20)
+#define TSS_MS_REWRAP (0x21)
+#define TSS_MS_MAINT (0x22)
+#define TSS_MS_RESTRICT_MIGRATE (0x23)
+#define TSS_MS_RESTRICT_APPROVE_DOUBLE (0x24)
+#define TSS_MS_RESTRICT_MIGRATE_EXTERNAL (0x25)
+
+//
+// TPM key authorization
+// Values intentionally moved away from corresponding TPM values to avoid
+// possible misuse
+//
+#define TSS_KEYAUTH_AUTH_NEVER (0x10)
+#define TSS_KEYAUTH_AUTH_ALWAYS (0x11)
+#define TSS_KEYAUTH_AUTH_PRIV_USE_ONLY (0x12)
+
+
+//
+// Flags for TPM status information (GetStatus and SetStatus)
+//
+#define TSS_TPMSTATUS_DISABLEOWNERCLEAR (0x00000001) // persistent flag
+#define TSS_TPMSTATUS_DISABLEFORCECLEAR (0x00000002) // volatile flag
+#define TSS_TPMSTATUS_DISABLED (0x00000003) // persistent flag
+#define TSS_TPMSTATUS_DEACTIVATED (0x00000004) // volatile flag
+#define TSS_TPMSTATUS_OWNERSETDISABLE (0x00000005) // persistent flag
+ // for SetStatus
+ // (disable flag)
+#define TSS_TPMSTATUS_SETOWNERINSTALL (0x00000006) // persistent flag
+ // (ownership flag)
+#define TSS_TPMSTATUS_DISABLEPUBEKREAD (0x00000007) // persistent flag
+#define TSS_TPMSTATUS_ALLOWMAINTENANCE (0x00000008) // persistent flag
+#define TSS_TPMSTATUS_PHYSPRES_LIFETIMELOCK (0x00000009) // persistent flag
+#define TSS_TPMSTATUS_PHYSPRES_HWENABLE (0x0000000A) // persistent flag
+#define TSS_TPMSTATUS_PHYSPRES_CMDENABLE (0x0000000B) // persistent flag
+#define TSS_TPMSTATUS_PHYSPRES_LOCK (0x0000000C) // volatile flag
+#define TSS_TPMSTATUS_PHYSPRESENCE (0x0000000D) // volatile flag
+#define TSS_TPMSTATUS_PHYSICALDISABLE (0x0000000E) // persistent flag
+ // (SetStatus
+ // disable flag)
+#define TSS_TPMSTATUS_CEKP_USED (0x0000000F) // persistent flag
+#define TSS_TPMSTATUS_PHYSICALSETDEACTIVATED (0x00000010) // persistent flag
+ // (deactivated flag)
+#define TSS_TPMSTATUS_SETTEMPDEACTIVATED (0x00000011) // volatile flag
+ // (deactivated flag)
+#define TSS_TPMSTATUS_POSTINITIALISE (0x00000012) // volatile flag
+#define TSS_TPMSTATUS_TPMPOST (0x00000013) // persistent flag
+#define TSS_TPMSTATUS_TPMPOSTLOCK (0x00000014) // persistent flag
+#define TSS_TPMSTATUS_DISABLEPUBSRKREAD (0x00000016) // persistent flag
+#define TSS_TPMSTATUS_MAINTENANCEUSED (0x00000017) // persistent flag
+#define TSS_TPMSTATUS_OPERATORINSTALLED (0x00000018) // persistent flag
+#define TSS_TPMSTATUS_OPERATOR_INSTALLED (TSS_TPMSTATUS_OPERATORINSTALLED)
+#define TSS_TPMSTATUS_FIPS (0x00000019) // persistent flag
+#define TSS_TPMSTATUS_ENABLEREVOKEEK (0x0000001A) // persistent flag
+#define TSS_TPMSTATUS_ENABLE_REVOKEEK (TSS_TPMSTATUS_ENABLEREVOKEEK)
+#define TSS_TPMSTATUS_NV_LOCK (0x0000001B) // persistent flag
+#define TSS_TPMSTATUS_TPM_ESTABLISHED (0x0000001C) // persistent flag
+#define TSS_TPMSTATUS_RESETLOCK (0x0000001D) // volatile flag
+#define TSS_TPMSTATUS_DISABLE_FULL_DA_LOGIC_INFO (0x0000001D) //persistent flag
+
+
+//
+// Capability flag definitions
+//
+// TPM capabilities
+//
+#define TSS_TPMCAP_ORD (0x10)
+#define TSS_TPMCAP_ALG (0x11)
+#define TSS_TPMCAP_FLAG (0x12)
+#define TSS_TPMCAP_PROPERTY (0x13)
+#define TSS_TPMCAP_VERSION (0x14)
+#define TSS_TPMCAP_VERSION_VAL (0x15)
+#define TSS_TPMCAP_NV_LIST (0x16)
+#define TSS_TPMCAP_NV_INDEX (0x17)
+#define TSS_TPMCAP_MFR (0x18)
+#define TSS_TPMCAP_SYM_MODE (0x19)
+#define TSS_TPMCAP_HANDLE (0x1a)
+#define TSS_TPMCAP_TRANS_ES (0x1b)
+#define TSS_TPMCAP_AUTH_ENCRYPT (0x1c)
+#define TSS_TPMCAP_SET_PERM_FLAGS (0x1d) // cf. TPM_SET_PERM_FLAGS
+#define TSS_TPMCAP_SET_VENDOR (0x1e) // cf. TPM_SET_VENDOR
+#define TSS_TPMCAP_DA_LOGIC (0x1f)
+
+//
+// Sub-Capability Flags for TSS_TPMCAP_PROPERTY
+//
+#define TSS_TPMCAP_PROP_PCR (0x10)
+#define TSS_TPMCAP_PROP_DIR (0x11)
+#define TSS_TPMCAP_PROP_MANUFACTURER (0x12)
+#define TSS_TPMCAP_PROP_SLOTS (0x13)
+#define TSS_TPMCAP_PROP_KEYS TSS_TPMCAP_PROP_SLOTS
+#define TSS_TPMCAP_PROP_FAMILYROWS (0x14)
+#define TSS_TPMCAP_PROP_DELEGATEROWS (0x15)
+#define TSS_TPMCAP_PROP_OWNER (0x16)
+#define TSS_TPMCAP_PROP_MAXKEYS (0x18)
+#define TSS_TPMCAP_PROP_AUTHSESSIONS (0x19)
+#define TSS_TPMCAP_PROP_MAXAUTHSESSIONS (0x1a)
+#define TSS_TPMCAP_PROP_TRANSESSIONS (0x1b)
+#define TSS_TPMCAP_PROP_MAXTRANSESSIONS (0x1c)
+#define TSS_TPMCAP_PROP_SESSIONS (0x1d)
+#define TSS_TPMCAP_PROP_MAXSESSIONS (0x1e)
+#define TSS_TPMCAP_PROP_CONTEXTS (0x1f)
+#define TSS_TPMCAP_PROP_MAXCONTEXTS (0x20)
+#define TSS_TPMCAP_PROP_DAASESSIONS (0x21)
+#define TSS_TPMCAP_PROP_MAXDAASESSIONS (0x22)
+#define TSS_TPMCAP_PROP_DAA_INTERRUPT (0x23)
+#define TSS_TPMCAP_PROP_COUNTERS (0x24)
+#define TSS_TPMCAP_PROP_MAXCOUNTERS (0x25)
+#define TSS_TPMCAP_PROP_ACTIVECOUNTER (0x26)
+#define TSS_TPMCAP_PROP_MIN_COUNTER (0x27)
+#define TSS_TPMCAP_PROP_TISTIMEOUTS (0x28)
+#define TSS_TPMCAP_PROP_STARTUPEFFECTS (0x29)
+#define TSS_TPMCAP_PROP_MAXCONTEXTCOUNTDIST (0x2a)
+#define TSS_TPMCAP_PROP_CMKRESTRICTION (0x2b)
+#define TSS_TPMCAP_PROP_DURATION (0x2c)
+#define TSS_TPMCAP_PROP_MAXNVAVAILABLE (0x2d)
+#define TSS_TPMCAP_PROP_INPUTBUFFERSIZE (0x2e)
+#define TSS_TPMCAP_PROP_REVISION (0x2f)
+#define TSS_TPMCAP_PROP_LOCALITIES_AVAIL (0x32)
+
+//
+// Resource type flags
+// Sub-Capability Flags for TSS_TPMCAP_HANDLE
+//
+#define TSS_RT_KEY ((UINT32)0x00000010)
+#define TSS_RT_AUTH ((UINT32)0x00000020)
+#define TSS_RT_TRANS ((UINT32)0x00000030)
+#define TSS_RT_COUNTER ((UINT32)0x00000040)
+
+
+//
+// TSS Core Service Capabilities
+//
+#define TSS_TCSCAP_ALG (0x00000001)
+#define TSS_TCSCAP_VERSION (0x00000002)
+#define TSS_TCSCAP_CACHING (0x00000003)
+#define TSS_TCSCAP_PERSSTORAGE (0x00000004)
+#define TSS_TCSCAP_MANUFACTURER (0x00000005)
+#define TSS_TCSCAP_PLATFORM_CLASS (0x00000006)
+#define TSS_TCSCAP_TRANSPORT (0x00000007)
+#define TSS_TCSCAP_PLATFORM_INFO (0x00000008)
+
+//
+// Sub-Capability Flags TSS-CoreService-Capabilities
+//
+#define TSS_TCSCAP_PROP_KEYCACHE (0x00000100)
+#define TSS_TCSCAP_PROP_AUTHCACHE (0x00000101)
+#define TSS_TCSCAP_PROP_MANUFACTURER_STR (0x00000102)
+#define TSS_TCSCAP_PROP_MANUFACTURER_ID (0x00000103)
+#define TSS_TCSCAP_PLATFORM_VERSION (0x00001100)
+#define TSS_TCSCAP_PLATFORM_TYPE (0x00001101)
+#define TSS_TCSCAP_TRANS_EXCLUSIVE (0x00002100)
+#define TSS_TCSCAP_PROP_HOST_PLATFORM (0x00003001)
+#define TSS_TCSCAP_PROP_ALL_PLATFORMS (0x00003002)
+
+//
+// TSS Service Provider Capabilities
+//
+#define TSS_TSPCAP_ALG (0x00000010)
+#define TSS_TSPCAP_VERSION (0x00000011)
+#define TSS_TSPCAP_PERSSTORAGE (0x00000012)
+#define TSS_TSPCAP_MANUFACTURER (0x00000013)
+#define TSS_TSPCAP_RETURNVALUE_INFO (0x00000015)
+#define TSS_TSPCAP_PLATFORM_INFO (0x00000016)
+
+// Sub-Capability Flags for TSS_TSPCAP_MANUFACTURER
+//
+#define TSS_TSPCAP_PROP_MANUFACTURER_STR (0x00000102)
+#define TSS_TSPCAP_PROP_MANUFACTURER_ID (0x00000103)
+
+// Sub-Capability Flags for TSS_TSPCAP_PLATFORM_INFO
+//
+#define TSS_TSPCAP_PLATFORM_TYPE (0x00000201)
+#define TSS_TSPCAP_PLATFORM_VERSION (0x00000202)
+
+
+
+// Sub-Capability Flags for TSS_TSPCAP_RETURNVALUE_INFO
+//
+#define TSS_TSPCAP_PROP_RETURNVALUE_INFO (0x00000201)
+
+//
+// Event type definitions
+//
+#define TSS_EV_CODE_CERT (0x00000001)
+#define TSS_EV_CODE_NOCERT (0x00000002)
+#define TSS_EV_XML_CONFIG (0x00000003)
+#define TSS_EV_NO_ACTION (0x00000004)
+#define TSS_EV_SEPARATOR (0x00000005)
+#define TSS_EV_ACTION (0x00000006)
+#define TSS_EV_PLATFORM_SPECIFIC (0x00000007)
+
+
+//
+// TSP random number limits
+//
+#define TSS_TSPCAP_RANDOMLIMIT (0x00001000) // Errata: Missing from spec
+
+//
+// UUIDs
+//
+// Errata: This are not in the spec
+#define TSS_UUID_SRK {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 1}} // Storage root key
+#define TSS_UUID_SK {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 2}} // System key
+#define TSS_UUID_RK {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 3}} // roaming key
+#define TSS_UUID_CRK {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 8}} // CMK roaming key
+#define TSS_UUID_USK1 {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 4}} // user storage key 1
+#define TSS_UUID_USK2 {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 5}} // user storage key 2
+#define TSS_UUID_USK3 {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 6}} // user storage key 3
+#define TSS_UUID_USK4 {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 7}} // user storage key 4
+#define TSS_UUID_USK5 {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 9}} // user storage key 5
+#define TSS_UUID_USK6 {0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 10}}// user storage key 6
+
+// macro to derive UUIDs for keys whose "OwnerEvict" key is set.
+#define TSS_UUID_OWNEREVICT(i) {0, 0, 0, 0, 0, {0, 0, 0, 0, 1, (i)}}
+
+
+//
+// TPM well-known secret
+//
+#define TSS_WELL_KNOWN_SECRET \
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+
+
+// Values for the "direction" parameters in the Tspi_PcrComposite_XX functions.
+#define TSS_PCRS_DIRECTION_CREATION ((UINT32)1)
+#define TSS_PCRS_DIRECTION_RELEASE ((UINT32)2)
+
+
+//
+// TSS blob version definition for ASN.1 blobs
+//
+#define TSS_BLOB_STRUCT_VERSION 0x01
+
+//
+// TSS blob type definitions for ASN.1 blobs
+//
+#define TSS_BLOB_TYPE_KEY 0x01
+#define TSS_BLOB_TYPE_PUBKEY 0x02
+#define TSS_BLOB_TYPE_MIGKEY 0x03
+#define TSS_BLOB_TYPE_SEALEDDATA 0x04
+#define TSS_BLOB_TYPE_BOUNDDATA 0x05
+#define TSS_BLOB_TYPE_MIGTICKET 0x06
+#define TSS_BLOB_TYPE_PRIVATEKEY 0x07
+#define TSS_BLOB_TYPE_PRIVATEKEY_MOD1 0x08
+#define TSS_BLOB_TYPE_RANDOM_XOR 0x09
+#define TSS_BLOB_TYPE_CERTIFY_INFO 0x0A
+#define TSS_BLOB_TYPE_KEY_1_2 0x0B
+#define TSS_BLOB_TYPE_CERTIFY_INFO_2 0x0C
+#define TSS_BLOB_TYPE_CMK_MIG_KEY 0x0D
+#define TSS_BLOB_TYPE_CMK_BYTE_STREAM 0x0E
+
+
+
+//
+// Values for TPM_CMK_DELEGATE bitmasks
+// For now these are exactly the same values as the corresponding
+// TPM_CMK_DELEGATE_* bitmasks.
+//
+#define TSS_CMK_DELEGATE_SIGNING (((UINT32)1)<<31)
+#define TSS_CMK_DELEGATE_STORAGE (((UINT32)1)<<30)
+#define TSS_CMK_DELEGATE_BIND (((UINT32)1)<<29)
+#define TSS_CMK_DELEGATE_LEGACY (((UINT32)1)<<28)
+#define TSS_CMK_DELEGATE_MIGRATE (((UINT32)1)<<27)
+
+
+//
+// Constants for DAA
+//
+#define TSS_DAA_LENGTH_N 256 // Length of the RSA Modulus (2048 bits)
+#define TSS_DAA_LENGTH_F 13 // Length of the f_i's (information encoded into the certificate, 104 bits)
+#define TSS_DAA_LENGTH_E 46 // Length of the e's (exponents, part of certificate, 386 bits)
+#define TSS_DAA_LENGTH_E_PRIME 15 // Length of the interval the e's are chosen from (120 bits)
+#define TSS_DAA_LENGTH_V 317 // Length of the v's (random value, part of certificate, 2536 bits)
+#define TSS_DAA_LENGTH_SAFETY 10 // Length of the security parameter controlling the statistical zero-knowledge property (80 bits)
+#define TSS_DAA_LENGTH_HASH TPM_SHA1_160_HASH_LEN // Length of the output of the hash function SHA-1 used for the Fiat-Shamir heuristic(160 bits)
+#define TSS_DAA_LENGTH_S 128 // Length of the split large exponent for easier computations on the TPM (1024 bits)
+#define TSS_DAA_LENGTH_GAMMA 204 // Length of the modulus 'Gamma' (1632 bits)
+#define TSS_DAA_LENGTH_RHO 26 // Length of the order 'rho' of the sub group of Z*_Gamma that is used for roggue tagging (208 bits)
+#define TSS_DAA_LENGTH_MFG1_GAMMA 214 // Length of the output of MGF1 in conjunction with the modulus Gamma (1712 bits)
+#define TSS_DAA_LENGTH_MGF1_AR 25 // Length of the output of MGF1 used for anonymity revocation (200 bits)
+
+
+#endif // __TSS_DEFINES_H__
diff --git a/src/include/tss/tss_error.h b/src/include/tss/tss_error.h
new file mode 100644
index 0000000..3330a9b
--- /dev/null
+++ b/src/include/tss/tss_error.h
@@ -0,0 +1,687 @@
+/*++
+
+TSS error return codes
+
+--*/
+
+#ifndef __TSS_ERROR_H__
+#define __TSS_ERROR_H__
+
+#include <tss/platform.h>
+
+//
+// error coding scheme for a Microsoft Windows platform -
+// refer to the TSS Specification Parts
+//
+// Values are 32 bit values layed out as follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-+-----------------------+-------+-----------------------+
+// |Lev|C|R| Facility | Layer | Code |
+// +---+-+-+-----------------------+-------+-----------------------+
+// | Platform specific coding | TSS error coding system |
+// +---+-+-+-----------------------+-------+-----------------------+
+//
+// Lev - is the Level code
+//
+// 00 - Success
+// 01 - Informational
+// 10 - Warning
+// 11 - Error
+//
+// C - is the Customer code flag (must actually be set)
+//
+// R - is a reserved bit (unused)
+//
+// Facility - is the facility code: TCPA: proposal 0x028
+//
+// Code - is the facility's status code
+//
+
+//
+// definitions for the code level information
+//
+#define TSS_LEVEL_SUCCESS 0x00 // code level success
+#define TSS_LEVEL_INFO 0x40000000L // code level information
+#define TSS_LEVEL_WARNING 0x80000000L // code level warning
+#define TSS_LEVEL_ERROR 0xC0000000L // code level error
+
+//
+// some defines for the platform specific information
+//
+#define FACILITY_TSS 0x28L // facility number for TCPA return codes
+#define FACILITY_TSS_CODEPOS (FACILITY_TSS << 16) // shift the facility info to the code
+ // position
+
+#define TSS_CUSTOM_CODEFLAG 0x20000000L // bit position for the custom flag in
+ // return code
+
+//
+//
+// TSS error return codes
+//
+//
+#ifndef TSS_E_BASE
+#define TSS_E_BASE 0x00000000L
+#endif // TSS_E_BASE
+#ifndef TSS_W_BASE
+#define TSS_W_BASE 0x00000000L
+#endif // TSS_W_BASE
+#ifndef TSS_I_BASE
+#define TSS_I_BASE 0x00000000L
+#endif // TSS_I_BASE
+
+//
+// basic error return codes common to all TSS Service Provider Interface methods
+// and returned by all TSS SW stack components
+//
+
+//
+// MessageId: TSS_SUCCESS
+//
+// MessageText:
+//
+// Successful completion of the operation.
+//
+#define TSS_SUCCESS (UINT32)(0x00000000L)
+
+//
+// MessageId: TSS_E_FAIL
+//
+// MessageText:
+//
+// An internal error has been detected, but the source is unknown.
+//
+#define TSS_E_FAIL (UINT32)(TSS_E_BASE + 0x002L)
+
+//
+// MessageId: TSS_E_BAD_PARAMETER
+//
+// MessageText:
+//
+// One or more parameter is bad.
+//
+#define TSS_E_BAD_PARAMETER (UINT32)(TSS_E_BASE + 0x003L)
+
+//
+// MessageId: TSS_E_INTERNAL_ERROR
+//
+// MessageText:
+//
+// An internal SW error has been detected.
+//
+#define TSS_E_INTERNAL_ERROR (UINT32)(TSS_E_BASE + 0x004L)
+
+//
+// MessageId: TSS_E_OUTOFMEMORY
+//
+// MessageText:
+//
+// Ran out of memory.
+//
+#define TSS_E_OUTOFMEMORY (UINT32)(TSS_E_BASE + 0x005L)
+
+//
+// MessageId: TSS_E_NOTIMPL
+//
+// MessageText:
+//
+// Not implemented.
+//
+#define TSS_E_NOTIMPL (UINT32)(TSS_E_BASE + 0x006L)
+
+//
+// MessageId: TSS_E_KEY_ALREADY_REGISTERED
+//
+// MessageText:
+//
+// Key is already registered
+//
+#define TSS_E_KEY_ALREADY_REGISTERED (UINT32)(TSS_E_BASE + 0x008L)
+
+
+//
+// MessageId: TSS_E_TPM_UNEXPECTED
+//
+// MessageText:
+//
+// An unexpected TPM error has occurred.
+//
+#define TSS_E_TPM_UNEXPECTED (UINT32)(TSS_E_BASE + 0x010L)
+
+//
+// MessageId: TSS_E_COMM_FAILURE
+//
+// MessageText:
+//
+// A communications error with the TPM has been detected.
+//
+#define TSS_E_COMM_FAILURE (UINT32)(TSS_E_BASE + 0x011L)
+
+//
+// MessageId: TSS_E_TIMEOUT
+//
+// MessageText:
+//
+// The operation has timed out.
+//
+#define TSS_E_TIMEOUT (UINT32)(TSS_E_BASE + 0x012L)
+
+//
+// MessageId: TSS_E_TPM_UNSUPPORTED_FEATURE
+//
+// MessageText:
+//
+// The TPM does not support the requested feature.
+//
+#define TSS_E_TPM_UNSUPPORTED_FEATURE (UINT32)(TSS_E_BASE + 0x014L)
+
+//
+// MessageId: TSS_E_CANCELED
+//
+// MessageText:
+//
+// The action was canceled by request.
+//
+#define TSS_E_CANCELED (UINT32)(TSS_E_BASE + 0x016L)
+
+//
+// MessageId: TSS_E_PS_KEY_NOTFOUND
+//
+// MessageText:
+//
+// The key cannot be found in the persistent storage database.
+//
+#define TSS_E_PS_KEY_NOTFOUND (UINT32)(TSS_E_BASE + 0x020L)
+//
+// MessageId: TSS_E_PS_KEY_EXISTS
+//
+// MessageText:
+//
+// The key already exists in the persistent storage database.
+//
+#define TSS_E_PS_KEY_EXISTS (UINT32)(TSS_E_BASE + 0x021L)
+
+//
+// MessageId: TSS_E_PS_BAD_KEY_STATE
+//
+// MessageText:
+//
+// The key data set not valid in the persistent storage database.
+//
+#define TSS_E_PS_BAD_KEY_STATE (UINT32)(TSS_E_BASE + 0x022L)
+
+
+//
+// error codes returned by specific TSS Service Provider Interface methods
+// offset TSS_TSPI_OFFSET
+//
+
+//
+// MessageId: TSS_E_INVALID_OBJECT_TYPE
+//
+// MessageText:
+//
+// Object type not valid for this operation.
+//
+#define TSS_E_INVALID_OBJECT_TYPE (UINT32)(TSS_E_BASE + 0x101L)
+
+//
+// MessageId: TSS_E_NO_CONNECTION
+//
+// MessageText:
+//
+// Core Service connection doesn't exist.
+//
+#define TSS_E_NO_CONNECTION (UINT32)(TSS_E_BASE + 0x102L)
+
+//
+// MessageId: TSS_E_CONNECTION_FAILED
+//
+// MessageText:
+//
+// Core Service connection failed.
+//
+#define TSS_E_CONNECTION_FAILED (UINT32)(TSS_E_BASE + 0x103L)
+
+//
+// MessageId: TSS_E_CONNECTION_BROKEN
+//
+// MessageText:
+//
+// Communication with Core Service failed.
+//
+#define TSS_E_CONNECTION_BROKEN (UINT32)(TSS_E_BASE + 0x104L)
+
+//
+// MessageId: TSS_E_HASH_INVALID_ALG
+//
+// MessageText:
+//
+// Invalid hash algorithm.
+//
+#define TSS_E_HASH_INVALID_ALG (UINT32)(TSS_E_BASE + 0x105L)
+
+//
+// MessageId: TSS_E_HASH_INVALID_LENGTH
+//
+// MessageText:
+//
+// Hash length is inconsistent with hash algorithm.
+//
+#define TSS_E_HASH_INVALID_LENGTH (UINT32)(TSS_E_BASE + 0x106L)
+
+//
+// MessageId: TSS_E_HASH_NO_DATA
+//
+// MessageText:
+//
+// Hash object has no internal hash value.
+//
+#define TSS_E_HASH_NO_DATA (UINT32)(TSS_E_BASE + 0x107L)
+
+
+//
+// MessageId: TSS_E_INVALID_ATTRIB_FLAG
+//
+// MessageText:
+//
+// Flag value for attrib-functions inconsistent.
+//
+#define TSS_E_INVALID_ATTRIB_FLAG (UINT32)(TSS_E_BASE + 0x109L)
+
+//
+// MessageId: TSS_E_INVALID_ATTRIB_SUBFLAG
+//
+// MessageText:
+//
+// Subflag value for attrib-functions inconsistent.
+//
+#define TSS_E_INVALID_ATTRIB_SUBFLAG (UINT32)(TSS_E_BASE + 0x10AL)
+
+//
+// MessageId: TSS_E_INVALID_ATTRIB_DATA
+//
+// MessageText:
+//
+// Data for attrib-functions invalid.
+//
+#define TSS_E_INVALID_ATTRIB_DATA (UINT32)(TSS_E_BASE + 0x10BL)
+
+//
+// MessageId: TSS_E_INVALID_OBJECT_INITFLAG
+//
+// MessageText:
+//
+// Wrong flag information for object creation.
+//
+// The alternate spelling is supported to be compatible with a typo
+// in the 1.1b header files.
+//
+#define TSS_E_INVALID_OBJECT_INIT_FLAG (UINT32)(TSS_E_BASE + 0x10CL)
+#define TSS_E_INVALID_OBJECT_INITFLAG TSS_E_INVALID_OBJECT_INIT_FLAG
+
+//
+// MessageId: TSS_E_NO_PCRS_SET
+//
+// MessageText:
+//
+// No PCR register are selected or set.
+//
+#define TSS_E_NO_PCRS_SET (UINT32)(TSS_E_BASE + 0x10DL)
+
+//
+// MessageId: TSS_E_KEY_NOT_LOADED
+//
+// MessageText:
+//
+// The addressed key is currently not loaded.
+//
+#define TSS_E_KEY_NOT_LOADED (UINT32)(TSS_E_BASE + 0x10EL)
+
+//
+// MessageId: TSS_E_KEY_NOT_SET
+//
+// MessageText:
+//
+// No key information is currently available.
+//
+#define TSS_E_KEY_NOT_SET (UINT32)(TSS_E_BASE + 0x10FL)
+
+//
+// MessageId: TSS_E_VALIDATION_FAILED
+//
+// MessageText:
+//
+// Internal validation of data failed.
+//
+#define TSS_E_VALIDATION_FAILED (UINT32)(TSS_E_BASE + 0x110L)
+
+//
+// MessageId: TSS_E_TSP_AUTHREQUIRED
+//
+// MessageText:
+//
+// Authorization is required.
+//
+#define TSS_E_TSP_AUTHREQUIRED (UINT32)(TSS_E_BASE + 0x111L)
+
+//
+// MessageId: TSS_E_TSP_AUTH2REQUIRED
+//
+// MessageText:
+//
+// Multiple authorization is required.
+//
+#define TSS_E_TSP_AUTH2REQUIRED (UINT32)(TSS_E_BASE + 0x112L)
+
+//
+// MessageId: TSS_E_TSP_AUTHFAIL
+//
+// MessageText:
+//
+// Authorization failed.
+//
+#define TSS_E_TSP_AUTHFAIL (UINT32)(TSS_E_BASE + 0x113L)
+
+//
+// MessageId: TSS_E_TSP_AUTH2FAIL
+//
+// MessageText:
+//
+// Multiple authorization failed.
+//
+#define TSS_E_TSP_AUTH2FAIL (UINT32)(TSS_E_BASE + 0x114L)
+
+//
+// MessageId: TSS_E_KEY_NO_MIGRATION_POLICY
+//
+// MessageText:
+//
+// There's no migration policy object set for the addressed key.
+//
+#define TSS_E_KEY_NO_MIGRATION_POLICY (UINT32)(TSS_E_BASE + 0x115L)
+
+//
+// MessageId: TSS_E_POLICY_NO_SECRET
+//
+// MessageText:
+//
+// No secret information is currently available for the addressed policy object.
+//
+#define TSS_E_POLICY_NO_SECRET (UINT32)(TSS_E_BASE + 0x116L)
+
+//
+// MessageId: TSS_E_INVALID_OBJ_ACCESS
+//
+// MessageText:
+//
+// The operation failed due to an invalid object status.
+//
+#define TSS_E_INVALID_OBJ_ACCESS (UINT32)(TSS_E_BASE + 0x117L)
+
+//
+// MessageId: TSS_E_INVALID_ENCSCHEME
+//
+// MessageText:
+//
+//
+//
+#define TSS_E_INVALID_ENCSCHEME (UINT32)(TSS_E_BASE + 0x118L)
+
+
+//
+// MessageId: TSS_E_INVALID_SIGSCHEME
+//
+// MessageText:
+//
+//
+//
+#define TSS_E_INVALID_SIGSCHEME (UINT32)(TSS_E_BASE + 0x119L)
+
+//
+// MessageId: TSS_E_ENC_INVALID_LENGTH
+//
+// MessageText:
+//
+//
+//
+#define TSS_E_ENC_INVALID_LENGTH (UINT32)(TSS_E_BASE + 0x120L)
+
+
+//
+// MessageId: TSS_E_ENC_NO_DATA
+//
+// MessageText:
+//
+//
+//
+#define TSS_E_ENC_NO_DATA (UINT32)(TSS_E_BASE + 0x121L)
+
+//
+// MessageId: TSS_E_ENC_INVALID_TYPE
+//
+// MessageText:
+//
+//
+//
+#define TSS_E_ENC_INVALID_TYPE (UINT32)(TSS_E_BASE + 0x122L)
+
+
+//
+// MessageId: TSS_E_INVALID_KEYUSAGE
+//
+// MessageText:
+//
+//
+//
+#define TSS_E_INVALID_KEYUSAGE (UINT32)(TSS_E_BASE + 0x123L)
+
+//
+// MessageId: TSS_E_VERIFICATION_FAILED
+//
+// MessageText:
+//
+//
+//
+#define TSS_E_VERIFICATION_FAILED (UINT32)(TSS_E_BASE + 0x124L)
+
+//
+// MessageId: TSS_E_HASH_NO_IDENTIFIER
+//
+// MessageText:
+//
+// Hash algorithm identifier not set.
+//
+#define TSS_E_HASH_NO_IDENTIFIER (UINT32)(TSS_E_BASE + 0x125L)
+
+//
+// MessageId: TSS_E_INVALID_HANDLE
+//
+// MessageText:
+//
+// An invalid handle
+//
+#define TSS_E_INVALID_HANDLE (UINT32)(TSS_E_BASE + 0x126L)
+
+//
+// MessageId: TSS_E_SILENT_CONTEXT
+//
+// MessageText:
+//
+// A silent context requires user input
+//
+#define TSS_E_SILENT_CONTEXT (UINT32)(TSS_E_BASE + 0x127L)
+
+//
+// MessageId: TSS_E_EK_CHECKSUM
+//
+// MessageText:
+//
+// TSP is instructed to verify the EK checksum and it does not verify.
+//
+#define TSS_E_EK_CHECKSUM (UINT32)(TSS_E_BASE + 0x128L)
+
+
+//
+// MessageId: TSS_E_DELGATION_NOTSET
+//
+// MessageText:
+//
+// The Policy object does not have a delegation blob set.
+//
+#define TSS_E_DELEGATION_NOTSET (UINT32)(TSS_E_BASE + 0x129L)
+
+//
+// MessageId: TSS_E_DELFAMILY_NOTFOUND
+//
+// MessageText:
+//
+// The specified delegation family was not found
+//
+#define TSS_E_DELFAMILY_NOTFOUND (UINT32)(TSS_E_BASE + 0x130L)
+
+//
+// MessageId: TSS_E_DELFAMILY_ROWEXISTS
+//
+// MessageText:
+//
+// The specified delegation family table row is already in use and
+// the command flags does not allow the TSS to overwrite the existing
+// entry.
+//
+#define TSS_E_DELFAMILY_ROWEXISTS (UINT32)(TSS_E_BASE + 0x131L)
+
+//
+// MessageId: TSS_E_VERSION_MISMATCH
+//
+// MessageText:
+//
+// The specified delegation family table row is already in use and
+// the command flags does not allow the TSS to overwrite the existing
+// entry.
+//
+#define TSS_E_VERSION_MISMATCH (UINT32)(TSS_E_BASE + 0x132L)
+
+//
+// MessageId: TSS_E_DAA_AR_DECRYPTION_ERROR
+//
+// Decryption of the encrypted pseudonym has failed, due to
+// either a wrong secret key or a wrong decryption condition.
+//
+#define TSS_E_DAA_AR_DECRYPTION_ERROR (UINT32)(TSS_E_BASE + 0x133L)
+
+//
+// MessageId: TSS_E_DAA_AUTHENTICATION_ERROR
+//
+// The TPM could not be authenticated by the DAA Issuer.
+//
+#define TSS_E_DAA_AUTHENTICATION_ERROR (UINT32)(TSS_E_BASE + 0x134L)
+
+//
+// MessageId: TSS_E_DAA_CHALLENGE_RESPONSE_ERROR
+//
+// DAA Challenge response error.
+//
+#define TSS_E_DAA_CHALLENGE_RESPONSE_ERROR (UINT32)(TSS_E_BASE + 0x135L)
+
+//
+// MessageId: TSS_E_DAA_CREDENTIAL_PROOF_ERROR
+//
+// Verification of the credential TSS_DAA_CRED_ISSUER issued by
+// the DAA Issuer has failed.
+//
+#define TSS_E_DAA_CREDENTIAL_PROOF_ERROR (UINT32)(TSS_E_BASE + 0x136L)
+
+//
+// MessageId: TSS_E_DAA_CREDENTIAL_REQUEST_PROOF_ERROR
+//
+// Verification of the platform's credential request
+// TSS_DAA_CREDENTIAL_REQUEST has failed.
+//
+#define TSS_E_DAA_CREDENTIAL_REQUEST_PROOF_ERROR (UINT32)(TSS_E_BASE + 0x137L)
+
+//
+// MessageId: TSS_E_DAA_ISSUER_KEY_ERROR
+//
+// DAA Issuer's authentication key chain could not be verified or
+// is not correct.
+//
+#define TSS_E_DAA_ISSUER_KEY_ERROR (UINT32)(TSS_E_BASE + 0x138L)
+
+//
+// MessageId: TSS_E_DAA_PSEUDONYM_ERROR
+//
+// While verifying the pseudonym of the TPM, the private key of the
+// TPM was found on the rogue list.
+//
+#define TSS_E_DAA_PSEUDONYM_ERROR (UINT32)(TSS_E_BASE + 0x139L)
+
+//
+// MessageId: TSS_E_INVALID_RESOURCE
+//
+// Pointer to memory wrong.
+//
+#define TSS_E_INVALID_RESOURCE (UINT32)(TSS_E_BASE + 0x13AL)
+
+//
+// MessageId: TSS_E_NV_AREA_EXIST
+//
+// The NV area referenced already exists
+//
+#define TSS_E_NV_AREA_EXIST (UINT32)(TSS_E_BASE + 0x13BL)
+
+//
+// MessageId: TSS_E_NV_AREA_NOT_EXIST
+//
+// The NV area referenced doesn't exist
+//
+#define TSS_E_NV_AREA_NOT_EXIST (UINT32)(TSS_E_BASE + 0x13CL)
+
+//
+// MessageId: TSS_E_TSP_TRANS_AUTHFAIL
+//
+// The transport session authorization failed
+//
+#define TSS_E_TSP_TRANS_AUTHFAIL (UINT32)(TSS_E_BASE + 0x13DL)
+
+//
+// MessageId: TSS_E_TSP_TRANS_AUTHREQUIRED
+//
+// Authorization for transport is required
+//
+#define TSS_E_TSP_TRANS_AUTHREQUIRED (UINT32)(TSS_E_BASE + 0x13EL)
+
+//
+// MessageId: TSS_E_TSP_TRANS_NOT_EXCLUSIVE
+//
+// A command was executed outside of an exclusive transport session.
+//
+#define TSS_E_TSP_TRANS_NOTEXCLUSIVE (UINT32)(TSS_E_BASE + 0x13FL)
+
+//
+// MessageId: TSS_E_TSP_TRANS_FAIL
+//
+// Generic transport protection error.
+//
+#define TSS_E_TSP_TRANS_FAIL (UINT32)(TSS_E_BASE + 0x140L)
+
+//
+// MessageId: TSS_E_TSP_TRANS_NO_PUBKEY
+//
+// A command could not be executed through a logged transport session
+// because the command used a key and the key's public key is not
+// known to the TSP.
+//
+#define TSS_E_TSP_TRANS_NO_PUBKEY (UINT32)(TSS_E_BASE + 0x141L)
+
+//
+// MessageId: TSS_E_NO_ACTIVE_COUNTER
+//
+// The TPM active counter has not been set yet.
+//
+#define TSS_E_NO_ACTIVE_COUNTER (UINT32)(TSS_E_BASE + 0x142L)
+
+
+#endif // __TSS_ERROR_H__
diff --git a/src/include/tss/tss_error_basics.h b/src/include/tss/tss_error_basics.h
new file mode 100644
index 0000000..b9e965c
--- /dev/null
+++ b/src/include/tss/tss_error_basics.h
@@ -0,0 +1,59 @@
+/*++
+
+Basic defines for TSS error return codes
+
+--*/
+
+#ifndef __TSS_ERROR_BASICS_H__
+#define __TSS_ERROR_BASICS_H__
+
+
+//
+// definitions for the various TSS-SW layers
+//
+#ifndef TSS_LAYER_TPM
+#define TSS_LAYER_TPM 0x0000L // definition for TPM layer
+#endif // TSS_LAYER_TPM
+
+#define TSS_LAYER_TDDL 0x1000L // definition for TDDL layer
+#define TSS_LAYER_TCS 0x2000L // definition for TCS layer
+
+#ifndef TSS_LAYER_TSP
+#define TSS_LAYER_TSP 0x3000L // definition for TSP layer
+#endif // TSS_LAYER_TSP
+
+
+//
+// definitions for the start points of layer specific error codes
+//
+#ifndef TSS_COMMON_OFFSET
+#define TSS_COMMON_OFFSET 0x000L
+#endif // TSS_COMMON_OFFSET
+
+#define TSS_TDDL_OFFSET 0x080L
+#define TSS_TCSI_OFFSET 0x0C0L
+
+#ifndef TSS_TSPI_OFFSET
+#define TSS_TSPI_OFFSET 0x100L
+#endif // TSS_TSPI_OFFSET
+
+#ifndef TSS_VENDOR_OFFSET
+#define TSS_VENDOR_OFFSET 0x800L
+#endif // TSS_VENDOR_OFFSET
+
+// do not exceed TSS_MAX_ERROR for vendor specific code values:
+#ifndef TSS_MAX_ERROR
+#define TSS_MAX_ERROR 0xFFFL
+#endif // TSS_MAX_ERROR
+
+
+/* Macros for the construction and interpretation of error codes */
+#define TPM_ERROR(code) (code)
+#define TDDL_ERROR(code) ((code) ? (TSS_LAYER_TDDL | (code)) : (code))
+#define TCS_ERROR(code) ((code) ? (TSS_LAYER_TCS | (code)) : (code))
+#define TSP_ERROR(code) ((code) ? (TSS_LAYER_TSP | (code)) : (code))
+#define ERROR_LAYER(error) ((error) & 0xf000)
+#define ERROR_CODE(error) ((error) & 0x0fff)
+
+#endif // __TSS_ERROR_BASICS_H__
+
diff --git a/src/include/tss/tss_structs.h b/src/include/tss/tss_structs.h
new file mode 100644
index 0000000..fa4c4b3
--- /dev/null
+++ b/src/include/tss/tss_structs.h
@@ -0,0 +1,653 @@
+/*++
+
+TSS structures for TSS
+
+*/
+
+#ifndef __TSS_STRUCTS_H__
+#define __TSS_STRUCTS_H__
+
+#include <tss/platform.h>
+#include <tss/tss_typedef.h>
+#include <tss/tpm.h>
+
+typedef struct tdTSS_VERSION
+{
+ BYTE bMajor;
+ BYTE bMinor;
+ BYTE bRevMajor;
+ BYTE bRevMinor;
+} TSS_VERSION;
+
+typedef struct tdTSS_PCR_EVENT
+{
+ TSS_VERSION versionInfo;
+ UINT32 ulPcrIndex;
+ TSS_EVENTTYPE eventType;
+ UINT32 ulPcrValueLength;
+#ifdef __midl
+ [size_is(ulPcrValueLength)]
+#endif
+ BYTE* rgbPcrValue;
+ UINT32 ulEventLength;
+#ifdef __midl
+ [size_is(ulEventLength)]
+#endif
+ BYTE* rgbEvent;
+} TSS_PCR_EVENT;
+
+
+typedef struct tdTSS_EVENT_CERT
+{
+ TSS_VERSION versionInfo;
+ UINT32 ulCertificateHashLength;
+#ifdef __midl
+ [size_is(ulCertificateHashLength)]
+#endif
+ BYTE* rgbCertificateHash;
+ UINT32 ulEntityDigestLength;
+#ifdef __midl
+ [size_is(ulEntityDigestLength)]
+#endif
+ BYTE* rgbentityDigest;
+ TSS_BOOL fDigestChecked;
+ TSS_BOOL fDigestVerified;
+ UINT32 ulIssuerLength;
+#ifdef __midl
+ [size_is(ulIssuerLength)]
+#endif
+ BYTE* rgbIssuer;
+} TSS_EVENT_CERT;
+
+typedef struct tdTSS_UUID
+{
+ UINT32 ulTimeLow;
+ UINT16 usTimeMid;
+ UINT16 usTimeHigh;
+ BYTE bClockSeqHigh;
+ BYTE bClockSeqLow;
+ BYTE rgbNode[6];
+} TSS_UUID;
+
+typedef struct tdTSS_KM_KEYINFO
+{
+ TSS_VERSION versionInfo;
+ TSS_UUID keyUUID;
+ TSS_UUID parentKeyUUID;
+ BYTE bAuthDataUsage; // whether auth is needed to load child keys
+ TSS_BOOL fIsLoaded; // TRUE: actually loaded in TPM
+ UINT32 ulVendorDataLength; // may be 0
+#ifdef __midl
+ [size_is(ulVendorDataLength)]
+#endif
+ BYTE *rgbVendorData; // may be NULL
+} TSS_KM_KEYINFO;
+
+
+typedef struct tdTSS_KM_KEYINFO2
+{
+ TSS_VERSION versionInfo;
+ TSS_UUID keyUUID;
+ TSS_UUID parentKeyUUID;
+ BYTE bAuthDataUsage; // whether auth is needed to load child keys
+ TSS_FLAG persistentStorageType;
+ TSS_FLAG persistentStorageTypeParent;
+ TSS_BOOL fIsLoaded; // TRUE: actually loaded in TPM
+ UINT32 ulVendorDataLength; // may be 0
+#ifdef __midl
+ [size_is(ulVendorDataLength)]
+#endif
+ BYTE *rgbVendorData; // may be NULL
+} TSS_KM_KEYINFO2;
+
+
+typedef struct tdTSS_NONCE
+{
+ BYTE nonce[TPM_SHA1BASED_NONCE_LEN];
+} TSS_NONCE;
+
+
+typedef struct tdTSS_VALIDATION
+{
+ TSS_VERSION versionInfo;
+ UINT32 ulExternalDataLength;
+#ifdef __midl
+ [size_is(ulExternalDataLength)]
+#endif
+ BYTE* rgbExternalData;
+ UINT32 ulDataLength;
+#ifdef __midl
+ [size_is(ulDataLength)]
+#endif
+ BYTE* rgbData;
+ UINT32 ulValidationDataLength;
+#ifdef __midl
+ [size_is(ulValidationDataLength)]
+#endif
+ BYTE* rgbValidationData;
+} TSS_VALIDATION;
+
+
+typedef struct tdTSS_CALLBACK
+{
+ PVOID callback;
+ PVOID appData;
+ TSS_ALGORITHM_ID alg;
+} TSS_CALLBACK;
+
+
+typedef struct tdTSS_DAA_PK
+{
+ TSS_VERSION versionInfo;
+ UINT32 modulusLength;
+#ifdef __midl
+ [size_is(modulusLength)]
+#endif
+ BYTE* modulus;
+ UINT32 capitalSLength;
+#ifdef __midl
+ [size_is(capitalSLength)]
+#endif
+ BYTE* capitalS;
+ UINT32 capitalZLength;
+#ifdef __midl
+ [size_is(capitalZLength)]
+#endif
+ BYTE* capitalZ;
+ UINT32 capitalR0Length;
+#ifdef __midl
+ [size_is(capitalR0Length)]
+#endif
+ BYTE* capitalR0;
+ UINT32 capitalR1Length;
+#ifdef __midl
+ [size_is(capitalR1Length)]
+#endif
+ BYTE* capitalR1;
+ UINT32 gammaLength;
+#ifdef __midl
+ [size_is(gammaLength)]
+#endif
+ BYTE* gamma;
+ UINT32 capitalGammaLength;
+#ifdef __midl
+ [size_is(capitalGammaLength)]
+#endif
+ BYTE* capitalGamma;
+ UINT32 rhoLength;
+#ifdef __midl
+ [size_is(rhoLength)]
+#endif
+ BYTE* rho;
+ UINT32 capitalYLength; // Length of first dimenstion
+ UINT32 capitalYLength2; // Length of second dimension
+#ifdef __midl
+ [size_is(capitalYLength,capitalYLength2)]
+#endif
+ BYTE** capitalY;
+ UINT32 capitalYPlatformLength;
+ UINT32 issuerBaseNameLength;
+#ifdef __midl
+ [size_is(issuerBaseName)]
+#endif
+ BYTE* issuerBaseName;
+ UINT32 numPlatformAttributes;
+ UINT32 numIssuerAttributes;
+} TSS_DAA_PK;
+
+typedef struct tdTSS_DAA_PK_PROOF
+{
+ TSS_VERSION versionInfo;
+ UINT32 challengeLength;
+#ifdef __midl
+ [size_is(challengeLength)]
+#endif
+ BYTE* challenge;
+ UINT32 responseLength; // Length of first dimension
+ UINT32 responseLength2; // Length of second dimension
+#ifdef __midl
+ [size_is(responseLength,responseLength2)]
+#endif
+ BYTE** response;
+} TSS_DAA_PK_PROOF;
+
+typedef struct tdTSS_DAA_SK
+{
+ TSS_VERSION versionInfo;
+ UINT32 productPQprimeLength;
+#ifdef __midl
+ [size_is(productPQprimeLength)]
+#endif
+ BYTE* productPQprime;
+} TSS_DAA_SK;
+
+
+typedef struct tdTSS_DAA_KEY_PAIR
+{
+ TSS_VERSION versionInfo;
+ TSS_DAA_SK secretKey;
+ TSS_DAA_PK publicKey;
+} TSS_DAA_KEY_PAIR;
+
+typedef struct tdTSS_DAA_AR_PK
+{
+ TSS_VERSION versionInfo;
+ UINT32 etaLength;
+#ifdef __midl
+ [size_is(etaLength)]
+#endif
+ BYTE* eta;
+ UINT32 lambda1Length;
+#ifdef __midl
+ [size_is(lambda1Length)]
+#endif
+ BYTE* lambda1;
+ UINT32 lambda2Length;
+#ifdef __midl
+ [size_is(lambda2Length)]
+#endif
+ BYTE* lambda2;
+ UINT32 lambda3Length;
+#ifdef __midl
+ [size_is(lambda3Length)]
+#endif
+ BYTE* lambda3;
+} TSS_DAA_AR_PK;
+
+typedef struct tdTSS_DAA_AR_SK
+{
+ TSS_VERSION versionInfo;
+ UINT32 x0Length;
+#ifdef __midl
+ [size_is(x0Length)]
+#endif
+ BYTE* x0;
+ UINT32 x1Length;
+#ifdef __midl
+ [size_is(x1Length)]
+#endif
+ BYTE* x1;
+ UINT32 x2Length;
+#ifdef __midl
+ [size_is(x2Length)]
+#endif
+ BYTE* x2;
+ UINT32 x3Length;
+#ifdef __midl
+ [size_is(x3Length)]
+#endif
+ BYTE* x3;
+ UINT32 x4Length;
+#ifdef __midl
+ [size_is(x4Length)]
+#endif
+ BYTE* x4;
+ UINT32 x5Length;
+#ifdef __midl
+ [size_is(x5Length)]
+#endif
+ BYTE* x5;
+} TSS_DAA_AR_SK;
+
+typedef struct tdTSS_DAA_AR_KEY_PAIR
+{
+ TSS_VERSION versionInfo;
+ TSS_DAA_AR_SK secretKey;
+ TSS_DAA_AR_PK publicKey;
+} TSS_DAA_AR_KEY_PAIR;
+
+typedef struct tdTSS_DAA_CRED_ISSUER
+{
+ TSS_VERSION versionInfo;
+ UINT32 capitalALength;
+#ifdef __midl
+ [size_is(capitalALength)]
+#endif
+ BYTE* capitalA;
+ UINT32 eLength;
+#ifdef __midl
+ [size_is(eLength)]
+#endif
+ BYTE* e;
+ UINT32 vPrimePrimeLength;
+#ifdef __midl
+ [size_is(vPrimePrimeLength)]
+#endif
+ BYTE* vPrimePrime;
+ UINT32 attributesIssuerLength; // Length of first dimension
+ UINT32 attributesIssuerLength2; // Length of second dimension
+#ifdef __midl
+ [size_is(attributesIssuerLength,attributesIssuerLength2)]
+#endif
+ BYTE** attributesIssuer;
+ UINT32 cPrimeLength;
+#ifdef __midl
+ [size_is(cPrimeLength)]
+#endif
+ BYTE* cPrime;
+ UINT32 sELength;
+#ifdef __midl
+ [size_is(sELength)]
+#endif
+ BYTE* sE;
+} TSS_DAA_CRED_ISSUER;
+
+typedef struct tdTSS_DAA_CREDENTIAL
+{
+ TSS_VERSION versionInfo;
+ UINT32 capitalALength;
+#ifdef __midl
+ [size_is(capitalALength)]
+#endif
+ BYTE* capitalA;
+ UINT32 exponentLength;
+#ifdef __midl
+ [size_is(exponentLength)]
+#endif
+ BYTE* exponent;
+ UINT32 vBar0Length;
+#ifdef __midl
+ [size_is(vBar0Length)]
+#endif
+ BYTE* vBar0;
+ UINT32 vBar1Length;
+#ifdef __midl
+ [size_is(vBar1Length)]
+#endif
+ BYTE* vBar1;
+ UINT32 attributesLength; // Length of first dimension
+ UINT32 attributesLength2; // Length of second dimension
+#ifdef __midl
+ [size_is(attributesLength,attributesLength2)]
+#endif
+ BYTE** attributes;
+ TSS_DAA_PK issuerPK;
+ UINT32 tpmSpecificEncLength;
+#ifdef __midl
+ [size_is(tpmSpecificEncLength)]
+#endif
+ BYTE* tpmSpecificEnc;
+ UINT32 daaCounter;
+} TSS_DAA_CREDENTIAL;
+
+typedef struct tdTSS_DAA_ATTRIB_COMMIT
+{
+ TSS_VERSION versionInfo;
+ UINT32 betaLength;
+#ifdef __midl
+ [size_is(betaLength)]
+#endif
+ BYTE* beta;
+ UINT32 sMuLength;
+#ifdef __midl
+ [size_is(sMuLength)]
+#endif
+ BYTE* sMu;
+} TSS_DAA_ATTRIB_COMMIT;
+
+typedef struct tdTSS_DAA_CREDENTIAL_REQUEST
+{
+ TSS_VERSION versionInfo;
+ UINT32 capitalULength;
+#ifdef __midl
+ [size_is(capitalULength)]
+#endif
+ BYTE* capitalU;
+ UINT32 capitalNiLength;
+#ifdef __midl
+ [size_is(capitalNiLength)]
+#endif
+ BYTE* capitalNi;
+ UINT32 authenticationProofLength;
+#ifdef __midl
+ [size_is(authenticationProofLength)]
+#endif
+ BYTE* authenticationProof;
+ UINT32 challengeLength;
+#ifdef __midl
+ [size_is(challengeLength)]
+#endif
+ BYTE* challenge;
+ UINT32 nonceTpmLength;
+#ifdef __midl
+ [size_is(nonceTpmLength)]
+#endif
+ BYTE* nonceTpm;
+ UINT32 noncePlatformLength;
+#ifdef __midl
+ [size_is(noncePlatformLength)]
+#endif
+ BYTE* noncePlatform;
+ UINT32 sF0Length;
+#ifdef __midl
+ [size_is(sF0Length)]
+#endif
+ BYTE* sF0;
+ UINT32 sF1Length;
+#ifdef __midl
+ [size_is(sF1Length)]
+#endif
+ BYTE* sF1;
+ UINT32 sVprimeLength;
+#ifdef __midl
+ [size_is(sVprimeLength)]
+#endif
+ BYTE* sVprime;
+ UINT32 sVtildePrimeLength;
+#ifdef __midl
+ [size_is(sVtildePrimeLength)]
+#endif
+ BYTE* sVtildePrime;
+ UINT32 sALength; // Length of first dimension
+ UINT32 sALength2; // Length of second dimension
+#ifdef __midl
+ [size_is(sALength,sALength2)]
+#endif
+ BYTE** sA;
+ UINT32 attributeCommitmentsLength;
+ TSS_DAA_ATTRIB_COMMIT* attributeCommitments;
+} TSS_DAA_CREDENTIAL_REQUEST;
+
+typedef struct tdTSS_DAA_SELECTED_ATTRIB
+{
+ TSS_VERSION versionInfo;
+ UINT32 indicesListLength;
+#ifdef __midl
+ [size_is(indicesListLength)]
+#endif
+ TSS_BOOL* indicesList;
+} TSS_DAA_SELECTED_ATTRIB;
+
+typedef struct tdTSS_DAA_PSEUDONYM
+{
+ TSS_VERSION versionInfo;
+ TSS_FLAG payloadFlag;
+ UINT32 payloadLength;
+#ifdef __midl
+ [size_is(payloadLength)]
+#endif
+ BYTE* payload;
+} TSS_DAA_PSEUDONYM;
+
+typedef struct tdTSS_DAA_PSEUDONYM_PLAIN
+{
+ TSS_VERSION versionInfo;
+ UINT32 capitalNvLength;
+#ifdef __midl
+ [size_is(capitalNvLength)]
+#endif
+ BYTE* capitalNv;
+} TSS_DAA_PSEUDONYM_PLAIN;
+
+typedef struct tdTSS_DAA_PSEUDONYM_ENCRYPTED
+{
+ TSS_VERSION versionInfo;
+ UINT32 delta1Length;
+#ifdef __midl
+ [size_is(delta1Length)]
+#endif
+ BYTE* delta1;
+ UINT32 delta2Length;
+#ifdef __midl
+ [size_is(delta2Length)]
+#endif
+ BYTE* delta2;
+ UINT32 delta3Length;
+#ifdef __midl
+ [size_is(delta3Length)]
+#endif
+ BYTE* delta3;
+ UINT32 delta4Length;
+#ifdef __midl
+ [size_is(delta4Length)]
+#endif
+ BYTE* delta4;
+ UINT32 sTauLength;
+#ifdef __midl
+ [size_is(sTauLength)]
+#endif
+ BYTE* sTau;
+} TSS_DAA_PSEUDONYM_ENCRYPTED;
+
+typedef struct tdTSS_DAA_SIGN_CALLBACK
+{
+ TSS_VERSION versionInfo;
+ TSS_HHASH challenge;
+ TSS_FLAG payloadFlag;
+ UINT32 payloadLength;
+#ifdef __midl
+ [size_is(payloadLength)]
+#endif
+ BYTE* payload;
+} TSS_DAA_SIGN_CALLBACK;
+
+typedef struct tdTSS_DAA_SIGNATURE
+{
+ TSS_VERSION versionInfo;
+ UINT32 zetaLength;
+#ifdef __midl
+ [size_is(zetaLength)]
+#endif
+ BYTE* zeta;
+ UINT32 capitalTLength;
+#ifdef __midl
+ [size_is(capitalTLength)]
+#endif
+ BYTE* capitalT;
+ UINT32 challengeLength;
+#ifdef __midl
+ [size_is(challengeLength)]
+#endif
+ BYTE* challenge;
+ UINT32 nonceTpmLength;
+#ifdef __midl
+ [size_is(nonceTpmLength)]
+#endif
+ BYTE* nonceTpm;
+ UINT32 sVLength;
+#ifdef __midl
+ [size_is(sVLength)]
+#endif
+ BYTE* sV;
+ UINT32 sF0Length;
+#ifdef __midl
+ [size_is(sF0Length)]
+#endif
+ BYTE* sF0;
+ UINT32 sF1Length;
+#ifdef __midl
+ [size_is(sF1Length)]
+#endif
+ BYTE* sF1;
+ UINT32 sELength;
+#ifdef __midl
+ [size_is(sELength)]
+#endif
+ BYTE* sE;
+ UINT32 sALength; // Length of first dimension
+ UINT32 sALength2; // Length of second dimension
+#ifdef __midl
+ [size_is(sALength,sALength2)]
+#endif
+ BYTE** sA;
+ UINT32 attributeCommitmentsLength;
+#ifdef __midl
+ [size_is(attributeCommitmentsLength)]
+#endif
+ TSS_DAA_ATTRIB_COMMIT* attributeCommitments;
+ TSS_DAA_PSEUDONYM signedPseudonym;
+ TSS_DAA_SIGN_CALLBACK callbackResult;
+} TSS_DAA_SIGNATURE;
+
+typedef struct tdTSS_DAA_IDENTITY_PROOF
+{
+ TSS_VERSION versionInfo;
+ UINT32 endorsementLength;
+#ifdef __midl
+ [size_is(endorsementLength)]
+#endif
+ BYTE* endorsementCredential;
+ UINT32 platformLength;
+#ifdef __midl
+ [size_is(platformLength)]
+#endif
+ BYTE* platform;
+ UINT32 conformanceLength;
+#ifdef __midl
+ [size_is(conformanceLength)]
+#endif
+ BYTE* conformance;
+} TSS_DAA_IDENTITY_PROOF;
+
+
+////////////////////////////////////////////////////////////////////
+
+typedef UINT32 TSS_FAMILY_ID;
+typedef BYTE TSS_DELEGATION_LABEL;
+// Values are TSS_DELEGATIONTYPE_KEY or TSS_DELEGATIONTYPE_OWNER
+typedef UINT32 TSS_DELEGATION_TYPE;
+
+typedef struct tdTSS_PCR_INFO_SHORT
+{
+ UINT32 sizeOfSelect;
+#ifdef __midl
+ [size_is(sizeOfSelect)]
+#endif
+ BYTE *selection;
+ BYTE localityAtRelease;
+ UINT32 sizeOfDigestAtRelease;
+#ifdef __midl
+ [size_is(sizeOfDigestAtRelease)]
+#endif
+ BYTE *digestAtRelease;
+} TSS_PCR_INFO_SHORT;
+
+typedef struct tdTSS_FAMILY_TABLE_ENTRY
+{
+ TSS_FAMILY_ID familyID;
+ TSS_DELEGATION_LABEL label;
+ UINT32 verificationCount;
+ TSS_BOOL enabled;
+ TSS_BOOL locked;
+} TSS_FAMILY_TABLE_ENTRY;
+
+typedef struct tdTSS_DELEGATION_TABLE_ENTRY
+{
+ UINT32 tableIndex;
+ TSS_DELEGATION_LABEL label;
+ TSS_PCR_INFO_SHORT pcrInfo;
+ UINT32 per1;
+ UINT32 per2;
+ TSS_FAMILY_ID familyID;
+ UINT32 verificationCount;
+} TSS_DELEGATION_TABLE_ENTRY;
+
+typedef struct tdTSS_PLATFORM_CLASS
+{
+ UINT32 platformClassSimpleIdentifier;
+ UINT32 platformClassURISize;
+ BYTE* pPlatformClassURI;
+} TSS_PLATFORM_CLASS;
+
+#endif // __TSS_STRUCTS_H__
+
diff --git a/src/include/tss/tss_typedef.h b/src/include/tss/tss_typedef.h
new file mode 100644
index 0000000..c23ef09
--- /dev/null
+++ b/src/include/tss/tss_typedef.h
@@ -0,0 +1,48 @@
+/*++
+
+Global typedefs for TSS
+
+*/
+
+#ifndef __TSS_TYPEDEF_H__
+#define __TSS_TYPEDEF_H__
+
+#include <tss/platform.h>
+
+//--------------------------------------------------------------------
+// definitions for TSS Service Provider (TSP)
+//
+typedef UINT32 TSS_HANDLE;
+
+typedef UINT32 TSS_FLAG; // object attributes
+typedef UINT32 TSS_RESULT; // the return code from a TSS function
+
+typedef UINT32 TSS_HOBJECT; // basic object handle
+typedef TSS_HOBJECT TSS_HCONTEXT; // context object handle
+typedef TSS_HOBJECT TSS_HPOLICY; // policy object handle
+typedef TSS_HOBJECT TSS_HTPM; // TPM object handle
+typedef TSS_HOBJECT TSS_HKEY; // key object handle
+typedef TSS_HOBJECT TSS_HENCDATA; // encrypted data object handle
+typedef TSS_HOBJECT TSS_HPCRS; // PCR composite object handle
+typedef TSS_HOBJECT TSS_HHASH; // hash object handle
+typedef TSS_HOBJECT TSS_HNVSTORE; // NV storage object handle
+typedef TSS_HOBJECT TSS_HMIGDATA; // migration data utility obj handle
+typedef TSS_HOBJECT TSS_HDELFAMILY; // delegation family object handle
+typedef TSS_HOBJECT TSS_HDAA_CREDENTIAL; // daa credential
+typedef TSS_HOBJECT TSS_HDAA_ISSUER_KEY; // daa credential issuer keypair
+typedef TSS_HOBJECT TSS_HDAA_ARA_KEY; // daa anonymity revocation
+ // authority keypair
+
+typedef UINT32 TSS_EVENTTYPE;
+typedef UINT16 TSS_MIGRATE_SCHEME;
+typedef UINT32 TSS_ALGORITHM_ID;
+typedef UINT32 TSS_KEY_USAGE_ID;
+typedef UINT16 TSS_KEY_ENC_SCHEME;
+typedef UINT16 TSS_KEY_SIG_SCHEME;
+typedef BYTE TSS_KEY_AUTH_DATA_USAGE;
+typedef UINT32 TSS_CMK_DELEGATE;
+typedef UINT32 TSS_NV_INDEX;
+typedef UINT32 TSS_COUNTER_ID;
+
+#endif // __TSS_TYPEDEF_H__
+