Skip to content

Commit 7168e9c

Browse files
committed
initrd, doc: rename password to passphrase throughout
Complete the passphrase/PIN terminology pass started in the previous commit: rename all internal variables, function names, cache file paths, and code comments that used "password" for TPM/LUKS secrets. - tpmr: tpm2_passphrase_hex, cache_owner_passphrase, tpm_passphrase var, /tmp/secret/tpm_owner_passphrase cache path - functions: prompt_tpm_owner_passphrase, prompt_new_owner_passphrase, WARN strings updated to "TPM Owner Passphrase" - kexec-seal-key: key_passphrase / key_passphrase2 variables - gui-init, oem-factory-reset: call sites updated to match new names - doc/faq.md, doc/keys.md: "disk password" -> "disk passphrase" Terminology: TPM/LUKS secrets are passphrases; GPG smartcard operations use PINs (OpenPGP spec). The --passwordbox whiptail flag is unchanged (external API). Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent 46c3e81 commit 7168e9c

File tree

11 files changed

+165
-165
lines changed

11 files changed

+165
-165
lines changed

doc/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pull off on a Heads system since the boot devices are constrained.
107107
However, without tpmtotp in s3 it is hard to know if the system is in
108108
a safe state when the xscreensaver lock screen comes up. Is it a fake
109109
to deceive you and steal your login password? Maybe! It wouldn't get
110-
your disk password, which is perhaps an improvement.
110+
your disk passphrase, which is perhaps an improvement.
111111

112112

113113
Disk key in TPM (LUKS TPM Disk Unlock Key) or user passphrase?

