[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 09/15] luks2: Improve error messages in luks2_get_keyslot.
From: |
Patrick Steinhardt |
Subject: |
Re: [PATCH v4 09/15] luks2: Improve error messages in luks2_get_keyslot. |
Date: |
Sun, 15 Nov 2020 10:52:03 +0100 |
On Fri, Nov 06, 2020 at 10:44:29PM -0600, Glenn Washburn wrote:
> Error messages now distinguish between indexes and keys. The former
> include "index" in the error string, and the later are surrounded in quotes.
>
> Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
> ---
> grub-core/disk/luks2.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
> index 1a4034f28..9b171bf9d 100644
> --- a/grub-core/disk/luks2.c
> +++ b/grub-core/disk/luks2.c
> @@ -267,7 +267,7 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k,
> grub_luks2_digest_t *d, grub_luks2_s
> grub_json_getuint64 (&keyslot_key, &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_idx);
> + return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse keyslot index
> %"PRIuGRUB_SIZE, keyslot_idx);
>
> /* Get digest that matches the keyslot. */
> if (grub_json_getvalue (&digests, root, "digests") ||
> @@ -279,13 +279,13 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k,
> grub_luks2_digest_t *d, grub_luks2_s
> grub_json_getuint64 (&digest_key, &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, i);
> + return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest index
> %"PRIuGRUB_SIZE, i);
>
> if ((d->keyslots & (1 << keyslot_key)))
> break;
> }
> if (i == size)
> - return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No digest for keyslot
> %"PRIuGRUB_SIZE, keyslot_idx);
> + return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No digest for keyslot
> \"%"PRIuGRUB_UINT64_T"\"", keyslot_key);
>
> /* Get segment that matches the digest. */
> if (grub_json_getvalue (&segments, root, "segments") ||
> @@ -297,13 +297,13 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k,
> grub_luks2_digest_t *d, grub_luks2_s
> grub_json_getuint64 (&segment_key, &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, i);
> + return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse segment
> index %"PRIuGRUB_SIZE, i);
>
> if ((d->segments & (1 << segment_key)))
> break;
> }
> if (i == size)
> - return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No segment for digest
> %"PRIuGRUB_SIZE);
> + return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No segment for digest
> \"%"PRIuGRUB_UINT64_T"\"", digest_key);
>
> return GRUB_ERR_NONE;
> }
> --
> 2.27.0
>
signature.asc
Description: PGP signature
- Re: [PATCH v4 08/15] luks2: Split idx into three variables: keyslot_key, digest_key, segment_key., (continued)
[PATCH v4 05/15] luks2: Use correct index variable when looping in luks2_get_keyslot., Glenn Washburn, 2020/11/06
[PATCH v4 07/15] luks2: Rename index variable j to i., Glenn Washburn, 2020/11/06
[PATCH v4 09/15] luks2: Improve error messages in luks2_get_keyslot., Glenn Washburn, 2020/11/06
- Re: [PATCH v4 09/15] luks2: Improve error messages in luks2_get_keyslot.,
Patrick Steinhardt <=
[PATCH v4 10/15] luks2: Use more intuitive keyslot key instead of index when naming keyslot., Glenn Washburn, 2020/11/06
[PATCH v4 11/15] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt., Glenn Washburn, 2020/11/06
[PATCH v4 12/15] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors, Glenn Washburn, 2020/11/06