Bill Martin
2015-11-17 17:22:08 UTC
I am using Trousers 0.3.10 and use an Infineon SLB9645 TPM.
In 15.2 of "TPM Main Part 3 Commands" spec for TPM 1.2â I see from the description of the TPM_ActivateIdentity command that the hash of the identity key might be calculated - provided a payload is a TPM_ASYM_CA_CONTENTS form. Does this hash get stored in the TPM?
I'm trying a DAA_Sign operation (stage 10, yes I have managed to get 0.3.10 DAA going, without anonymity revocation and the commitment TODOs) and I previously loaded the AIK by UUID. I have the payload flag set to 0 to indicate to use a key handle, so I passed in the AIK handle. I get out a 0x58, indicating bad handle. signdata.payload is set to 0xC0000009, which is the handle I get for the AIK. Just in case, I tried swapping the bytes. I have added some debug statements into my copy of Trousers 0.3.10 and test_sign.c
So before the Tspi_DAA_Sign call in test_sign, I load the key:
LOG_DEBUG TSPI rpc/tcstp/rpc_ps.c:339 RPC_LoadKeyByUUID_TP: TCS key handle: 0x22330000
LOG_DEBUG TSPI rpc/tcstp/rpc_ps.c:274 RPC_GetRegisteredKeyBlob_TP: TCS Context: 0xa0dfb500
TCSD tcsd_threads.c:232 total_recv_size 50, buf_size 1024, recd_so_far 28
TCSD tcsd_threads.c:277 recv_chunk_size 22 recd_so_far 28
TCSD tcsd_threads.c:284 Rx'd packet
TCSD TCS rpc/tcstp/rpc.c:581 Dispatching ordinal 9 (GetRegisteredKeyBlob)
TCSD TCS rpc/tcstp/rpc_ps.c:140 tcs_wrap_GetRegisteredKeyBlob: thread -1228499856 context a0dfb500
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: Version: 1.1.0.0
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: keyUsage: 0x12
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: keyFlags: 0x4
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: authDatausage: 0
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: pcrInfosize: 0
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: encDataSize: 256
TCSD tcsd_threads.c:313 Sending 0x251 bytes back
Loaded AIK!
LOG_DEBUG TSPI test_sign.c:429 signData.payload is 0xdb4de0
LOG_DEBUG TSPI test_sign.c:431 signData.payloadLength is 4
LOG_DEBUG TSPI test_sign.c:433 *AIK_Address is 0xC0000009
LOG_DEBUG TSPI test_sign.c:440 *(unsigned int*)signData.payload is 0x90000C0
LOG_DEBUG TSPI tspi_daa.c:687 -> TSPI_TPM_DAA_Sign hDAA=-1073741816 hTPM=-1073741820
LOG_DEBUG TSPI daa/daa_verifier/verifier_transaction.c:113 project_into_group_gamma: rho [26]:CDA06AB6C81AD2C69A63258975F19DE621F8707EF8509D6DE5F1
â
I swapped the key's bytes in the above case if that is what the TPM wants. The listing below of stage 10 processing shows it in the hex dump in the order 0xC0000009:
LOG_DEBUG TSPI daa/daa_platform/platform.c:167 Tcsip_TPM_DAA_Sign(tcsContext=c0000001,hDAA=c0000008,sign_session=f8975c, hTPM=c0000004 stage=10)
LOG_DEBUG TSPI daa/daa_platform/platform.c:169 obj_tpm_get_policy(hTPM=C0000004)
LOG_DEBUG TSPI daa/daa_platform/platform.c:172 Trspi_LoadBlob_UINT32(&offset, TPM_ORD_DAA_Sign, hashblob)
LOG_DEBUG TSPI daa/daa_platform/platform.c:175 Trspi_Hash(TSS_HASH_SHA1, offset, hashblob, digest.digest)
LOG_DEBUG TSPI daa/daa_platform/platform.c:178 Trspi_LoadBlob_UINT32(&offset, 0, hashblob)
LOG_DEBUG TSPI daa/daa_platform/platform.c:181 Trspi_LoadBlob_UINT32(&offset, inputSize0:1
LOG_DEBUG TSPI daa/daa_platform/platform.c:186 Trspi_LoadBlob_UINT32(&offset, inputSize1:4
LOG_DEBUG TSPI rpc/tcstp/rpc_auth.c:37 RPC_OIAP_TP: TCS Context: 0xa0dfb500
TCSD tcsd_threads.c:232 total_recv_size 33, buf_size 1024, recd_so_far 28
TCSD tcsd_threads.c:277 recv_chunk_size 5 recd_so_far 28
TCSD tcsd_threads.c:284 Rx'd packet
TCSD TCS rpc/tcstp/rpc.c:581 Dispatching ordinal 23 (OIAP)
TCSD TCS rpc/tcstp/rpc_auth.c:44 tcs_wrap_OIAP: thread -1228499856 context a0dfb500
TCSD TCS tcsi_auth.c:40 Entering TCSI_OIAP
To TPM: 00 C1 00 00 00 0A 00 00 00 0A
TCSD TDDL tddl.c:171 Calling write to driver
From TPM: 00 C4 00 00 00 22 00 00 00 00 00 4E CA B1 AC 28
From TPM: 79 F7 BD B0 BA 47 D8 32 1F 2D A3 97 0A 96 2C BE
From TPM: B7 BA
TCSD TCS tcs_auth_mgr.c:383 added auth for TCS a0dfb500 TPM 4ecab1
TCSD tcsd_threads.c:313 Sending 0x36 bytes back
LOG_DEBUG TSPI obj_policy.c:230 Got a secret:
04 0C 8B 0D B6 11 64 34 7A C1 23 FE 39 AC 17 3A
6F 2D 2F B1
LOG_DEBUG TSPI daa/daa_platform/platform.c:194 secret_PerformAuth_OIAP(hTPM, TPM_ORD_DAA_Sign ret=0
LOG_DEBUG TSPI daa/daa_platform/platform.c:201 TCSP_DAASign(c0000001,c0000004,stage=a,1,befef7cb,4,db4de0,befef764)
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:121 RPC_DaaSign_TP: stage=10
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:124 RPC_DaaSign_TP: TCS Context: 0xa0dfb500
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:133 RPC_DaaSign_TP: inputSize0=<network>=1 <host>=1
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:138 RPC_DaaSign_TP: inputSize1=<network>=4 <host>=4
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:145 RPC_DaaSign_TP: sendTCSDPacket: 0xdb72d0
TCSD tcsd_threads.c:232 total_recv_size 103, buf_size 1024, recd_so_far 28
TCSD tcsd_threads.c:277 recv_chunk_size 75 recd_so_far 28
TCSD tcsd_threads.c:284 Rx'd packet
TCSD TCS rpc/tcstp/rpc.c:581 Dispatching ordinal 75 (DaaSign)
TCSD TCS rpc/tcstp/rpc_daa.c:155 tcs_wrap_DaaSign: thread -1228499856 hDAA f8975c
TCSD TCS rpc/tcstp/rpc_daa.c:159 tcs_wrap_DaaSign: getData 2 (stage=10)
TCSD TCS rpc/tcstp/rpc_daa.c:163 getData 3 inputSize0=1
TCSD TCS rpc/tcstp/rpc_daa.c:171 getData 4 inputData0
TCSD TCS rpc/tcstp/rpc_daa.c:177 getData 5
TCSD TCS rpc/tcstp/rpc_daa.c:182 getData 5 inputSize1=4
TCSD TCS rpc/tcstp/rpc_daa.c:192 getData 6 inputData1
TCSD TCS rpc/tcstp/rpc_daa.c:200 getData 7
TCSD TCS rpc/tcstp/rpc_daa.c:207 tcs_wrap_DaaSign: -> TCSP_DaaSign_internal
TCSD TCS tcsi_daa.c:128 TCSP_DaaSign_internal: Enter
TCSD TCS tcsi_daa.c:162 req_mgr_submit_req (oldOffset=73)
To TPM: 00 C2 00 00 00 49 00 00 00 31 00 F8 97 5C 0A 00
To TPM: 00 00 01 00 00 00 00 04 C0 00 00 09 00 4E CA B1
To TPM: 7D DC 9C 1F D1 68 1C 2B 3C FB C3 57 CB 04 DF 1A
To TPM: 10 99 76 83 00 C3 67 E3 9C 63 82 7B EF 28 F3 22
To TPM: 0F A5 D9 4F 45 5A 76 EF 41
TCSD TDDL tddl.c:171 Calling write to driver
From TPM: 00 C4 00 00 00 0A 00 00 00 58
LOG_RETERR TPM tcsi_daa.c:165: 0x58
TCSD TCS tcsi_daa.c:166 UnloadBlob (paramSize=10) result=88
TCSD TCS tcsi_daa.c:188 Leaving DaaSign with result:88
thanks in advance.
Bill
In 15.2 of "TPM Main Part 3 Commands" spec for TPM 1.2â I see from the description of the TPM_ActivateIdentity command that the hash of the identity key might be calculated - provided a payload is a TPM_ASYM_CA_CONTENTS form. Does this hash get stored in the TPM?
I'm trying a DAA_Sign operation (stage 10, yes I have managed to get 0.3.10 DAA going, without anonymity revocation and the commitment TODOs) and I previously loaded the AIK by UUID. I have the payload flag set to 0 to indicate to use a key handle, so I passed in the AIK handle. I get out a 0x58, indicating bad handle. signdata.payload is set to 0xC0000009, which is the handle I get for the AIK. Just in case, I tried swapping the bytes. I have added some debug statements into my copy of Trousers 0.3.10 and test_sign.c
So before the Tspi_DAA_Sign call in test_sign, I load the key:
LOG_DEBUG TSPI rpc/tcstp/rpc_ps.c:339 RPC_LoadKeyByUUID_TP: TCS key handle: 0x22330000
LOG_DEBUG TSPI rpc/tcstp/rpc_ps.c:274 RPC_GetRegisteredKeyBlob_TP: TCS Context: 0xa0dfb500
TCSD tcsd_threads.c:232 total_recv_size 50, buf_size 1024, recd_so_far 28
TCSD tcsd_threads.c:277 recv_chunk_size 22 recd_so_far 28
TCSD tcsd_threads.c:284 Rx'd packet
TCSD TCS rpc/tcstp/rpc.c:581 Dispatching ordinal 9 (GetRegisteredKeyBlob)
TCSD TCS rpc/tcstp/rpc_ps.c:140 tcs_wrap_GetRegisteredKeyBlob: thread -1228499856 context a0dfb500
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: Version: 1.1.0.0
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: keyUsage: 0x12
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: keyFlags: 0x4
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: authDatausage: 0
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: pcrInfosize: 0
TCSD TCS ps/tcsps.c:191 psfile_get_key_by_uuid: encDataSize: 256
TCSD tcsd_threads.c:313 Sending 0x251 bytes back
Loaded AIK!
LOG_DEBUG TSPI test_sign.c:429 signData.payload is 0xdb4de0
LOG_DEBUG TSPI test_sign.c:431 signData.payloadLength is 4
LOG_DEBUG TSPI test_sign.c:433 *AIK_Address is 0xC0000009
LOG_DEBUG TSPI test_sign.c:440 *(unsigned int*)signData.payload is 0x90000C0
LOG_DEBUG TSPI tspi_daa.c:687 -> TSPI_TPM_DAA_Sign hDAA=-1073741816 hTPM=-1073741820
LOG_DEBUG TSPI daa/daa_verifier/verifier_transaction.c:113 project_into_group_gamma: rho [26]:CDA06AB6C81AD2C69A63258975F19DE621F8707EF8509D6DE5F1
â
I swapped the key's bytes in the above case if that is what the TPM wants. The listing below of stage 10 processing shows it in the hex dump in the order 0xC0000009:
LOG_DEBUG TSPI daa/daa_platform/platform.c:167 Tcsip_TPM_DAA_Sign(tcsContext=c0000001,hDAA=c0000008,sign_session=f8975c, hTPM=c0000004 stage=10)
LOG_DEBUG TSPI daa/daa_platform/platform.c:169 obj_tpm_get_policy(hTPM=C0000004)
LOG_DEBUG TSPI daa/daa_platform/platform.c:172 Trspi_LoadBlob_UINT32(&offset, TPM_ORD_DAA_Sign, hashblob)
LOG_DEBUG TSPI daa/daa_platform/platform.c:175 Trspi_Hash(TSS_HASH_SHA1, offset, hashblob, digest.digest)
LOG_DEBUG TSPI daa/daa_platform/platform.c:178 Trspi_LoadBlob_UINT32(&offset, 0, hashblob)
LOG_DEBUG TSPI daa/daa_platform/platform.c:181 Trspi_LoadBlob_UINT32(&offset, inputSize0:1
LOG_DEBUG TSPI daa/daa_platform/platform.c:186 Trspi_LoadBlob_UINT32(&offset, inputSize1:4
LOG_DEBUG TSPI rpc/tcstp/rpc_auth.c:37 RPC_OIAP_TP: TCS Context: 0xa0dfb500
TCSD tcsd_threads.c:232 total_recv_size 33, buf_size 1024, recd_so_far 28
TCSD tcsd_threads.c:277 recv_chunk_size 5 recd_so_far 28
TCSD tcsd_threads.c:284 Rx'd packet
TCSD TCS rpc/tcstp/rpc.c:581 Dispatching ordinal 23 (OIAP)
TCSD TCS rpc/tcstp/rpc_auth.c:44 tcs_wrap_OIAP: thread -1228499856 context a0dfb500
TCSD TCS tcsi_auth.c:40 Entering TCSI_OIAP
To TPM: 00 C1 00 00 00 0A 00 00 00 0A
TCSD TDDL tddl.c:171 Calling write to driver
From TPM: 00 C4 00 00 00 22 00 00 00 00 00 4E CA B1 AC 28
From TPM: 79 F7 BD B0 BA 47 D8 32 1F 2D A3 97 0A 96 2C BE
From TPM: B7 BA
TCSD TCS tcs_auth_mgr.c:383 added auth for TCS a0dfb500 TPM 4ecab1
TCSD tcsd_threads.c:313 Sending 0x36 bytes back
LOG_DEBUG TSPI obj_policy.c:230 Got a secret:
04 0C 8B 0D B6 11 64 34 7A C1 23 FE 39 AC 17 3A
6F 2D 2F B1
LOG_DEBUG TSPI daa/daa_platform/platform.c:194 secret_PerformAuth_OIAP(hTPM, TPM_ORD_DAA_Sign ret=0
LOG_DEBUG TSPI daa/daa_platform/platform.c:201 TCSP_DAASign(c0000001,c0000004,stage=a,1,befef7cb,4,db4de0,befef764)
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:121 RPC_DaaSign_TP: stage=10
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:124 RPC_DaaSign_TP: TCS Context: 0xa0dfb500
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:133 RPC_DaaSign_TP: inputSize0=<network>=1 <host>=1
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:138 RPC_DaaSign_TP: inputSize1=<network>=4 <host>=4
LOG_DEBUG TSPI rpc/tcstp/rpc_daa.c:145 RPC_DaaSign_TP: sendTCSDPacket: 0xdb72d0
TCSD tcsd_threads.c:232 total_recv_size 103, buf_size 1024, recd_so_far 28
TCSD tcsd_threads.c:277 recv_chunk_size 75 recd_so_far 28
TCSD tcsd_threads.c:284 Rx'd packet
TCSD TCS rpc/tcstp/rpc.c:581 Dispatching ordinal 75 (DaaSign)
TCSD TCS rpc/tcstp/rpc_daa.c:155 tcs_wrap_DaaSign: thread -1228499856 hDAA f8975c
TCSD TCS rpc/tcstp/rpc_daa.c:159 tcs_wrap_DaaSign: getData 2 (stage=10)
TCSD TCS rpc/tcstp/rpc_daa.c:163 getData 3 inputSize0=1
TCSD TCS rpc/tcstp/rpc_daa.c:171 getData 4 inputData0
TCSD TCS rpc/tcstp/rpc_daa.c:177 getData 5
TCSD TCS rpc/tcstp/rpc_daa.c:182 getData 5 inputSize1=4
TCSD TCS rpc/tcstp/rpc_daa.c:192 getData 6 inputData1
TCSD TCS rpc/tcstp/rpc_daa.c:200 getData 7
TCSD TCS rpc/tcstp/rpc_daa.c:207 tcs_wrap_DaaSign: -> TCSP_DaaSign_internal
TCSD TCS tcsi_daa.c:128 TCSP_DaaSign_internal: Enter
TCSD TCS tcsi_daa.c:162 req_mgr_submit_req (oldOffset=73)
To TPM: 00 C2 00 00 00 49 00 00 00 31 00 F8 97 5C 0A 00
To TPM: 00 00 01 00 00 00 00 04 C0 00 00 09 00 4E CA B1
To TPM: 7D DC 9C 1F D1 68 1C 2B 3C FB C3 57 CB 04 DF 1A
To TPM: 10 99 76 83 00 C3 67 E3 9C 63 82 7B EF 28 F3 22
To TPM: 0F A5 D9 4F 45 5A 76 EF 41
TCSD TDDL tddl.c:171 Calling write to driver
From TPM: 00 C4 00 00 00 0A 00 00 00 58
LOG_RETERR TPM tcsi_daa.c:165: 0x58
TCSD TCS tcsi_daa.c:166 UnloadBlob (paramSize=10) result=88
TCSD TCS tcsi_daa.c:188 Leaving DaaSign with result:88
thanks in advance.
Bill