crypenroll: make slot wiping on pin change a bit more explicit

This commit is contained in:
Lennart Poettering
2024-08-30 14:17:36 +02:00
parent 41bcb93087
commit 43b93a8a26
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -443,7 +443,7 @@ int enroll_tpm2(struct crypt_device *cd,
slot_to_wipe = r;
} else {
log_info("This PCR set is already enrolled, executing no operation.");
*ret_slot_to_wipe = slot_to_wipe;
*ret_slot_to_wipe = -1;
return r; /* return existing keyslot, so that wiping won't kill it */
}
+2
View File
@@ -885,6 +885,8 @@ static int run(int argc, char *argv[]) {
slot = enroll_tpm2(cd, &vk, arg_tpm2_device, arg_tpm2_seal_key_handle, arg_tpm2_device_key, arg_tpm2_hash_pcr_values, arg_tpm2_n_hash_pcr_values, arg_tpm2_public_key, arg_tpm2_load_public_key, arg_tpm2_public_key_pcr_mask, arg_tpm2_signature, arg_tpm2_pin, arg_tpm2_pcrlock, &slot_to_wipe);
if (slot >= 0 && slot_to_wipe >= 0) {
assert(slot != slot_to_wipe);
/* Updating PIN on an existing enrollment */
r = wipe_slots(
cd,