In the Windows SDK (Vista and above), there exists tbs.h/dll/lib to interace with TPM Base Services. I want to execute some TPM commands, and see MSDN reference to the following http://msdn.microsoft.com/en-us/library/windows/desktop/aa446799(v=vs.85).aspx
I am not sure how to construct my "command buffer" and pass any specific commands. I can't find any specific examples of this anywhere.
I want to use TPM_Seal, but haven't the slightest on how to setup the command.
I setup a basic C++ app that creates the TBS context below, and this is successful.
TBS_CONTEXT_PARAMS pContextParams;
TBS_HCONTEXT hContext;
TBS_RESULT rv;
pContextParams.version = TBS_CONTEXT_VERSION_ONE;
rv = Tbsi_Context_Create(&pContextParams, &hContext);
printf("\n1 RESULT : %x STATUS : %x", rv, hContext);
BYTE data[10] = {0,0xc0,0,0,0,0x0a,0,0,0,0x50};
BYTE buf[512];
UINT32 buf_len = 512;
rv = Tbsip_Submit_Command(hContext,0,TBS_COMMAND_PRIORITY_NORMAL,data,10,buf,&buf_len);
printf("\n2 RESULT : %x STATUS : %x", rv, hContext);
rv = Tbsip_Context_Close(hContext);
printf("\n3 RESULT : %x STATUS : %x", rv, hContext);
This example works and seems to pass the commands correctly -- I just need to find some info on how to get the "right" command sequence into the command buffer.
The function references are here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa446799(v=vs.85).aspx
And the tbs.h does not include any structures relating to the commands. Most of the examples I see are using TSS API (which I don't think I can use on windows.)
Information I've gathered so far:
TPM Data Structures are Listed here: http://www.trustedcomputinggroup.org/files/static_page_files/E55A303C-1A4B-B294-D066E66A82DAE27D/TPM%20Main-Part%202%20TPM%20Structures_v1.2_rev116_01032011.pdf
TrouSerS (http://trousers.sourceforge.net/) has a set of include files that painstakingly defines all of the various bytecodes defined above.