mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-07-30 19:12:58 +00:00
MokManager: fix the hash list counting in delete
match_hash() requests the number of keys in a list and it was mistakenly replaced with the size of the Mok node. This would made MokManager to remove the whole Mok node instead of one hash. Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
This commit is contained in:
parent
607d370c2f
commit
38df5caad3
@ -1080,6 +1080,7 @@ static void delete_hash_in_list (UINT8 *hash, UINT32 hash_size,
|
||||
{
|
||||
EFI_GUID HashType = EFI_CERT_SHA256_GUID;
|
||||
UINT32 sig_size;
|
||||
UINT32 list_num;
|
||||
int i, del_ind;
|
||||
void *start, *end;
|
||||
UINT32 remain;
|
||||
@ -1091,8 +1092,10 @@ static void delete_hash_in_list (UINT8 *hash, UINT32 hash_size,
|
||||
(mok[i].MokSize < sig_size))
|
||||
continue;
|
||||
|
||||
list_num = mok[i].MokSize / sig_size;
|
||||
|
||||
del_ind = match_hash(hash, hash_size, 0, mok[i].Mok,
|
||||
mok[i].MokSize);
|
||||
list_num);
|
||||
while (del_ind >= 0) {
|
||||
/* Remove the hash */
|
||||
if (sig_size == mok[i].MokSize) {
|
||||
@ -1107,9 +1110,10 @@ static void delete_hash_in_list (UINT8 *hash, UINT32 hash_size,
|
||||
|
||||
mem_move(start, end, remain);
|
||||
mok[i].MokSize -= sig_size;
|
||||
list_num--;
|
||||
|
||||
del_ind = match_hash(hash, hash_size, del_ind,
|
||||
mok[i].Mok, mok[i].MokSize);
|
||||
mok[i].Mok, list_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user