Permalink
Browse files

Fix key database parsing

The pointer to the certificate needs to be incremented by the size of the
entire certificate, not just the certificate data.
  • Loading branch information...
1 parent cdde659 commit 59f2e0a28915e5a615bdde0b8c2465b7688a7e5b Matthew Garrett committed Oct 23, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 MokManager.c
View
@@ -108,15 +108,15 @@ static MokListNode *build_mok_list(UINT32 num, void *Data, UINTN DataSize) {
(CompareGuid (&CertList->SignatureType, &HashType) != 0)) {
dbsize -= CertList->SignatureListSize;
CertList = (EFI_SIGNATURE_LIST *)((UINT8 *) CertList +
- CertList->SignatureSize);
+ CertList->SignatureListSize);
continue;
}
if ((CompareGuid (&CertList->SignatureType, &HashType) == 0) &&
(CertList->SignatureSize != 48)) {
dbsize -= CertList->SignatureListSize;
CertList = (EFI_SIGNATURE_LIST *)((UINT8 *) CertList +
- CertList->SignatureSize);
+ CertList->SignatureListSize);
continue;
}
@@ -129,7 +129,7 @@ static MokListNode *build_mok_list(UINT32 num, void *Data, UINTN DataSize) {
count++;
dbsize -= CertList->SignatureListSize;
CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList +
- CertList->SignatureSize);
+ CertList->SignatureListSize);
}
return list;
@@ -414,7 +414,7 @@ static UINT8 list_keys (void *MokNew, UINTN MokNewSize)
Print(L"Doesn't look like a key or hash\n");
dbsize -= CertList->SignatureListSize;
CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList +
- CertList->SignatureSize);
+ CertList->SignatureListSize);
continue;
}
@@ -423,14 +423,14 @@ static UINT8 list_keys (void *MokNew, UINTN MokNewSize)
Print(L"Doesn't look like a valid hash\n");
dbsize -= CertList->SignatureListSize;
CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList +
- CertList->SignatureSize);
+ CertList->SignatureListSize);
continue;
}
MokNum++;
dbsize -= CertList->SignatureListSize;
CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList +
- CertList->SignatureSize);
+ CertList->SignatureListSize);
}
keys = build_mok_list(MokNum, MokNew, MokNewSize);

0 comments on commit 59f2e0a

Please sign in to comment.