[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 15/15] luks2: Error check segment.sector_size.
From: |
Glenn Washburn |
Subject: |
[PATCH v4 15/15] luks2: Error check segment.sector_size. |
Date: |
Fri, 6 Nov 2020 22:44:35 -0600 |
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
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_key (grub_disk_t source,
grub_dprintf ("luks2", "Trying keyslot %"PRIuGRUB_UINT64_T"\n",
keyslot.slot_key);
+ /* Sector size should be one of 512, 1024, 2048, or 4096. */
+ if (!(segment.sector_size == 512 || segment.sector_size == 1024 ||
+ segment.sector_size == 2048 || segment.sector_size == 4096))
+ {
+ grub_dprintf ("luks2", "Segment \"%"PRIuGRUB_UINT64_T"\" sector"
+ " size %"PRIuGRUB_UINT64_T" is not one of"
+ " 512, 1024, 2048, or 4096.",
+ segment.slot_key, segment.sector_size);
+ continue;
+ }
+
/* Set up disk according to keyslot's segment. */
crypt->offset_sectors = grub_divmod64 (segment.offset,
segment.sector_size, NULL);
crypt->log_sector_size = grub_log2ull (segment.sector_size);
--
2.27.0
- Re: [PATCH v4 13/15] cryptodisk: Properly handle non-512 byte sized sectors., (continued)
[PATCH v4 14/15] luks2: Better error handling when setting up the cryptodisk., Glenn Washburn, 2020/11/06
[PATCH v4 15/15] luks2: Error check segment.sector_size.,
Glenn Washburn <=
Re: [PATCH v4 00/15] Cryptodisk fixes for v2.06 redux, Daniel Kiper, 2020/11/17
[PATCH v5 00/11] Cryptodisk fixes for v2.06 redux, Glenn Washburn, 2020/11/23
- [PATCH v5 01/11] luks2: Add slot_key member to struct grub_luks2_keyslot/segment/digest, Glenn Washburn, 2020/11/23
- [PATCH v5 02/11] luks: Use more intuitive slot key instead of index in user messages., Glenn Washburn, 2020/11/23
- [PATCH v5 03/11] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt, Glenn Washburn, 2020/11/23
- [PATCH v5 04/11] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors, Glenn Washburn, 2020/11/23
- [PATCH v5 05/11] cryptodisk: Properly handle non-512 byte sized sectors, Glenn Washburn, 2020/11/23
- [PATCH v5 06/11] luks2: Better error handling when setting up the cryptodisk, Glenn Washburn, 2020/11/23