src/zlevis-decrypt: added id to tmp-files properly

This commit is contained in:
Luc Bijl 2025-02-10 15:55:18 +01:00
parent 024ea1195b
commit 67e14db930

View file

@ -76,8 +76,8 @@ if [ -n "$pcr_ids" ]; then
fi
# Define and trap tmp jwk_pub and jwk_priv
tmp_jwk_pub="/tmp/jwk_pub.$"
tmp_jwk_priv="/tmp/jwk_priv.$"
tmp_jwk_pub="/tmp/jwk_pub.$$"
tmp_jwk_priv="/tmp/jwk_priv.$$"
trap 'rm -f "$tmp_jwk_pub" "$tmp_jwk_priv"' EXIT
# Decode the public and private keys from Base64
@ -91,7 +91,7 @@ if ! printf "%s" "$jwk_priv" | jose b64 dec -i- -O "$tmp_jwk_priv"; then
fi
# Define and trap primary_context
tmp_primary_context="/tmp/primary_context.$"
tmp_primary_context="/tmp/primary_context.$$"
trap 'rm -f "$tmp_jwk_pub" "$tmp_jwk_priv" "$tmp_primary_context"' EXIT
# Create the primary key in the TPM
@ -106,7 +106,7 @@ fi
tpm2_flushcontext -t
# Define and trap load_context
tmp_load_context="/tmp/load_context.$"
tmp_load_context="/tmp/load_context.$$"
trap 'rm -f "$tmp_jwk_pub" "$tmp_jwk_priv" "$tmp_primary_context" "$tmp_load_context"' EXIT
# Load the JWK into the TPM