]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
luks2: Add string "index" to user strings using a json index
authorGlenn Washburn <development@efficientek.com>
Tue, 8 Dec 2020 22:45:40 +0000 (16:45 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Sat, 12 Dec 2020 00:19:04 +0000 (01:19 +0100)
This allows error messages to be more easily distinguishable between indexes
and slot keys. The former include the string "index" in the error/debug
string, and the later are surrounded in quotes.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/disk/luks2.c

index 635790eb44e6a1c1517f0611c115a4c611528310..b9f27d9a539c2148144328196a51f7b3fb6be0b1 100644 (file)
@@ -272,7 +272,7 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_luks2_digest_t *d, grub_luks2_s
       grub_json_getuint64 (&k->idx, &keyslot, NULL) ||
       grub_json_getchild (&keyslot, &keyslot, 0) ||
       luks2_parse_keyslot (k, &keyslot))
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse keyslot %"PRIuGRUB_SIZE, keyslot_json_idx);
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse keyslot index %"PRIuGRUB_SIZE, keyslot_json_idx);
 
   /* Get digest that matches the keyslot. */
   if (grub_json_getvalue (&digests, root, "digests") ||
@@ -284,7 +284,7 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_luks2_digest_t *d, grub_luks2_s
          grub_json_getuint64 (&d->idx, &digest, NULL) ||
          grub_json_getchild (&digest, &digest, 0) ||
          luks2_parse_digest (d, &digest))
-       return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest %"PRIuGRUB_SIZE, json_idx);
+       return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest index %"PRIuGRUB_SIZE, json_idx);
 
       if ((d->keyslots & (1 << k->idx)))
        break;
@@ -302,7 +302,7 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_luks2_digest_t *d, grub_luks2_s
          grub_json_getuint64 (&s->idx, &segment, NULL) ||
          grub_json_getchild (&segment, &segment, 0) ||
          luks2_parse_segment (s, &segment))
-       return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse segment %"PRIuGRUB_SIZE, json_idx);
+       return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse segment index %"PRIuGRUB_SIZE, json_idx);
 
       if ((d->segments & (1 << s->idx)))
        break;