summaryrefslogtreecommitdiff
path: root/MokManager.c
diff options
context:
space:
mode:
authorGary Ching-Pang Lin <glin@suse.com>2014-02-17 17:49:55 +0800
committerPeter Jones <pjones@redhat.com>2015-06-16 11:41:32 -0400
commitcd15cc0efc10700414981525b0e99fd80abe29ea (patch)
treea0247671fc8681dfbf20a2e85da276e36d2f0ddf /MokManager.c
parent8449925662f563fbef1b00e79b312052d72690db (diff)
downloadefi-boot-shim-cd15cc0efc10700414981525b0e99fd80abe29ea.tar.gz
efi-boot-shim-cd15cc0efc10700414981525b0e99fd80abe29ea.zip
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>
Diffstat (limited to 'MokManager.c')
-rw-r--r--MokManager.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/MokManager.c b/MokManager.c
index 12a91e92..2972d09b 100644
--- a/MokManager.c
+++ b/MokManager.c
@@ -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);
}
}
}