google / google/go-tpm

TPM1.2: Some tests against a simulator fail erroneously

Open
#91 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
673
Forks
188
PR merge metrics
No merged PRs in 30d

Description

Failing tests:

- TestMakeIdentity
- TestReadEKCert
- TestPcrExtend
- TestSeal
- TestOwnerReadSRK

Whats happening is the simulator is responding and closing the domain socket - `tpmutil.RunCommand` doesnt seem to like that.

Note that the command seems to be correct - the simulator responds correctly, but closes the socket quick enough that go-tpm gets confused.

### Example trace - TestReadEKCert

```
jsonp@RedShell:~> TPM_PATH=/tmp/s12 go test -v -count=1 -run TestReadEKCert github.com/google/go-tpm/tpm

TPM_IO_Connect: Accepting connection from port /tmp/s12 ...
TPM_IO_ReadBytes: Reading 6 bytes
TPM_IO_Read: through paramSize length 6
00 C1 00 00 00 24
TPM_IO_ReadBytes: Reading 30 bytes
TPM_IO_Read: length 36
00 C1 00 00 00 24 00 00 00 0B 00 02 40 00 00 01
00 FD 95 84 70 DF 9C B1 87 3D 86 46 51 C0 C2 06
6B E0 24 32
TPM_Process_GetCommandParams:
TPM_Process_GetCommandParams: tag 00c1 paramSize 36 ordinal 0000000b
TPM_Process_Preprocess: Ordinal 0000000b
TPM_IO_GetLocality: localityModifier 0
TPM_LocalityModifier_CheckLegal: TPM_MODIFIER_INDICATOR 00000000
TPM_KeyHandleEntries_Trace: 0 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 1 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 2 handle 00000000 tpm_key (nil)
TPM_OrdinalTable_GetProcessFunction: Ordinal 0000000b
TPM_Process_OSAP: Ordinal Entry
TPM_Process_OSAP: entityType 0002
TPM_Process_OSAP: entityValue 40000001
TPM_Nonce_Load:
TPM_GetInParamDigest:
TPM_GetInParamDigest: transportEncrypt 00
TPM_CheckState: Check map 00000031
TPM_AuthSessions_GetNewHandle:
TPM_AuthSessions_IsSpace:
TPM_AuthSessions_IsSpace: Found space at 1
TPM_Handle_GenerateHandle: handle 00000000, keepHandle 0
TPM_Random: Requesting 4 bytes
TPM_AuthSessions_GetEntry: authHandle 2ea33cd9
TPM_AuthSessions_GetEntry: session handle 2ea33cd9 not found
TPM_Handle_GenerateHandle: Assigned Handle 2ea33cd9
TPM_AuthSessions_GetNewHandle: Assigned handle 2ea33cd9
TPM_Process_OSAP: Using authHandle 2ea33cd9
TPM_Nonce_Generate:
TPM_Random: Requesting 20 bytes
TPM_Nonce_Generate:
TPM_Random: Requesting 20 bytes
TPM_AuthSessionData_CheckEncScheme: adipEncScheme 00
TPM_Process_OSAP: entityType TPM_ET_OWNER, ownerReference 40000001
TPM_Digest_Copy:
TPM_Process_OSAP: entityDigest 00 00 00 00
TPM_Process_OSAP: authData 00 00 00 00
TPM_Process_OSAP: nonceEvenOSAP 0c fc bd 49
TPM_Process_OSAP: nonceOddOSAP 00 fd 95 84
TPM_HMAC_Generate:
TPM_HMAC_Generatevalist:
TPM_SHA1_valist:
TPM_SHA1InitCmd:
TPM_SHA1_valist: Digesting 64 bytes
TPM_SHA1Update: length 64
TPM_SHA1_valist: Digesting 20 bytes
TPM_SHA1Update: length 20
TPM_SHA1_valist: Digesting 20 bytes
TPM_SHA1Update: length 20
TPM_SHA1FinalCmd:
TPM_SHA1_valist: Digest d6 6a 08 40
TPM_SHA1Delete:
TPM_SHA1:
TPM_SHA1_valist:
TPM_SHA1InitCmd:
TPM_SHA1_valist: Digesting 64 bytes
TPM_SHA1Update: length 64
TPM_SHA1_valist: Digesting 20 bytes
TPM_SHA1Update: length 20
TPM_SHA1FinalCmd:
TPM_SHA1_valist: Digest 21 ac 7a f8
TPM_SHA1Delete:
TPM_HMAC_Generatevalist: HMAC 21 ac 7a f8
TPM_Process_OSAP: sharedSecret 21 ac 7a f8
TPM_Process_OSAP: Ordinal returnCode 00000000 0
TPM_Sbuffer_StoreInitialResponse: returnCode 00000000
TPM_Nonce_Store:
TPM_Nonce_Store:
TPM_GetOutParamDigest:
TPM_Sbuffer_StoreFinalResponse: returnCode 00000000
TPM_KeyHandleEntries_Trace: 0 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 1 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 2 handle 00000000 tpm_key (nil)
TPM_State_Trace: disable 0 p_deactive 0 v_deactive 0 owned 1 state 2
TPM_IO_Write: length 54
00 C4 00 00 00 36 00 00 00 00 2E A3 3C D9 DE 7F
8E BA 1C 1C 5E 06 A2 5D 9A E0 A1 F1 37 52 80 D4
71 9A 0C FC BD 49 3A 6B 65 CB 49 14 79 15 BE BF
80 E3 A9 22 4D 53
TPM_IO_Connect: Waiting for connections on port /tmp/s12
=== RUN TestReadEKCert
--- FAIL: TestReadEKCert (0.00s)
tpm_test.go:107: Unable to read EKCert from NVRAM: failed to read from NVRAM: write unix @->/tmp/s12: write: broken pipe
FAIL
FAIL github.com/google/go-tpm/tpm 0.027s
```

