@@ -650,15 +650,15 @@ tpm2_reset() {
650650 # output TPM Owner Password to a file to be reused in this boot session until recovery shell/reboot
651651 DEBUG " Caching TPM Owner Password to $SECRET_DIR /tpm_owner_password"
652652 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 "
656656 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 "
658658 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 "
662662
663663 # Set the dictionary attack parameters. TPM2 defaults vary widely, we
664664 # want consistent behavior on any TPM.
@@ -681,7 +681,7 @@ tpm2_reset() {
681681 --max-tries=10 \
682682 --recovery-time=3600 \
683683 --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 "
685685
686686 # Set a random DA lockout password, so the DA lockout can't be cleared
687687 # with a password. Heads doesn't offer dictionary attach reset, instead
@@ -690,7 +690,7 @@ tpm2_reset() {
690690 # The default lockout password is empty, so we must set this, and we
691691 # don't need to provide any auth (use the default empty password).
692692 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 "
694694}
695695tpm1_reset () {
696696 TRACE_FUNC
@@ -700,17 +700,17 @@ tpm1_reset() {
700700 DEBUG " Caching TPM Owner Password to $SECRET_DIR /tpm_owner_password"
701701 echo -n " $tpm_owner_password " > " $SECRET_DIR /tpm_owner_password"
702702 # 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 "
709709
710710 # 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 "
714714}
715715
716716# Perform final cleanup before boot and lock the platform heirarchy.
0 commit comments