1 // This file was extracted from the TCG Published 2 // Trusted Platform Module Library 3 // Part 4: Supporting Routines 4 // Family "2.0" 5 // Level 00 Revision 01.16 6 // October 30, 2014 7 8 #ifndef TCP_TPM_PROTOCOL_H 9 #define TCP_TPM_PROTOCOL_H 10 // 11 // TPM Commands. All commands acknowledge processing by returning a UINT32 == 0 except where 12 // noted 13 // 14 #define TPM_SIGNAL_POWER_ON 1 15 #define TPM_SIGNAL_POWER_OFF 2 16 #define TPM_SIGNAL_PHYS_PRES_ON 3 17 #define TPM_SIGNAL_PHYS_PRES_OFF 4 18 #define TPM_SIGNAL_HASH_START 5 19 #define TPM_SIGNAL_HASH_DATA 6 20 // {UINT32 BufferSize, BYTE[BufferSize] Buffer} 21 #define TPM_SIGNAL_HASH_END 7 22 #define TPM_SEND_COMMAND 8 23 // {BYTE Locality, UINT32 InBufferSize, BYTE[InBufferSize] InBuffer} -> 24 // {UINT32 OutBufferSize, BYTE[OutBufferSize] OutBuffer} 25 #define TPM_SIGNAL_CANCEL_ON 9 26 #define TPM_SIGNAL_CANCEL_OFF 10 27 #define TPM_SIGNAL_NV_ON 11 28 #define TPM_SIGNAL_NV_OFF 12 29 #define TPM_SIGNAL_KEY_CACHE_ON 13 30 #define TPM_SIGNAL_KEY_CACHE_OFF 14 31 #define TPM_REMOTE_HANDSHAKE 15 32 #define TPM_SET_ALTERNATIVE_RESULT 16 33 #define TPM_SIGNAL_RESET 17 34 #define TPM_SESSION_END 20 35 #define TPM_STOP 21 36 #define TPM_GET_COMMAND_RESPONSE_SIZES 25 37 #define TPM_TEST_FAILURE_MODE 30 38 enum TpmEndPointInfo 39 { 40 tpmPlatformAvailable = 0x01, 41 tpmUsesTbs = 0x02, 42 tpmInRawMode = 0x04, 43 tpmSupportsPP = 0x08 44 }; 45 // Existing RPC interface type definitions retained so that the implementation 46 // can be re-used 47 typedef struct 48 { 49 unsigned long BufferSize; 50 unsigned char *Buffer; 51 } _IN_BUFFER; 52 typedef unsigned char *_OUTPUT_BUFFER; 53 typedef struct 54 { 55 uint32_t BufferSize; 56 _OUTPUT_BUFFER Buffer; 57 } _OUT_BUFFER; 58 //** TPM Command Function Prototypes 59 void _rpc__Signal_PowerOn(BOOL isReset); 60 void _rpc__Signal_PowerOff(); 61 void _rpc__ForceFailureMode(); 62 void _rpc__Signal_PhysicalPresenceOn(); 63 void _rpc__Signal_PhysicalPresenceOff(); 64 void _rpc__Signal_Hash_Start(); 65 void _rpc__Signal_Hash_Data( 66 _IN_BUFFER input 67 ); 68 void _rpc__Signal_HashEnd(); 69 void _rpc__Send_Command( 70 unsigned char locality, 71 _IN_BUFFER request, 72 _OUT_BUFFER *response 73 ); 74 void _rpc__Signal_CancelOn(); 75 void _rpc__Signal_CancelOff(); 76 void _rpc__Signal_NvOn(); 77 void _rpc__Signal_NvOff(); 78 BOOL _rpc__InjectEPS( 79 const char* seed, 80 int seedSize 81 ); 82 // 83 // start the TPM server on the indicated socket. The TPM is single-threaded and will accept connections 84 // first-come-first-served. Once a connection is dropped another client can connect. 85 // 86 BOOL TpmServer(SOCKET ServerSocket); 87 #endif 88