]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2-util: rename json field "tpm2-pcrlock" → "tpm2_pcrlock"
authorLennart Poettering <lennart@poettering.net>
Tue, 21 Nov 2023 14:28:39 +0000 (15:28 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 21 Nov 2023 16:58:48 +0000 (16:58 +0000)
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

index 94c44710e389920bbf2e6e3d06d990d7c85cdc12..5e07b88a895cfdaf0c6e68b1cd679e4d3b9dd564 100644 (file)
@@ -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.");