initrd/bin/gui-init

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ gate_reseal_with_integrity_report() {
275275

276276
generate_totp_hotp() {
277277
TRACE_FUNC
278-
tpm_owner_password="$1" # May be empty, will prompt if needed and empty
278+
tpm_owner_passphrase="$1" # May be empty, will prompt if needed and empty
279279
if [ "$CONFIG_TPM" = "y" ] && tpm_reset_required; then
280280
debug_tpm_reset_required_state
281281
whiptail_error --title 'ERROR: TPM Reset Required' \
@@ -289,7 +289,7 @@ generate_totp_hotp() {
289289
/bin/seal-hotpkey ||
290290
DIE "Failed to generate HOTP secret"
291291
STATUS_OK "HOTP secret generated"
292-
elif STATUS "Generating new TOTP secret" && /bin/seal-totp "$BOARD_NAME" "$tpm_owner_password"; then
292+
elif STATUS "Generating new TOTP secret" && /bin/seal-totp "$BOARD_NAME" "$tpm_owner_passphrase"; then
293293
if [ -x /bin/hotp_verification ]; then
294294
# If we have a TPM and a HOTP USB Security dongle
295295
if [ "$CONFIG_TOTP_SKIP_QRCODE" != y ]; then
@@ -821,13 +821,13 @@ reset_tpm() {
821821
if (whiptail_warning --title 'Reset the TPM' \
822822
--yesno "This will clear the TPM and replace its Owner passphrase with a new one!\n\nDo you want to proceed?" 0 80); then
823823

824-
if ! prompt_new_owner_password; then
824+
if ! prompt_new_owner_passphrase; then
825825
INPUT "Press Enter to return to the menu..."
826826
return 1
827827
fi
828828

829829
STATUS "Resetting TPM"
830-
tpmr reset "$tpm_owner_password"
830+
tpmr reset "$tpm_owner_passphrase"
831831

832832
# now that the TPM is reset, remove invalid TPM counter files
833833
mount_boot
@@ -841,7 +841,7 @@ reset_tpm() {
841841
rm -f /boot/kexec_primhdl_hash.txt
842842

843843
# create Heads TPM counter before any others
844-
check_tpm_counter /boot/kexec_rollback.txt "" "$tpm_owner_password" ||
844+
check_tpm_counter /boot/kexec_rollback.txt "" "$tpm_owner_passphrase" ||
845845
DIE "Unable to find/create tpm counter"
846846

847847
TRACE_FUNC
@@ -850,7 +850,7 @@ reset_tpm() {
850850
DEBUG "TPM_COUNTER: $TPM_COUNTER"
851851
#TPM_COUNTER can be empty
852852

853-
increment_tpm_counter "$TPM_COUNTER" "$tpm_owner_password" ||
853+
increment_tpm_counter "$TPM_COUNTER" "$tpm_owner_passphrase" ||
854854
DIE "Unable to increment tpm counter"
855855

856856
DO_WITH_DEBUG sha256sum /tmp/counter-$TPM_COUNTER >/boot/kexec_rollback.txt ||
@@ -881,7 +881,7 @@ reset_tpm() {
881881
# Clear stale preflight marker before generating fresh TOTP/HOTP.
882882
clear_tpm_reset_required
883883

884-
if ! generate_totp_hotp "$tpm_owner_password"; then
884+
if ! generate_totp_hotp "$tpm_owner_passphrase"; then
885885
return 1
886886
fi
887887

initrd/bin/kexec-seal-key

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,17 @@ fi
143143
MIN_PASSPHRASE_LENGTH=12
144144
attempts=0
145145
while [ $attempts -lt 3 ]; do
146-
key_password=""
147-
INPUT "New LUKS TPM Disk Unlock Key (DUK) passphrase for booting (minimum $MIN_PASSPHRASE_LENGTH characters):" -r -s key_password
148-
if [ ${#key_password} -lt $MIN_PASSPHRASE_LENGTH ]; then
146+
key_passphrase=""
147+
INPUT "New LUKS TPM Disk Unlock Key (DUK) passphrase for booting (minimum $MIN_PASSPHRASE_LENGTH characters):" -r -s key_passphrase
148+
if [ ${#key_passphrase} -lt $MIN_PASSPHRASE_LENGTH ]; then
149149
attempts=$((attempts + 1))
150150
WARN "Disk Unlock Key (DUK) passphrase is too short. Please try again."
151151
continue
152152
fi
153153

154-
key_password2=""
155-
INPUT "Repeat LUKS TPM Disk Unlock Key (DUK) passphrase for booting:" -r -s key_password2
156-
if [ "$key_password" != "$key_password2" ]; then
154+
key_passphrase2=""
155+
INPUT "Repeat LUKS TPM Disk Unlock Key (DUK) passphrase for booting:" -r -s key_passphrase2
156+
if [ "$key_passphrase" != "$key_passphrase2" ]; then
157157
attempts=$((attempts + 1))
158158
WARN "Disk Unlock Key (DUK) passphrases do not match. Please try again."
159159
else
@@ -294,12 +294,12 @@ tpmr calcfuturepcr 6 "/tmp/luksDump.txt" >>"$pcrf"
294294
# We take into consideration user files in cbfs
295295
tpmr pcrread -a 7 "$pcrf"
296296

297-
# tpmr seal may prompt for TPM owner password; avoid DO_WITH_DEBUG here so the
297+
# tpmr seal may prompt for TPM owner passphrase; avoid DO_WITH_DEBUG here so the
298298
# prompt remains visible on console. tpmr logs command details internally.
299299
STATUS "Sealing LUKS TPM Disk Unlock Key into TPM NVRAM (this may take a moment)"
300300
DEBUG "tpmr seal $DUK_KEY_FILE $TPM_INDEX 0,1,2,3,4,5,6,7 $pcrf $TPM_SIZE <hidden>"
301301
tpmr seal "$DUK_KEY_FILE" "$TPM_INDEX" 0,1,2,3,4,5,6,7 "$pcrf" \
302-
"$TPM_SIZE" "$key_password" || DIE "Unable to write LUKS TPM Disk Unlock Key to NVRAM"
302+
"$TPM_SIZE" "$key_passphrase" || DIE "Unable to write LUKS TPM Disk Unlock Key to NVRAM"
303303
STATUS_OK "LUKS TPM Disk Unlock Key sealed successfully"
304304

305305
# should be okay if this fails

initrd/bin/kexec-select-boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ if [ "$CONFIG_TPM2_TOOLS" = "y" ]; then
7272
}
7373
else
7474
WARN "Hash of TPM2 primary key handle does not exist - rebuild it by setting a default OS to boot: Options -> Boot Options -> Show OS Boot Menu -> pick OS -> Make default"
75-
#TODO: Simplify/Automatize TPM2 firmware upgrade process. Today: upgrade, reboot, reseal(type TPM Owner Password), resign, boot
75+
#TODO: Simplify/Automatize TPM2 firmware upgrade process. Today: upgrade, reboot, reseal(type TPM owner passphrase), resign, boot
7676
default_failed="y"
7777
DEBUG "Hash of TPM2 primary key handle does not exist under $PRIMHASH_FILE"
7878
fi

initrd/bin/kexec-unseal-key

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ for tries in 1 2 3; do
3131
# type the LUKS passphrase.
3232
show_totp_until_esc
3333
STATUS "Unlocking LUKS with TPM Disk Unlock Key"
34-
INPUT "Enter LUKS TPM Disk Unlock Key passphrase (blank to abort):" -r -s tpm_password
35-
if [ -z "$tpm_password" ]; then
34+
INPUT "Enter LUKS TPM Disk Unlock Key passphrase (blank to abort):" -r -s tpm_passphrase
35+
if [ -z "$tpm_passphrase" ]; then
3636
DIE "Aborting unseal disk encryption key"
3737
fi
3838

3939
if DO_WITH_DEBUG --mask-position 6 \
4040
tpmr unseal "$TPM_INDEX" "0,1,2,3,4,5,6,7" "$TPM_SIZE" \
41-
"$key_file" "$tpm_password"; then
41+
"$key_file" "$tpm_passphrase"; then
4242
STATUS_OK "TPM Disk Unlock Key unsealed"
4343
exit 0
4444
fi

initrd/bin/oem-factory-reset

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ GPG_GEN_KEY_IN_MEMORY_COPY_TO_SMARTCARD="n"
3333
#Circumvent Librem Key/Nitrokey HOTP firmware bug https://github.com/osresearch/heads/issues/1167
3434
MAX_HOTP_GPG_PIN_LENGTH=25
3535

36-
# What are the Security components affected by custom passwords
36+
# What are the Security components affected by custom passphrases
3737
CUSTOM_PASS_AFFECTED_COMPONENTS=""
3838

3939
# Default GPG Algorithm is RSA
@@ -56,7 +56,7 @@ handle_mode() {
5656
USER_PIN=$CUSTOM_SINGLE_PASS
5757
ADMIN_PIN=$CUSTOM_SINGLE_PASS
5858
TPM_PASS=$CUSTOM_SINGLE_PASS
59-
# User doesn't know this password, really badger them to record it
59+
# User doesn't know this passphrase, really badger them to record it
6060
MAKE_USER_RECORD_PASSPHRASES=y
6161

6262
title_text="OEM Factory Reset Mode"
@@ -66,7 +66,7 @@ handle_mode() {
6666
USER_PIN=$(generate_passphrase --number_words 2 --max_length $MAX_HOTP_GPG_PIN_LENGTH)
6767
ADMIN_PIN=$(generate_passphrase --number_words 2 --max_length $MAX_HOTP_GPG_PIN_LENGTH)
6868
TPM_PASS=$ADMIN_PIN
69-
# User doesn't know this password, really badger them to record it
69+
# User doesn't know this passphrase, really badger them to record it
7070
MAKE_USER_RECORD_PASSPHRASES=y
7171

7272
title_text="User Re-Ownership Mode"
@@ -1261,7 +1261,7 @@ elif [ -z "$luks_new_Disk_Recovery_Key_desired" -a -n "$luks_new_Disk_Recovery_K
12611261
luks_change_passphrase
12621262
fi
12631263

1264-
## reset TPM and set password
1264+
## reset TPM and set passphrase
12651265
if [ "$CONFIG_TPM" = "y" ]; then
12661266
STATUS "Resetting TPM"
12671267
tpmr reset "$TPM_PASS" >/dev/null 2>/tmp/error
@@ -1461,7 +1461,7 @@ while true; do
14611461
whiptail --msgbox "$(echo -e "$passphrases" | fold -w $((WIDTH - 5)))" \
14621462
$HEIGHT $WIDTH --title "Configured secrets"
14631463
if [ "$MAKE_USER_RECORD_PASSPHRASES" != y ]; then
1464-
# Passwords were user-supplied or not complex, we do not need to
1464+
# Passphrases were user-supplied or not complex, we do not need to
14651465
# badger the user to record them
14661466
break
14671467
fi
@@ -1501,6 +1501,6 @@ whiptail --msgbox "${completion_msg}" \
15011501
# Clean LUKS secrets
15021502
luks_secrets_cleanup
15031503
unset luks_passphrase_changed
1504-
unset tpm_owner_password_changed
1504+
unset tpm_owner_passphrase_changed
15051505

15061506
reboot

initrd/bin/seal-totp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ HOST="$1"
1515
if [ -z "$HOST" ]; then
1616
HOST="TPMTOTP"
1717
fi
18-
TPM_PASSWORD="$2"
18+
TPM_PASSPHRASE="$2"
1919

2020
TOTP_SECRET="/tmp/secret/totp.key"
2121
TOTP_SEALED="/tmp/secret/totp.sealed"
@@ -50,7 +50,7 @@ DEBUG "Sealing TOTP without PCR6 involvement (LUKS header consistency is not fir
5050
# pcr 7 is containing measurements of user injected stuff in cbfs
5151
DEBUG "Sealing TOTP with actual state of PCR7 (User injected stuff in cbfs)"
5252
tpmr pcrread -a 7 "$pcrf"
53-
#Make sure we clear the TPM Owner Password from memory in case it failed to be used to seal TOTP
53+
#Make sure we clear the TPM owner passphrase from memory in case it failed to be used to seal TOTP
5454

5555
# if the board has TPM2 tools, check for the primary handle before
5656
# attempting to seal; a missing handle is the most common reason for
@@ -61,9 +61,9 @@ fi
6161

6262
# perform sealing via tpmr. Failures may indicate missing primary handle
6363
# or other TPM state issues. Avoid DO_WITH_DEBUG so interactive prompts
64-
# (TPM owner password on TPM1) are not hidden from the user.
64+
# (TPM owner passphrase on TPM1) are not hidden from the user.
6565
STATUS "Sealing TOTP secret to TPM NVRAM"
66-
if ! tpmr seal "$TOTP_SECRET" "$TPM_NVRAM_SPACE" 0,1,2,3,4,7 "$pcrf" 312 "" "$TPM_PASSWORD"; then
66+
if ! tpmr seal "$TOTP_SECRET" "$TPM_NVRAM_SPACE" 0,1,2,3,4,7 "$pcrf" 312 "" "$TPM_PASSPHRASE"; then
6767
# tpmr already logged details; guide user generically to reset TPM
6868
DIE "Unable to seal TOTP secret to TPM NVRAM; reset the TPM (Options -> TPM/TOTP/HOTP Options -> Reset the TPM in the GUI) and try again."
6969
fi

initrd/bin/tpm-reset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
NOTE "This will erase all keys and secrets from the TPM"
55

6-
prompt_new_owner_password
6+
prompt_new_owner_passphrase
77

8-
tpmr reset "$tpm_owner_password"
8+
tpmr reset "$tpm_owner_passphrase"

0 commit comments

Comments
 (0)