Testing of tpm2-tools can be done by calling some of the binaries, even on uninitialized hardware:
$ /usr/sbin/tpm2_nvlist 1 NV indexes defined.
0. NV Index: 0x1500015 { Hash algorithm(nameAlg):4 The Index attributes(attributes):0x44040004 The size of the data area(dataSize):4 }
$ /usr/sbin/tpm2_listpcrs -s Supported Bank/Algorithm: TPM_ALG_SHA1(0x0004) TPM_ALG_SHA256(0x000b)
$ /usr/sbin/tpm2_listpcrs -g 0x04
Bank/Algorithm: TPM_ALG_SHA1(0x0004) PCR_00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 PCR_01: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 PCR_02: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...]
$ rm ticket hash $ echo "toto" > toto $ cat toto toto $ /usr/sbin/tpm2_hash -H n -g 0x04 -I toto -o hash -t ticket
hierarchyValue: 0x40000007
halg = 0x0004
tpm2_hash succ.
hash value(hex type): e6 e8 ea 74 65 f1 2e 4d 3b 5a 06 7a 4c 4d c6 98 43 6b 34 78
validation value(hex type): $ sha1sum toto e6e8ea7465f12e4d3b5a067a4c4dc698436b3478 toto $ hexdump -vC hash 00000000 14 00 e6 e8 ea 74 65 f1 2e 4d 3b 5a 06 7a 4c 4d |.....te..M;Z.zLM| 00000010 c6 98 43 6b 34 78 00 00 00 00 00 00 00 00 00 00 |..Ck4x..........| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 |..| 00000042 $ hexdump -vC ticket 00000000 24 80 00 00 07 00 00 40 00 00 00 af 77 7f 00 00 |$......@....w...| [...]
Testing of tpm2-tools can be done by calling some of the binaries, even on uninitialized hardware:
$ /usr/sbin/ tpm2_nvlist
1 NV indexes defined.
0. NV Index: 0x1500015 nameAlg) :4 attributes) :0x44040004
{
Hash algorithm(
The Index attributes(
The size of the data area(dataSize):4
}
$ /usr/sbin/ tpm2_listpcrs -s SHA1(0x0004) TPM_ALG_ SHA256( 0x000b)
Supported Bank/Algorithm: TPM_ALG_
$ /usr/sbin/ tpm2_listpcrs -g 0x04
Bank/Algorithm: TPM_ALG_ SHA1(0x0004)
PCR_00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
PCR_01: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
PCR_02: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[...]
$ rm ticket hash
$ echo "toto" > toto
$ cat toto
toto
$ /usr/sbin/tpm2_hash -H n -g 0x04 -I toto -o hash -t ticket
hierarchyValue: 0x40000007
halg = 0x0004
tpm2_hash succ.
hash value(hex type): e6 e8 ea 74 65 f1 2e 4d 3b 5a 06 7a 4c 4d c6 98 43 6b 34 78
validation value(hex type): d3b5a067a4c4dc6 98436b3478 toto
$ sha1sum toto
e6e8ea7465f12e4
$ hexdump -vC hash
00000000 14 00 e6 e8 ea 74 65 f1 2e 4d 3b 5a 06 7a 4c 4d |.....te..M;Z.zLM|
00000010 c6 98 43 6b 34 78 00 00 00 00 00 00 00 00 00 00 |..Ck4x..........|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 |..|
00000042
$ hexdump -vC ticket
00000000 24 80 00 00 07 00 00 40 00 00 00 af 77 7f 00 00 |$......@....w...|
[...]