grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/7] Cryptomount support LUKS detached header


From: John Lane
Subject: Re: [PATCH 1/7] Cryptomount support LUKS detached header
Date: Sun, 18 Mar 2018 20:29:39 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 17/03/18 11:09, TJ wrote:
> On 14/03/18 09:44, John Lane wrote:
>> --- a/grub-core/disk/cryptodisk.c
>> +++ b/grub-core/disk/cryptodisk.c
>> @@ -880,7 +882,7 @@ grub_cryptodisk_cheat_mount (const char *sourcedev, 
>> const char *cheat)
>>  
>>    FOR_CRYPTODISK_DEVS (cr)
>>    {
>> -    dev = cr->scan (source, search_uuid, check_boot);
>> +    dev = cr->scan (source, search_uuid, check_boot,0);
> 
> Minor nit; "boot,0" > "boot, 0"
> 
>> @@ -934,6 +936,18 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int 
>> argc, char **args)
>>    if (argc < 1 && !state[1].set && !state[2].set)
>>      return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required");
>>  
>> +  if (state[3].set) /* LUKS detached header */
>> +    {
>> +      if (state[0].set) /* Cannot use UUID lookup with detached header */
> 
> Should there be specific warning for the user here, at least for #ifdef
> GRUB_UTIL
> 
>> --- a/grub-core/disk/luks.c
>> +++ b/grub-core/disk/luks.c
>> @@ -391,13 +415,18 @@ luks_recover_key (grub_disk_t source,
>>        return grub_crypto_gcry_error (gcry_err);
>>      }
>>  
>> +      sector = grub_be_to_cpu32 (header.keyblock[i].keyMaterialOffset);
>>        length = (keysize * grub_be_to_cpu32 (header.keyblock[i].stripes));
>>  
>>        /* Read and decrypt the key material from the disk.  */
>> -      err = grub_disk_read (source,
>> -                        grub_be_to_cpu32 (header.keyblock
>> -                                          [i].keyMaterialOffset), 0,
>> -                        length, split_key);
>> +      if (hdr)
>> +        {
>> +      grub_file_seek (hdr, sector * 512);
> 
> Shouldn't 512 be GRUB_DISK_SECTOR_SIZE ?
> 
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 

I have applied these changes. Builds clean but I need to test it. I
might have time to do that tomorrow, otherwise next weekend will be soonest.



reply via email to

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