All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Lane <grub@jelmail.com>
To: TJ <grub-devel@iam.tj>, The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH 3/7] cryptomount luks allow multiple passphrase attempts
Date: Sun, 18 Mar 2018 20:30:13 +0000	[thread overview]
Message-ID: <0ed80698-0cf2-143c-c30a-b0ad0c5f5d96@jelmail.com> (raw)
In-Reply-To: <f11adf3d-6025-9b87-b766-5351cbe16554@iam.tj>

On 17/03/18 11:10, TJ wrote:
> On 14/03/18 09:45, John Lane wrote:
>> --- a/grub-core/disk/luks.c
>> +++ b/grub-core/disk/luks.c
>> @@ -321,10 +321,10 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
>>  
>>  static grub_err_t
>>  luks_recover_key (grub_disk_t source,
>> -		  grub_cryptodisk_t dev,
>> -		  grub_file_t hdr,
>> -		  grub_uint8_t *keyfile_bytes,
>> -		  grub_size_t keyfile_bytes_size)
>> +                  grub_cryptodisk_t dev,
>> +                  grub_file_t hdr,
>> +                  grub_uint8_t *keyfile_bytes,
>> +                  grub_size_t keyfile_bytes_size)
> 
> ---8-<--- snip
> 
> Much of this patch is moving existing code around, could it be
> refactored to avoid that so as to make the new code stand out?
> 

The code that was moved was just indented into a while loop.
Most of it pre-existed prior to my patches (#357-464), a small part was
added by patch#2. I'm not sure how I would refactor it - any change
would result in 100-ish lines changing position and/or indent and would
lead to a similarly sized patch.

The way the patch presents the changes is confusing but I am not sure
how to control that.

If it helps, all this patch did was add a while loop around the
passphrase reading code to allow the user 3 attempts. i.e

  while (attempts)
    {

      <existing code which returns if successful>

      grub_printf_ (N_("Failed to decrypt master key.\n"));
      if (--attempts) grub_printf_ (N_("%u attempt%s remaining.\n"),
attempts,
		                    (attempts==1) ? "" : "s");
    }

    <existing code returns access denied>



  reply	other threads:[~2018-03-18 20:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14  9:44 [PATCH 1/7] Cryptomount support LUKS detached header John Lane
2018-03-14  9:44 ` [PATCH 2/7] Cryptomount support key files John Lane
2018-03-17 11:10   ` TJ
2018-03-18 20:29     ` John Lane
2018-03-14  9:45 ` [PATCH 3/7] cryptomount luks allow multiple passphrase attempts John Lane
2018-03-17 11:10   ` TJ
2018-03-18 20:30     ` John Lane [this message]
2018-03-14  9:45 ` [PATCH 4/7] Cryptomount support plain dm-crypt John Lane
2018-03-14  9:45 ` [PATCH 5/7] Cryptomount support for hyphens in UUID John Lane
2018-03-14  9:45 ` [PATCH 6/7] Retain constness of parameters John Lane
2018-03-14  9:45 ` [PATCH 7/7] Add support for using a whole device as a keyfile John Lane
2018-03-14 13:05 ` [PATCH 1/7] Cryptomount support LUKS detached header Daniel Kiper
2018-03-14 19:00   ` John Lane
2018-03-21  7:23     ` Paul Menzel
2018-03-22 12:38     ` Daniel Kiper
2018-03-22 14:22       ` TJ
2018-03-26 13:10         ` John Lane
2018-03-26 14:42           ` Daniel Kiper
2018-03-17 11:09 ` TJ
2018-03-18 20:29   ` John Lane

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=0ed80698-0cf2-143c-c30a-b0ad0c5f5d96@jelmail.com \
    --to=grub@jelmail.com \
    --cc=grub-devel@gnu.org \
    --cc=grub-devel@iam.tj \
    /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.