From 07e89d501fc9f6ce190dcd43ddce8b1f6a393909 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 21 Nov 2023 15:28:39 +0100 Subject: [PATCH] =?utf8?q?tpm2-util:=20rename=20json=20field=20"tpm2-pcrlo?= =?utf8?q?ck"=20=E2=86=92=20"tpm2=5Fpcrlock"?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We generally want to avoid to include dashes in json field names. We historically made a mistake there which is hard to fix. But for new fields, let's get this right. We already got it right for a bunch of new fields, hence also make sure to use underscores rather dashes for new additions. This field was added post v254, and since we didn't release since then, let's just rename it. --- src/shared/tpm2-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index 94c4471..5e07b88 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -7006,7 +7006,7 @@ int tpm2_make_luks2_json( JSON_BUILD_PAIR_CONDITION(!!tpm2_asym_alg_to_string(primary_alg), "tpm2-primary-alg", JSON_BUILD_STRING(tpm2_asym_alg_to_string(primary_alg))), JSON_BUILD_PAIR("tpm2-policy-hash", JSON_BUILD_HEX(policy_hash, policy_hash_size)), JSON_BUILD_PAIR("tpm2-pin", JSON_BUILD_BOOLEAN(flags & TPM2_FLAGS_USE_PIN)), - JSON_BUILD_PAIR("tpm2-pcrlock", JSON_BUILD_BOOLEAN(flags & TPM2_FLAGS_USE_PCRLOCK)), + JSON_BUILD_PAIR("tpm2_pcrlock", JSON_BUILD_BOOLEAN(flags & TPM2_FLAGS_USE_PCRLOCK)), JSON_BUILD_PAIR_CONDITION(pubkey_pcr_mask != 0, "tpm2_pubkey_pcrs", JSON_BUILD_VARIANT(pkmj)), JSON_BUILD_PAIR_CONDITION(pubkey_pcr_mask != 0, "tpm2_pubkey", JSON_BUILD_BASE64(pubkey, pubkey_size)), JSON_BUILD_PAIR_CONDITION(salt, "tpm2_salt", JSON_BUILD_BASE64(salt, salt_size)), @@ -7125,7 +7125,7 @@ int tpm2_parse_luks2_json( SET_FLAG(flags, TPM2_FLAGS_USE_PIN, json_variant_boolean(w)); } - w = json_variant_by_key(v, "tpm2-pcrlock"); + w = json_variant_by_key(v, "tpm2_pcrlock"); if (w) { if (!json_variant_is_boolean(w)) return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "TPM2 pclock policy is not a boolean."); -- 2.7.4