From: Andrei Borzenkov <arvidjaar@gmail.com>
To: John Lane <john@lane.uk.net>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH 4/4] Cryptomount support for hyphens in UUID
Date: Sat, 20 Jun 2015 08:13:19 +0300 [thread overview]
Message-ID: <20150620081319.7fa8a865@opensuse.site> (raw)
In-Reply-To: <1434445875-6846-5-git-send-email-john@lane.uk.net>
В Tue, 16 Jun 2015 10:11:15 +0100
John Lane <john@lane.uk.net> пишет:
> ---
> grub-core/disk/cryptodisk.c | 9 +++++++++
> grub-core/disk/luks.c | 1 +
> include/grub/cryptodisk.h | 3 +++
> 3 files changed, 13 insertions(+)
>
> diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
> index c519c55..b800d6f 100644
> --- a/grub-core/disk/cryptodisk.c
> +++ b/grub-core/disk/cryptodisk.c
> @@ -113,6 +113,13 @@ gf_mul_be (grub_uint8_t *o, const grub_uint8_t *a, const grub_uint8_t *b)
> }
> }
>
> +void
> +grub_cryptodisk_uuid_dehyphenate(char *uuid)
> +{
> + char *s, *d;
> + for (s=d=uuid;(*d=*s);d+=(*s++!='-'));
Did you try to fit smartphone size? We are not short on spaces yet.
> +}
> +
> static gcry_err_code_t
> grub_crypto_pcbc_decrypt (grub_crypto_cipher_handle_t cipher,
> void *out, void *in, grub_size_t size,
> @@ -506,6 +513,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
>
> if (grub_memcmp (name, "cryptouuid/", sizeof ("cryptouuid/") - 1) == 0)
> {
> + grub_cryptodisk_uuid_dehyphenate((char *)name + sizeof ("cryptouuid/"));
We do not really know what underlying implementation expects as UUID.
It *may* contain hyphens as valid character.
> for (dev = cryptodisk_list; dev != NULL; dev = dev->next)
> if (grub_strcasecmp (name + sizeof ("cryptouuid/") - 1, dev->uuid) == 0)
> break;
> @@ -1025,6 +1033,7 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args)
> {
> grub_cryptodisk_t dev;
>
> + grub_cryptodisk_uuid_dehyphenate(args[0]);
Same: cryptomount is generic interface. We do not know what underlying
implementation expects.
> dev = grub_cryptodisk_get_by_uuid (args[0]);
> if (dev)
> {
> diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c
> index 069e72c..0e570cf 100644
> --- a/grub-core/disk/luks.c
> +++ b/grub-core/disk/luks.c
> @@ -111,6 +111,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
> hashspec[sizeof (header.hashSpec)] = 0;
> grub_memcpy (uuid, header.uuid, sizeof (header.uuid));
> uuid[sizeof (header.uuid)] = 0;
> + grub_cryptodisk_uuid_dehyphenate (uuid);
>
It already removes hyphens when getting UUID from LUKS. But you may
want to remove hyphens from check_uuid string too.
> if (check_uuid && grub_strcasecmp (check_uuid, uuid) != 0)
> {
> diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h
> index 4076412..cfb0f0d 100644
> --- a/include/grub/cryptodisk.h
> +++ b/include/grub/cryptodisk.h
> @@ -167,4 +167,7 @@ grub_cryptodisk_t grub_cryptodisk_get_by_source_disk (grub_disk_t disk);
> grub_cryptodisk_t grub_cryptodisk_create (grub_disk_t disk, char *uuid,
> char *ciphername, char *ciphermode, char *digest);
>
> +void
> +grub_cryptodisk_uuid_dehyphenate(char *uuid);
> +
> #endif
This function is needed in one place only, so moving it into luks makes
more sense for now.
prev parent reply other threads:[~2015-06-20 5:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-16 9:11 Cryptomount enhancements: detached headers, key-files and plain mode John Lane
2015-06-16 9:11 ` [PATCH 1/4] Cryptomount support LUKS detached header John Lane
2015-06-16 9:11 ` [PATCH 2/4] Cryptomount support key files John Lane
2015-06-20 4:54 ` Andrei Borzenkov
2015-06-23 17:27 ` John Lane
2015-06-24 6:59 ` Andrei Borzenkov
2015-06-24 11:26 ` John Lane
2015-06-24 12:02 ` Andrei Borzenkov
2015-06-25 20:06 ` John Lane
2015-06-16 9:11 ` [PATCH 3/4] Cryptomount support plain dm-crypt John Lane
2015-06-16 9:45 ` John Lane
2015-06-16 9:11 ` [PATCH 4/4] Cryptomount support for hyphens in UUID John Lane
2015-06-20 5:13 ` Andrei Borzenkov [this message]
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=20150620081319.7fa8a865@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=john@lane.uk.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).