mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 08:20:07 +01:00
@@ -68,13 +68,12 @@ int LUKS_keyslot_area(const struct luks_phdr *hdr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* because the array has 8 elements and it's mostly sorted. that's why */
|
/* insertsort: because the array has 8 elements and it's mostly sorted. that's why */
|
||||||
static void _insertsort(int *array, int high, const void *usrptr)
|
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;
|
int i, j, x;
|
||||||
|
|
||||||
for (i = 1; i < high; i++) {
|
for (i = 1; i < LUKS_NUMKEYS; i++) {
|
||||||
j = i;
|
j = i;
|
||||||
while (j > 0 && hdr->keyblock[array[j-1]].keyMaterialOffset > hdr->keyblock[array[j]].keyMaterialOffset) {
|
while (j > 0 && hdr->keyblock[array[j-1]].keyMaterialOffset > hdr->keyblock[array[j]].keyMaterialOffset) {
|
||||||
x = array[j];
|
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)
|
static size_t LUKS_device_sectors(const struct luks_phdr *hdr)
|
||||||
{
|
{
|
||||||
int sorted_areas[LUKS_NUMKEYS] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
int sorted_areas[LUKS_NUMKEYS] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||||
|
|||||||
Reference in New Issue
Block a user