[PATCH] at_keyboard: Fix keyboards that report IBM PC AT scan codes

2020-11-06 Thread Javier Martinez Canillas
GRUB has support for both the IBM PC XT (Set 1) and IBM PC AT (Set 2) key scan code mappings. But the driver always hardcodes to Set 1, overwriting the mode that was queried in the grub_keyboard_controller_init() function. This breaks keyboard mapping on machines whose firmwares are not using the

Re: [PATCH v3 06/10] cryptodisk: Properly handle non-512 byte sized sectors.

2020-11-06 Thread Glenn Washburn
On Fri, 30 Oct 2020 21:47:14 +0100 Daniel Kiper wrote: > On Mon, Oct 19, 2020 at 06:09:54PM -0500, Glenn Washburn wrote: > > By default, dm-crypt internally uses an IV that corresponds to > > 512-byte sectors, even when a larger sector size is specified. What > > this means is that when using a l

[PATCH v4 01/15] cryptodisk: Rename total_length field in grub_cryptodisk_t to total_sectors.

2020-11-06 Thread Glenn Washburn
This creates an alignment with grub_disk_t naming of the same field and is more intuitive as to how it should be used. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 2 +- grub-core/disk/geli.c | 2 +- grub-core/disk/luks.c | 2 +- grub-core/disk/luks2.c | 4 ++-

[PATCH v4 08/15] luks2: Split idx into three variables: keyslot_key, digest_key, segment_key.

2020-11-06 Thread Glenn Washburn
Introduce new variables keyslot_key, digest_key, and segment_key which represent the integer key of the item in the respective associative array when looping over the array items. This replaces using a generically named variable named "idx" used for all three values. Signed-off-by: Glenn Washburn

[PATCH v4 00/15] Cryptodisk fixes for v2.06 redux

2020-11-06 Thread Glenn Washburn
Here we go again. I have not added RB sigs to any patches since I've had to modify them in moving them earlier in the patch set. This would be the first three rename patches. The first two patches of v3 have been reworked into 5 patches (05-09) which combine to be equivalent. Most of the changes s

[PATCH v4 04/15] types: Define GRUB_CHAR_BIT based on compiler macro instead of using literal.

2020-11-06 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- include/grub/types.h | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/grub/types.h b/include/grub/types.h index 035a4b528..495c86bb1 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -72,6 +72,14 @@ # endif #e

[PATCH v4 11/15] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt.

2020-11-06 Thread Glenn Washburn
This should improve readability of code by providing clues as to what the value represents. The new macro GRUB_TYPE_BITS(type) returns the number of bits allocated for type. Also add GRUB_TYPE_U_MAX/MIN(type) macros to get the max/min values for an unsigned number with size of type. Signed-off-by:

[PATCH v4 02/15] cryptodisk: Rename offset in grub_cryptodisk_t to offset_sectors.

2020-11-06 Thread Glenn Washburn
This makes it clear that the offset represents sectors, not bytes, in order to improve readability. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 10 +- grub-core/disk/geli.c | 2 +- grub-core/disk/luks.c | 4 ++-- grub-core/disk/luks2.c | 4 ++-- in

[PATCH v4 03/15] luks2: Rename source disk variabled named 'disk' to 'source' as in luks.c.

2020-11-06 Thread Glenn Washburn
This makes it more obvious to the reader that the disk referred to is the source disk, as opposed to say the disk holding the cryptodisk. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/grub-cor

[PATCH v4 05/15] luks2: Use correct index variable when looping in luks2_get_keyslot.

2020-11-06 Thread Glenn Washburn
The loop variable j should be used to index the digests and segments json array, instead of the variable i, which is the keyslot index. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/disk/luks2.c b/gr

[PATCH v4 06/15] luks2: Rename variable i to keyslot_idx in luks2_get_keyslot.

2020-11-06 Thread Glenn Washburn
Variables named i are usually looping variables, so rename to keyslot_idx to allow for easier reading of luks2_get_keyslot. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk

[PATCH v4 09/15] luks2: Improve error messages in luks2_get_keyslot.

2020-11-06 Thread Glenn Washburn
Error messages now distinguish between indexes and keys. The former include "index" in the error string, and the later are surrounded in quotes. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/grub-core/disk

[PATCH v4 10/15] luks2: Use more intuitive keyslot key instead of index when naming keyslot.

2020-11-06 Thread Glenn Washburn
Use the keyslot key value in the keyslot json array rather than the index of the keyslot in the json array. This is less confusing for the end user. For example, say you have a LUKS2 device with a key in slot 1 and slot 4. When using the password for slot 4 to unlock the device, the messages using

[PATCH v4 07/15] luks2: Rename index variable j to i.

2020-11-06 Thread Glenn Washburn
Looping variable j was named such because the variable name i was taken. Since i has been renamed in the previous patch, we can rename j to i. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/grub-core

[PATCH v4 12/15] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors

2020-11-06 Thread Glenn Washburn
The total_length field is named confusingly because length usually refers to bytes, whereas in this case its really the total number of sectors on the device. Also counter-intuitively, grub_disk_get_size returns the total number of device native sectors. We need to convert the sectors from the size

[PATCH v4 14/15] luks2: Better error handling when setting up the cryptodisk.

2020-11-06 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 70 +++--- include/grub/misc.h| 2 ++ 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 4a4a0dec4..751b48d6a 100644 --- a/grub-co

[PATCH v4 13/15] cryptodisk: Properly handle non-512 byte sized sectors.

2020-11-06 Thread Glenn Washburn
By default, dm-crypt internally uses an IV that corresponds to 512-byte sectors, even when a larger sector size is specified. What this means is that when using a larger sector size, the IV is incremented every sector. However, the amount the IV is incremented is the number of 512 byte blocks in a

[PATCH v4 15/15] luks2: Error check segment.sector_size.

2020-11-06 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 751b48d6a..b628043e0 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -622,6 +622,17 @@ luks2_recover_