@@ -249,11 +249,11 @@ gate_reseal_with_integrity_report() {
249249 # starting the NK3 CCID teardown. This safety call covers the
250250 # case where scdaemon was restarted between then and now.
251251 release_scdaemon
252- STATUS " Checking $DONGLE_BRAND presence before sealing"
253252 DEBUG " gate_reseal_with_integrity_report: checking HOTP token presence"
253+ STATUS " Checking $DONGLE_BRAND presence before sealing"
254254 if hotp_verification info > /dev/null 2>&1 ; then
255- token_ok=" y"
256255 STATUS_OK " $DONGLE_BRAND present and accessible"
256+ token_ok=" y"
257257 break
258258 fi
259259 DEBUG " gate_reseal_with_integrity_report: HOTP token not accessible"
@@ -285,10 +285,9 @@ generate_totp_hotp() {
285285 if [ " $CONFIG_TPM " != " y" ] && [ -x /bin/hotp_verification ]; then
286286 # If we don't have a TPM, but we have a HOTP USB Security dongle
287287 TRACE_FUNC
288- STATUS " Generating new HOTP secret"
289288 /bin/seal-hotpkey.sh ||
290289 DIE " Failed to generate HOTP secret"
291- elif STATUS " Generating new TOTP secret " && /bin/seal-totp.sh " $BOARD_NAME " " $tpm_owner_passphrase " ; then
290+ elif /bin/seal-totp.sh " $BOARD_NAME " " $tpm_owner_passphrase " ; then
292291 if [ -x /bin/hotp_verification ]; then
293292 # If we have a TPM and a HOTP USB Security dongle
294293 if [ " $CONFIG_TOTP_SKIP_QRCODE " != y ]; then
@@ -362,6 +361,7 @@ update_totp() {
362361 return 1 # Already asked to skip to menu from a prior error
363362 fi
364363
364+ DEBUG " TPM state at TOTP failure:"
365365 DEBUG " $( pcrs) "
366366
367367 totp_menu_text=$(
@@ -437,6 +437,7 @@ update_hotp() {
437437 local hotp_token_info hotp_exit attempt
438438
439439 # Ensure dongle is present; capture info for PIN counter display
440+ STATUS " Checking $DONGLE_BRAND presence"
440441 if ! hotp_token_info=" $( hotp_verification info) " ; then
441442 if [ " $skip_to_menu " = " true" ]; then
442443 return 1 # Already asked to skip to menu from a prior error
@@ -474,12 +475,14 @@ update_hotp() {
474475 # PIN retry count is shown only before a retry so normal boots stay silent.
475476 for attempt in 1 2 3; do
476477 # Don't output HOTP codes to screen, so as to make replay attacks harder
478+ STATUS " Verifying HOTP code"
477479 hotp_verification check " $HOTP "
478480 hotp_exit=$?
479481 case " $hotp_exit " in
480482 0)
481483 HOTP=" Success"
482484 BG_COLOR_MAIN_MENU=" normal"
485+ STATUS_OK " HOTP code verified"
483486 return
484487 ;;
485488 4 | 7) # 4: code incorrect, 7: not a valid HOTP code — no point retrying same code
@@ -654,7 +657,6 @@ check_gpg_key() {
654657
655658prompt_auto_default_boot () {
656659 TRACE_FUNC
657- STATUS_OK " HOTP verification success"
658660 if pause_automatic_boot; then
659661 STATUS " Attempting default boot"
660662 attempt_default_boot
@@ -867,16 +869,17 @@ reset_tpm() {
867869 DIE " Unable to create rollback file"
868870
869871 TRACE_FUNC
870- # As a countermeasure for existing primary handle hash, we will now force sign /boot without it
871- # USB is already initialized at startup; run gpg --card-status to populate key stub.
872+ # As a countermeasure for existing primary handle hash, we will now force sign /boot without it.
873+ # NOTE: At seal time, PCR5 is IGNORED (not measured) - only used on HOTP board variants. So USB
874+ # modules loading here don't affect DUK seal. GPG card needs USB to be enabled first.
875+ enable_usb
872876 wait_for_gpg_card || true
873877 while true ; do
874878 GPG_KEY_COUNT=$( gpg -K 2> /dev/null | wc -l)
875879 if [ " $GPG_KEY_COUNT " -eq 0 ]; then
876880 prompt_missing_gpg_key_action || return 1
877881 wait_for_gpg_card || true
878882 else
879- STATUS_OK " TPM reset successful - updating /boot checksums and signatures"
880883 if ! update_checksums; then
881884 whiptail_error --title ' ERROR' \
882885 --msgbox " Failed to update checksums / sign default config" 0 80
@@ -896,14 +899,9 @@ reset_tpm() {
896899 fi
897900
898901 if [ -s /boot/kexec_key_devices.txt ] || [ -s /boot/kexec_key_lvm.txt ]; then
899- STATUS_OK " TPM reset successful - resealing TPM Disk Unlock Key (DUK)"
900902 reseal_tpm_disk_decryption_key || prompt_missing_gpg_key_action
901903 fi
902- else
903- INFO " Returning to the main menu"
904904 fi
905- else
906- whiptail_error --title ' ERROR: No TPM Detected' --msgbox " This device does not have a TPM.\n\nPress OK to return to the Main Menu" 0 80
907905 fi
908906}
909907
0 commit comments