luks1: cleanup for added checks

related to bef56af730
This commit is contained in:
Ondrej Kozina
2017-06-16 11:09:28 +02:00
parent d02b291e2f
commit c4fa881303

View File

@@ -68,13 +68,12 @@ int LUKS_keyslot_area(const struct luks_phdr *hdr,
return 0;
}
/* because the array has 8 elements and it's mostly sorted. that's why */
static void _insertsort(int *array, int high, const void *usrptr)
/* insertsort: because the array has 8 elements and it's mostly sorted. that's why */
static void LUKS_sort_keyslots(const struct luks_phdr *hdr, int *array)
{
const struct luks_phdr *hdr = (const struct luks_phdr *)usrptr;
int i, j, x;
for (i = 1; i < high; i++) {
for (i = 1; i < LUKS_NUMKEYS; i++) {
j = i;
while (j > 0 && hdr->keyblock[array[j-1]].keyMaterialOffset > hdr->keyblock[array[j]].keyMaterialOffset) {
x = array[j];
@@ -85,11 +84,6 @@ static void _insertsort(int *array, int high, const void *usrptr)
}
}
static void LUKS_sort_keyslots(const struct luks_phdr *phdr, int *sorted_areas)
{
_insertsort(sorted_areas, LUKS_NUMKEYS, phdr);
}
static size_t LUKS_device_sectors(const struct luks_phdr *hdr)
{
int sorted_areas[LUKS_NUMKEYS] = { 0, 1, 2, 3, 4, 5, 6, 7 };