87 lines
2.5 KiB
Diff
87 lines
2.5 KiB
Diff
|
From 23cdee7b62fc62cd988d74b2180014595da9e4c5 Mon Sep 17 00:00:00 2001
|
||
|
From: Gary Ching-Pang Lin <glin@suse.com>
|
||
|
Date: Thu, 13 Feb 2014 15:05:45 +0800
|
||
|
Subject: [PATCH 1/2] MokManager: calculate the variable size correctly
|
||
|
|
||
|
MokSize of the hash signature list includes the owner GUID,
|
||
|
so we should not add the 16bytes compensation.
|
||
|
|
||
|
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
|
||
|
---
|
||
|
MokManager.c | 4 +++-
|
||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/MokManager.c b/MokManager.c
|
||
|
index e79a8e0..e0cc143 100644
|
||
|
--- a/MokManager.c
|
||
|
+++ b/MokManager.c
|
||
|
@@ -934,7 +934,9 @@ static EFI_STATUS write_back_mok_list (MokListNode *list, INTN key_num,
|
||
|
if (list[i].Mok == NULL)
|
||
|
continue;
|
||
|
|
||
|
- DataSize += sizeof(EFI_SIGNATURE_LIST) + sizeof(EFI_GUID);
|
||
|
+ DataSize += sizeof(EFI_SIGNATURE_LIST);
|
||
|
+ if (CompareGuid(&(list[i].Type), &CertType) == 0)
|
||
|
+ DataSize += sizeof(EFI_GUID);
|
||
|
DataSize += list[i].MokSize;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
1.8.4.5
|
||
|
|
||
|
|
||
|
From 6b70c15cd8a83e0e62088bc4f2f8e84e818d2b73 Mon Sep 17 00:00:00 2001
|
||
|
From: Gary Ching-Pang Lin <glin@suse.com>
|
||
|
Date: Mon, 17 Feb 2014 17:49:55 +0800
|
||
|
Subject: [PATCH 2/2] 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>
|
||
|
---
|
||
|
MokManager.c | 8 ++++++--
|
||
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/MokManager.c b/MokManager.c
|
||
|
index e0cc143..5af5ce6 100644
|
||
|
--- a/MokManager.c
|
||
|
+++ b/MokManager.c
|
||
|
@@ -1042,6 +1042,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;
|
||
|
@@ -1053,8 +1054,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) {
|
||
|
@@ -1069,9 +1072,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);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
--
|
||
|
1.8.4.5
|
||
|
|