summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Ching-Pang Lin <glin@suse.com>2015-06-16 11:41:32 -0400
committerPeter Jones <pjones@redhat.com>2015-06-16 11:41:32 -0400
commit38df5caad3e7f0c2c3aea0db8228baea2978d6ed (patch)
treea0247671fc8681dfbf20a2e85da276e36d2f0ddf
parent607d370c2fb0b776be9c860cf3f16be1dcab32a9 (diff)
downloadefi-boot-shim-38df5caad3e7f0c2c3aea0db8228baea2978d6ed.tar.gz
efi-boot-shim-38df5caad3e7f0c2c3aea0db8228baea2978d6ed.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>
-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);
}
}
}