mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
FIT checksum bugfix
- and small refactorings
This commit is contained in:
parent
f90427229d
commit
03567dbe66
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
|||||||
std::vector<std::vector<QString> > fitTable = ffsParser.getFitTable();
|
std::vector<std::vector<QString> > fitTable = ffsParser.getFitTable();
|
||||||
if (fitTable.size()) {
|
if (fitTable.size()) {
|
||||||
std::cout << "-------------------------------------------------------------------" << std::endl;
|
std::cout << "-------------------------------------------------------------------" << std::endl;
|
||||||
std::cout << " Address | Size | Ver | CS | Type " << std::endl;
|
std::cout << " Address | Size | Ver | CS | Type " << std::endl;
|
||||||
std::cout << "-------------------------------------------------------------------" << std::endl;
|
std::cout << "-------------------------------------------------------------------" << std::endl;
|
||||||
for (size_t i = 0; i < fitTable.size(); i++) {
|
for (size_t i = 0; i < fitTable.size(); i++) {
|
||||||
std::cout << fitTable[i][0].toLatin1().constData() << " | "
|
std::cout << fitTable[i][0].toLatin1().constData() << " | "
|
||||||
|
@ -2896,16 +2896,15 @@ USTATUS FfsParser::parseFit(const UModelIndex & index, const UINT32 diff)
|
|||||||
FIT_ENTRY* tempFitHeader = (FIT_ENTRY*)tempFIT.data();
|
FIT_ENTRY* tempFitHeader = (FIT_ENTRY*)tempFIT.data();
|
||||||
tempFitHeader->Checksum = 0;
|
tempFitHeader->Checksum = 0;
|
||||||
UINT8 calculated = calculateChecksum8((const UINT8*)tempFitHeader, fitSize);
|
UINT8 calculated = calculateChecksum8((const UINT8*)tempFitHeader, fitSize);
|
||||||
calculated |= 0x80; // Set checksum flag on calculated checksum
|
|
||||||
if (calculated != fitHeader->Checksum) {
|
if (calculated != fitHeader->Checksum) {
|
||||||
msg(usprintf("parseFit: invalid FIT table checksum %02Xh, should be %02Xh", fitHeader->Checksum, calculated), fitIndex);
|
msg(usprintf("parseFit: invalid FIT table checksum %02Xh, should be %02Xh", fitHeader->Checksum, calculated), fitIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check fit header type
|
// Check fit header type
|
||||||
if ((fitHeader->Type & 0x7F) != FIT_TYPE_HEADER) {
|
if ((fitHeader->Type & 0x7F) != FIT_TYPE_HEADER)
|
||||||
msg(("Invalid FIT header type"), fitIndex);
|
msg(("Invalid FIT header type"), fitIndex);
|
||||||
}
|
|
||||||
|
|
||||||
// Add FIT header to fitTable
|
// Add FIT header to fitTable
|
||||||
std::vector<UString> currentStrings;
|
std::vector<UString> currentStrings;
|
||||||
|
@ -167,16 +167,16 @@ UString actionTypeToUString(const UINT8 action)
|
|||||||
UString fitEntryTypeToUString(const UINT8 type)
|
UString fitEntryTypeToUString(const UINT8 type)
|
||||||
{
|
{
|
||||||
switch (type & 0x7F) {
|
switch (type & 0x7F) {
|
||||||
case FIT_TYPE_HEADER: return ("FIT Header ");
|
case FIT_TYPE_HEADER: return ("FIT Header");
|
||||||
case FIT_TYPE_MICROCODE: return ("Microcode ");
|
case FIT_TYPE_MICROCODE: return ("Microcode");
|
||||||
case FIT_TYPE_BIOS_AC_MODULE: return ("BIOS ACM ");
|
case FIT_TYPE_BIOS_AC_MODULE: return ("BIOS ACM");
|
||||||
case FIT_TYPE_BIOS_INIT_MODULE: return ("BIOS Init ");
|
case FIT_TYPE_BIOS_INIT_MODULE: return ("BIOS Init");
|
||||||
case FIT_TYPE_TPM_POLICY: return ("TPM Policy ");
|
case FIT_TYPE_TPM_POLICY: return ("TPM Policy");
|
||||||
case FIT_TYPE_BIOS_POLICY_DATA: return ("BIOS Policy Data ");
|
case FIT_TYPE_BIOS_POLICY_DATA: return ("BIOS Policy Data");
|
||||||
case FIT_TYPE_TXT_CONF_POLICY: return ("TXT Configuration Policy");
|
case FIT_TYPE_TXT_CONF_POLICY: return ("TXT Configuration Policy");
|
||||||
case FIT_TYPE_AC_KEY_MANIFEST: return ("BootGuard Key Manifest ");
|
case FIT_TYPE_AC_KEY_MANIFEST: return ("BootGuard Key Manifest");
|
||||||
case FIT_TYPE_AC_BOOT_POLICY: return ("BootGuard Boot Policy ");
|
case FIT_TYPE_AC_BOOT_POLICY: return ("BootGuard Boot Policy");
|
||||||
case FIT_TYPE_EMPTY: return ("Empty ");
|
case FIT_TYPE_EMPTY: return ("Empty");
|
||||||
default: return ("Unknown ");
|
default: return ("Unknown");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user