### Example trace - TestOwnerReadSRK

```
jsonp@RedShell:~> TPM_PATH=/tmp/s12 go test -v -count=1 -run TestOwnerReadSRK github.com/google/go-tpm/tpm
=== RUN TestOwnerReadSRK

TPM_IO_Connect: Accepting connection from port /tmp/s12 ...
TPM_IO_ReadBytes: Reading 6 bytes
TPM_IO_Read: through paramSize length 6
00 C1 00 00 00 24
TPM_IO_ReadBytes: Reading 30 bytes
TPM_IO_Read: length 36
00 C1 00 00 00 24 00 00 00 0B 00 02 40 00 00 01
D4 2B 2F A9 37 4F 0C F5 A2 E5 92 CE 19 F7 57 2B
2D F2 95 55
TPM_Process_GetCommandParams:
TPM_Process_GetCommandParams: tag 00c1 paramSize 36 ordinal 0000000b
TPM_Process_Preprocess: Ordinal 0000000b
TPM_IO_GetLocality: localityModifier 0
TPM_LocalityModifier_CheckLegal: TPM_MODIFIER_INDICATOR 00000000
TPM_KeyHandleEntries_Trace: 0 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 1 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 2 handle 00000000 tpm_key (nil)
TPM_OrdinalTable_GetProcessFunction: Ordinal 0000000b
TPM_Process_OSAP: Ordinal Entry
TPM_Process_OSAP: entityType 0002
TPM_Process_OSAP: entityValue 40000001
TPM_Nonce_Load:
TPM_GetInParamDigest:
TPM_GetInParamDigest: transportEncrypt 00
TPM_CheckState: Check map 00000031
TPM_AuthSessions_GetNewHandle:
TPM_AuthSessions_IsSpace:
TPM_AuthSessions_IsSpace: Found space at 2
TPM_Handle_GenerateHandle: handle 00000000, keepHandle 0
TPM_Random: Requesting 4 bytes
TPM_AuthSessions_GetEntry: authHandle 3bc8c7e6
TPM_AuthSessions_GetEntry: session handle 3bc8c7e6 not found
TPM_Handle_GenerateHandle: Assigned Handle 3bc8c7e6
TPM_AuthSessions_GetNewHandle: Assigned handle 3bc8c7e6
TPM_Process_OSAP: Using authHandle 3bc8c7e6
TPM_Nonce_Generate:
TPM_Random: Requesting 20 bytes
TPM_Nonce_Generate:
TPM_Random: Requesting 20 bytes
TPM_AuthSessionData_CheckEncScheme: adipEncScheme 00
TPM_Process_OSAP: entityType TPM_ET_OWNER, ownerReference 40000001
TPM_Digest_Copy:
TPM_Process_OSAP: entityDigest 00 00 00 00
TPM_Process_OSAP: authData 00 00 00 00
TPM_Process_OSAP: nonceEvenOSAP 75 71 3b bb
TPM_Process_OSAP: nonceOddOSAP d4 2b 2f a9
TPM_HMAC_Generate:
TPM_HMAC_Generatevalist:
TPM_SHA1_valist:
TPM_SHA1InitCmd:
TPM_SHA1_valist: Digesting 64 bytes
TPM_SHA1Update: length 64
TPM_SHA1_valist: Digesting 20 bytes
TPM_SHA1Update: length 20
TPM_SHA1_valist: Digesting 20 bytes
TPM_SHA1Update: length 20
TPM_SHA1FinalCmd:
TPM_SHA1_valist: Digest 86 43 81 70
TPM_SHA1Delete:
TPM_SHA1:
TPM_SHA1_valist:
TPM_SHA1InitCmd:
TPM_SHA1_valist: Digesting 64 bytes
TPM_SHA1Update: length 64
TPM_SHA1_valist: Digesting 20 bytes
TPM_SHA1Update: length 20
TPM_SHA1FinalCmd:
TPM_SHA1_valist: Digest 01 14 d5 d9
TPM_SHA1Delete:
TPM_HMAC_Generatevalist: HMAC 01 14 d5 d9
TPM_Process_OSAP: sharedSecret 01 14 d5 d9
TPM_Process_OSAP: Ordinal returnCode 00000000 0
TPM_Sbuffer_StoreInitialResponse: returnCode 00000000
TPM_Nonce_Store:
TPM_Nonce_Store:
TPM_GetOutParamDigest:
TPM_Sbuffer_StoreFinalResponse: returnCode 00000000
TPM_KeyHandleEntries_Trace: 0 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 1 handle 00000000 tpm_key (nil)
TPM_KeyHandleEntries_Trace: 2 handle 00000000 tpm_key (nil)
TPM_State_Trace: disable 0 p_deactive 0 v_deactive 0 owned 1 state 2
TPM_IO_Write: length 54
00 C4 00 00 00 36 00 00 00 00 3B C8 C7 E6 AC C8
D8 48 6E C3 37 65 2C EC EC F8 13 0B 32 16 4F 5E
18 1A 75 71 3B BB 44 31 11 E4 6F 44 5E BE 3E 08
36 99 18 C1 E5 98
TPM_IO_Connect: Waiting for connections on port /tmp/s12
--- FAIL: TestOwnerReadSRK (0.00s)
tpm_test.go:483: Couldn't read the SRK using owner auth: write unix @->/tmp/s12: write: broken pipe
FAIL
FAIL github.com/google/go-tpm/tpm 0.027s
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.