From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>,
Patrick Steinhardt <ps@pks.im>, John Lane <john@lane.uk.net>,
Glenn Washburn <development@efficientek.com>
Subject: [PATCH v3 0/5] Cryptomount keyfile support
Date: Fri, 20 May 2022 14:32:14 -0500 [thread overview]
Message-ID: <cover.1653074546.git.development@efficientek.com> (raw)
Uupdates from v2:
* Use one error message for all string to interger conversion errors,
suggested by Daniel
* Move placement of keyfile_size == 0 check
Updates from v1:
* Make some changes suggested by Daniel
* Improve error message for grub_strtoull() failures
* Add patch to use enum constants to index parsed option array
Glenn
Denis 'GNUtoo' Carikli (2):
cryptodisk: luks: Unify grub_cryptodisk_dev function names
cryptodisk: geli: Unify grub_cryptodisk_dev function names
Glenn Washburn (2):
cryptodisk: Use enum constants as indexes into cryptomount option
array
docs: Add documentation on keyfile option to cryptomount
John Lane (1):
cryptodisk: Add options to cryptomount to support keyfiles
docs/grub.texi | 14 +++--
grub-core/disk/cryptodisk.c | 110 ++++++++++++++++++++++++++++++++----
grub-core/disk/geli.c | 8 +--
grub-core/disk/luks.c | 4 +-
include/grub/cryptodisk.h | 2 +
include/grub/file.h | 2 +
6 files changed, 119 insertions(+), 21 deletions(-)
Interdiff against v2:
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index ecbda7ce9..e2b8636e4 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -1188,7 +1188,6 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args)
if (state[OPTION_KEYFILE].set) /* keyfile */
{
- char tmp_errmsg[GRUB_MAX_ERRMSG];
const char *p = NULL;
grub_file_t keyfile;
unsigned long long keyfile_offset = 0, keyfile_size = 0;
@@ -1199,20 +1198,9 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args)
keyfile_offset = grub_strtoull (state[OPTION_KEYFILE_OFFSET].arg, &p, 0);
if (state[OPTION_KEYFILE_OFFSET].arg[0] == '\0' || *p != '\0')
- {
- if (grub_errno != GRUB_ERR_NONE)
- {
- grub_strncpy (tmp_errmsg, grub_errmsg, GRUB_MAX_ERRMSG);
- return grub_error (grub_errno,
- N_("non-numeric or invalid keyfile offset `%s': %s"),
- state[OPTION_KEYFILE_OFFSET].arg, tmp_errmsg);
- }
- else
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("invalid keyfile offset `%s': non-numeric"
- " characters at end of number"),
- state[OPTION_KEYFILE_OFFSET].arg);
- }
+ return grub_error (grub_errno,
+ N_("non-numeric or invalid keyfile offset `%s'"),
+ state[OPTION_KEYFILE_OFFSET].arg);
}
if (state[OPTION_KEYFILE_SIZE].set) /* keyfile-size */
@@ -1221,28 +1209,17 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args)
keyfile_size = grub_strtoull (state[OPTION_KEYFILE_SIZE].arg, &p, 0);
if (state[OPTION_KEYFILE_SIZE].arg[0] == '\0' || *p != '\0')
- {
- if (grub_errno != GRUB_ERR_NONE)
- {
- grub_strncpy (tmp_errmsg, grub_errmsg, GRUB_MAX_ERRMSG);
- return grub_error (grub_errno,
- N_("non-numeric or invalid keyfile offset `%s': %s"),
- state[OPTION_KEYFILE_SIZE].arg, tmp_errmsg);
- }
- else
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("invalid keyfile offset `%s': non-numeric"
- " characters at end of number"),
- state[OPTION_KEYFILE_SIZE].arg);
- }
+ return grub_error (grub_errno,
+ N_("non-numeric or invalid keyfile size `%s'"),
+ state[OPTION_KEYFILE_SIZE].arg);
+
+ if (keyfile_size == 0)
+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("key file size is 0"));
if (keyfile_size > GRUB_CRYPTODISK_MAX_KEYFILE_SIZE)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
N_("key file size exceeds maximum (%d)"),
GRUB_CRYPTODISK_MAX_KEYFILE_SIZE);
-
- if (keyfile_size == 0)
- return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("key file size is 0"));
}
keyfile = grub_file_open (state[OPTION_KEYFILE].arg,
--
2.34.1
next reply other threads:[~2022-05-20 19:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 19:32 Glenn Washburn [this message]
2022-05-20 19:32 ` [PATCH v3 1/5] cryptodisk: luks: Unify grub_cryptodisk_dev function names Glenn Washburn
2022-05-20 19:32 ` [PATCH v3 2/5] cryptodisk: geli: " Glenn Washburn
2022-05-20 19:32 ` [PATCH v3 3/5] cryptodisk: Add options to cryptomount to support keyfiles Glenn Washburn
2022-05-26 14:24 ` Daniel Kiper
2022-05-26 18:57 ` Glenn Washburn
2022-05-20 19:32 ` [PATCH v3 4/5] cryptodisk: Use enum constants as indexes into cryptomount option array Glenn Washburn
2022-05-20 19:32 ` [PATCH v3 5/5] docs: Add documentation on keyfile option to cryptomount Glenn Washburn
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=cover.1653074546.git.development@efficientek.com \
--to=development@efficientek.com \
--cc=GNUtoo@cyberdimension.org \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.org \
--cc=john@lane.uk.net \
--cc=ps@pks.im \
/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.