If TPM is turned off, the device node (/dev/tpm0) does not exist.
Figure 89. TPM off
TPM can be enabled/disabled from the BIOS
Advanced
menu >
TPM 2.0 Configuration
>
Security Device Support
.
Clear TPM
About this task
If a tpm2_clear command fails, use the following command to make the BIOS reset TPM:
$ echo 5 | sudo tee /sys/class/tpm/tpm0/ppi/request
$ reboot
Then try the tpm2_clear command again.
List PCR values
About this task
Use the following command:
$ sudo tpm2_pcrread
Results
The tpm2_pcrlist is renamed to tpm2_pcrread.
Get random data by TPM
About this task
Use the following command:
$ sudo tpm2_getrandom -o <output file> <number of random bytes>
For example:
$ sudo tpm2_getrandom -o random.out 20
Get hash by TPM
About this task
Use the following command:
sudo tpm2_hash -g <algorithm> -o <output data> <input data>
For example:
$ echo "Dell" > message
$ sudo tpm2_hash -g sha1 -o hash.bin message
Setting Up the Ubuntu Operating System
83