functions: prompt_tpm_owner_password only reuses /tmp/secret/tpm_owner_password if already created by seal functions or itself. Sealing ops not being able to reuse the file shred it (kexec-seal-key and seal-totp)

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
Thierry Laurion 2023-11-02 11:38:50 -04:00
parent 921acd0f6f
commit 48c446cd7d
No known key found for this signature in database
GPG Key ID: E7B4A71658E36A93

View File

@ -194,11 +194,8 @@ list_usb_storage() {
# line, since some flows need it multiple times and only one prompt is ideal.
prompt_tpm_owner_password() {
TRACE "Under /etc/functions:prompt_tpm_owner_password"
#Caller might already have cached the password in tpm_password. If not, prompt for it and cache it externally
if [ -n "$tpm_owner_password" ]; then
DEBUG "tpm_owner_password variable already set by caller. Reusing"
return 0
elif [ -s /tmp/secret/tpm_owner_password ]; then
if [ -s /tmp/secret/tpm_owner_password ]; then
DEBUG "/tmp/secret/tpm_owner_password already cached in file. Reusing"
tpm_owner_password=$(cat /tmp/secret/tpm_owner_password)
return 0