UT NE A12

- added detection of VTF inside volume's non-UEFI data
- corrected ImageSize information for EFI capsule
- *.scap is added to the list of known Image file extensions
- all FIT candidates in a tree item are checked for being referenced
from the last VTF now
This commit is contained in:
Nikolaj Schlej 2015-09-19 10:08:26 +02:00
parent 788397f60c
commit 6d8e5976f7
4 changed files with 84 additions and 42 deletions

View file

@ -69,14 +69,17 @@ STATUS FitParser::parse(const QModelIndex & index, const QModelIndex & lastVtfIn
// Special case of FIT header
const FIT_ENTRY* fitHeader = (const FIT_ENTRY*)(model->body(fitIndex).constData() + fitOffset);
// Check FIT checksum, if present
UINT32 fitSize = (fitHeader->Size & 0xFFFFFF) << 4;
if (fitHeader->Type & 0x80) {
// Calculate FIT entry checksum
UINT8 calculated = calculateChecksum8((const UINT8*)fitHeader, fitSize);
if (calculated) {
msg(tr("Invalid FIT table checksum"), fitIndex);
QByteArray tempFIT = model->body(fitIndex).mid(fitOffset, fitSize);
FIT_ENTRY* tempFitHeader = (FIT_ENTRY*)tempFIT.data();
tempFitHeader->Checksum = 0;
UINT8 calculated = calculateChecksum8((const UINT8*)tempFitHeader, fitSize);
if (calculated != fitHeader->Checksum) {
msg(tr("Invalid FIT table checksum %1h, should be %2h").hexarg2(fitHeader->Checksum, 2).hexarg2(calculated, 2), fitIndex);
}
}
@ -170,9 +173,10 @@ STATUS FitParser::findFitRecursive(const QModelIndex & index, QModelIndex & foun
// Get parsing data for the current item
PARSING_DATA pdata = parsingDataFromQModelIndex(index);
// Check for FIT signature in item's body
INT32 offset = model->body(index).indexOf(FIT_SIGNATURE);
if (offset >= 0) {
// Check for all FIT signatures in item's body
for (INT32 offset = model->body(index).indexOf(FIT_SIGNATURE);
offset >= 0;
offset = model->body(index).indexOf(FIT_SIGNATURE, offset + 1)) {
// FIT candidate found, calculate it's physical address
UINT32 fitAddress = pdata.address + model->header(index).size() + (UINT32)offset;