@@ -650,15 +650,15 @@ tpm2_reset() {
650
650
# output TPM Owner Password to a file to be reused in this boot session until recovery shell/reboot
651
651
DEBUG " Caching TPM Owner Password to $SECRET_DIR /tpm_owner_password"
652
652
echo -n " $tpm_owner_password " > " $SECRET_DIR /tpm_owner_password"
653
- tpm2 clear -c platform || warn " Unable to clear TPM on platform hierarchy"
654
- tpm2 changeauth -c owner " $( tpm2_password_hex " $tpm_owner_password " ) "
655
- tpm2 changeauth -c endorsement " $( tpm2_password_hex " $tpm_owner_password " ) "
653
+ tpm2 clear -c platform > /dev/null 2>&1 || LOG " Unable to clear TPM on platform hierarchy"
654
+ tpm2 changeauth -c owner " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to change owner password "
655
+ tpm2 changeauth -c endorsement " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to change endorsement password "
656
656
tpm2 createprimary -C owner -g sha256 -G " ${CONFIG_PRIMARY_KEY_TYPE:- rsa} " \
657
- -c " $SECRET_DIR /primary.ctx" -P " $( tpm2_password_hex " $tpm_owner_password " ) "
657
+ -c " $SECRET_DIR /primary.ctx" -P " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to create primary key "
658
658
tpm2 evictcontrol -C owner -c " $SECRET_DIR /primary.ctx" " $PRIMARY_HANDLE " \
659
- -P " $( tpm2_password_hex " $tpm_owner_password " ) "
660
- shred -u " $SECRET_DIR /primary.ctx"
661
- tpm2_startsession
659
+ -P " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to evict primary key "
660
+ shred -u " $SECRET_DIR /primary.ctx" > /dev/null 2>&1
661
+ tpm2_startsession > /dev/null 2>&1 || LOG " Unable to start session "
662
662
663
663
# Set the dictionary attack parameters. TPM2 defaults vary widely, we
664
664
# want consistent behavior on any TPM.
@@ -681,7 +681,7 @@ tpm2_reset() {
681
681
--max-tries=10 \
682
682
--recovery-time=3600 \
683
683
--lockout-recovery-time=0 \
684
- --auth=" session:$ENC_SESSION_FILE "
684
+ --auth=" session:$ENC_SESSION_FILE " > /dev/null 2>&1 || LOG " Unable to set dictionary lockout parameters "
685
685
686
686
# Set a random DA lockout password, so the DA lockout can't be cleared
687
687
# with a password. Heads doesn't offer dictionary attach reset, instead
@@ -690,7 +690,7 @@ tpm2_reset() {
690
690
# The default lockout password is empty, so we must set this, and we
691
691
# don't need to provide any auth (use the default empty password).
692
692
tpm2 changeauth -Q -c lockout \
693
- " hex:$( dd if=/dev/urandom bs=32 count=1 status=none 2> /dev/null | xxd -p | tr -d ' \n' ) "
693
+ " hex:$( dd if=/dev/urandom bs=32 count=1 status=none 2> /dev/null | xxd -p | tr -d ' \n' ) " > /dev/null 2>&1 || LOG " Unable to set lockout password "
694
694
}
695
695
tpm1_reset () {
696
696
TRACE_FUNC
@@ -700,17 +700,17 @@ tpm1_reset() {
700
700
DEBUG " Caching TPM Owner Password to $SECRET_DIR /tpm_owner_password"
701
701
echo -n " $tpm_owner_password " > " $SECRET_DIR /tpm_owner_password"
702
702
# Make sure the TPM is ready to be reset
703
- tpm physicalpresence -s
704
- tpm physicalenable
705
- tpm physicalsetdeactivated -c
706
- tpm forceclear
707
- tpm physicalenable
708
- tpm takeown -pwdo " $tpm_owner_password "
703
+ tpm physicalpresence -s > /dev/null 2>&1 || LOG " Unable to assert physical presence "
704
+ tpm physicalenable > /dev/null 2>&1 || > LOG " Unable to enable TPM "
705
+ tpm physicalsetdeactivated -c > /dev/null 2>&1 || LOG " Unable to deactivate TPM "
706
+ tpm forceclear -pwdo " $tpm_owner_password " > /dev/null 2>&1 || LOG " Unable to clear TPM "
707
+ tpm physicalenable > /dev/null 2>&1 || LOG " Unable to enable TPM "
708
+ tpm takeown -pwdo " $tpm_owner_password " > /dev/null 2>&1 || LOG " Unable to take ownership of TPM "
709
709
710
710
# And now turn it all back on
711
- tpm physicalpresence -s
712
- tpm physicalenable
713
- tpm physicalsetdeactivated -c
711
+ tpm physicalpresence -s > /dev/null 2>&1 || LOG " Unable to assert physical presence "
712
+ tpm physicalenable > /dev/null 2>&1 || LOG " Unable to enable TPM "
713
+ tpm physicalsetdeactivated -c > /dev/null 2>&1 || LOG " Unable to deactivate TPM "
714
714
}
715
715
716
716
# Perform final cleanup before boot and lock the platform heirarchy.
0 commit comments