All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: grub-devel@gnu.org
Cc: Daniel Kiper <dkiper@net-space.pl>
Subject: [PATCH v2 1/2] luks2: Propagate error when reading area key fails
Date: Thu, 16 Apr 2020 19:15:12 +0200	[thread overview]
Message-ID: <8edbf018bba349685fc87c48f3241fbcb36b83e2.1587057064.git.ps@pks.im> (raw)
In-Reply-To: <cover.1587057064.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

When decrypting a given keyslot, all error cases except for one set up
an error and return the error code. The only exception is when we try to
read the area key: instead of setting up an error message, we directly
print it via `grub_dprintf()`.

Convert the outlier to use `grub_error()` to allow more uniform handling
of errors.

Signed-off-by: Patrick Steinhardt <ps@kps.im>
---
 grub-core/disk/luks2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
index 65c4f0aac..e3ff7c83d 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -487,7 +487,7 @@ luks2_decrypt_key (grub_uint8_t *out_key,
   ret = grub_disk_read (disk, 0, k->area.offset, k->area.size, split_key);
   if (ret)
     {
-      grub_dprintf ("luks2", "Read error: %s\n", grub_errmsg);
+      grub_error (GRUB_ERR_IO, "Read error: %s\n", grub_errmsg);
       goto err;
     }
 
-- 
2.26.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-04-16 17:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 10:19 [PATCH] luks2: Improve error reporting when decrypting/verifying key Patrick Steinhardt
2020-04-16 12:27 ` Daniel Kiper
2020-04-16 12:36   ` Patrick Steinhardt
2020-04-16 12:57     ` Daniel Kiper
2020-04-16 17:15 ` [PATCH v2 0/2] Improve LUKS2 error reporting Patrick Steinhardt
2020-04-16 17:15   ` Patrick Steinhardt [this message]
2020-04-16 17:15   ` [PATCH v2 2/2] luks2: Improve error reporting when recovering keys Patrick Steinhardt
2020-04-17 13:54   ` [PATCH v2 0/2] Improve LUKS2 error reporting Daniel Kiper
2020-05-30 10:16     ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8edbf018bba349685fc87c48f3241fbcb36b83e2.1587057064.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.