[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/2] luks2: Improve error reporting when recovering keys

From: Patrick Steinhardt
Subject: [PATCH v2 2/2] luks2: Improve error reporting when recovering keys
Date: Thu, 16 Apr 2020 19:15:17 +0200

While we already set up error messages in both `luks2_verify_key()` and
`luks2_decrypt_key()`, we do not ever print them in the calling function
`luks2_recover_key()`. This makes it really hard to discover why a given
key actually failed to decrypt a disk.

Improve this by including the error message in the user-visible output.

Signed-off-by: Patrick Steinhardt <address@hidden>
Reviewed-by: Daniel Kiper <address@hidden>
 grub-core/disk/luks2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
index e3ff7c83d..a48bddf5d 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -610,14 +610,16 @@ luks2_recover_key (grub_disk_t disk,
                               (const grub_uint8_t *) passphrase, grub_strlen 
       if (ret)
-         grub_dprintf ("luks2", "Decryption with keyslot %"PRIuGRUB_SIZE" 
failed\n", i);
+         grub_dprintf ("luks2", "Decryption with keyslot %"PRIuGRUB_SIZE" 
failed: %s\n",
+                       i, grub_errmsg);
       ret = luks2_verify_key (&digest, candidate_key, keyslot.key_size);
       if (ret)
-         grub_dprintf ("luks2", "Could not open keyslot %"PRIuGRUB_SIZE"\n", 
+         grub_dprintf ("luks2", "Could not open keyslot %"PRIuGRUB_SIZE": 
+                       i, grub_errmsg);

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]