@@ -665,15 +665,15 @@ tpm2_reset() {
665665 # output TPM Owner Password to a file to be reused in this boot session until recovery shell/reboot
666666 DEBUG " Caching TPM Owner Password to $SECRET_DIR /tpm_owner_password"
667667 echo -n " $tpm_owner_password " > " $SECRET_DIR /tpm_owner_password"
668- tpm2 clear -c platform > /dev/null 2>&1 || LOG " Unable to clear TPM on platform hierarchy "
669- tpm2 changeauth -c owner " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to change owner password "
670- tpm2 changeauth -c endorsement " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to change endorsement password "
671- tpm2 createprimary -C owner -g sha256 -G " ${CONFIG_PRIMARY_KEY_TYPE:- rsa} " \
672- -c " $SECRET_DIR /primary.ctx" -P " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to create primary key "
673- tpm2 evictcontrol -C owner -c " $SECRET_DIR /primary.ctx" " $PRIMARY_HANDLE " \
674- -P " $( tpm2_password_hex " $tpm_owner_password " ) " > /dev/null 2>&1 || LOG " Unable to evict primary key "
675- shred -u " $SECRET_DIR /primary.ctx" > /dev/null 2>&1
676- tpm2_startsession > /dev/null 2>&1 || LOG " Unable to start session "
668+ DO_WITH_DEBUG tpm2 clear -c platform & > /dev/null
669+ DO_WITH_DEBUG tpm2 changeauth -c owner " $( tpm2_password_hex " $tpm_owner_password " ) " & > /dev/null
670+ DO_WITH_DEBUG tpm2 changeauth -c endorsement " $( tpm2_password_hex " $tpm_owner_password " ) " & > /dev/null
671+ DO_WITH_DEBUG tpm2 createprimary -C owner -g sha256 -G " ${CONFIG_PRIMARY_KEY_TYPE:- rsa} " \
672+ -c " $SECRET_DIR /primary.ctx" -P " $( tpm2_password_hex " $tpm_owner_password " ) " & > /dev/null
673+ DO_WITH_DEBUG tpm2 evictcontrol -C owner -c " $SECRET_DIR /primary.ctx" " $PRIMARY_HANDLE " \
674+ -P " $( tpm2_password_hex " $tpm_owner_password " ) " & > /dev/null
675+ shred -u " $SECRET_DIR /primary.ctx" & > /dev/null
676+ DO_WITH_DEBUG tpm2_startsession & > /dev/null
677677
678678 # Set the dictionary attack parameters. TPM2 defaults vary widely, we
679679 # want consistent behavior on any TPM.
@@ -715,17 +715,17 @@ tpm1_reset() {
715715 DEBUG " Caching TPM Owner Password to $SECRET_DIR /tpm_owner_password"
716716 echo -n " $tpm_owner_password " > " $SECRET_DIR /tpm_owner_password"
717717 # Make sure the TPM is ready to be reset
718- tpm physicalpresence -s > /dev/null 2>&1 || LOG " Unable to assert physical presence "
719- tpm physicalenable > /dev/null 2>&1 || LOG " Unable to enable TPM "
720- tpm physicalsetdeactivated -c > /dev/null 2>&1 || LOG " Unable to deactivate TPM "
721- tpm forceclear > /dev/null 2>&1 || LOG " Unable to clear TPM "
722- tpm physicalenable > /dev/null 2>&1 || LOG " Unable to enable TPM "
723- tpm takeown -pwdo " $tpm_owner_password " > /dev/null 2>&1 || LOG " Unable to take ownership of TPM "
718+ DO_WITH_DEBUG tpm physicalpresence -s & > /dev/null
719+ DO_WITH_DEBUG tpm physicalenable & > /dev/null
720+ DO_WITH_DEBUG tpm physicalsetdeactivated -c & > /dev/null
721+ DO_WITH_DEBUG tpm forceclear & > /dev/null
722+ DO_WITH_DEBUG tpm physicalenable & > /dev/null
723+ DO_WITH_DEBUG tpm takeown -pwdo " $tpm_owner_password " & > /dev/null
724724
725725 # And now turn it all back on
726- tpm physicalpresence -s > /dev/null 2>&1 || LOG " Unable to assert physical presence "
727- tpm physicalenable > /dev/null 2>&1 || LOG " Unable to enable TPM "
728- tpm physicalsetdeactivated -c > /dev/null 2>&1 || LOG " Unable to deactivate TPM physical presence requirement "
726+ DO_WITH_DEBUG tpm physicalpresence -s & > /dev/null
727+ DO_WITH_DEBUG tpm physicalenable & > /dev/null
728+ DO_WITH_DEBUG tpm physicalsetdeactivated -c & > /dev/null
729729}
730730
731731# Perform final cleanup before boot and lock the platform heirarchy.
0 commit comments