mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 17:38:22 +08:00
Fixed NVAR DataOnly+Auth variables
- such variable have a new timestamp in extended header, but no hash
This commit is contained in:
parent
72116d01c0
commit
feb74c3299
@ -17,7 +17,7 @@
|
|||||||
UEFITool::UEFITool(QWidget *parent) :
|
UEFITool::UEFITool(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::UEFITool),
|
ui(new Ui::UEFITool),
|
||||||
version(tr("NE Alpha31"))
|
version(tr("NE Alpha32"))
|
||||||
{
|
{
|
||||||
clipboard = QApplication::clipboard();
|
clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
|
@ -3010,7 +3010,8 @@ USTATUS FfsParser::parseNvarStore(const UModelIndex & index)
|
|||||||
bool isDataOnly = false;
|
bool isDataOnly = false;
|
||||||
bool hasExtendedHeader = false;
|
bool hasExtendedHeader = false;
|
||||||
bool hasChecksum = false;
|
bool hasChecksum = false;
|
||||||
bool hasTimestampAndHash = false;
|
bool hasTimestamp = false;
|
||||||
|
bool hasHash = false;
|
||||||
bool hasGuidIndex = false;
|
bool hasGuidIndex = false;
|
||||||
|
|
||||||
UINT32 guidIndex = 0;
|
UINT32 guidIndex = 0;
|
||||||
@ -3149,6 +3150,19 @@ USTATUS FfsParser::parseNvarStore(const UModelIndex & index)
|
|||||||
|
|
||||||
// Entry with authenticated write (for SecureBoot)
|
// Entry with authenticated write (for SecureBoot)
|
||||||
if (entryHeader->Attributes & NVRAM_NVAR_ENTRY_AUTH_WRITE) {
|
if (entryHeader->Attributes & NVRAM_NVAR_ENTRY_AUTH_WRITE) {
|
||||||
|
if ((entryHeader->Attributes & NVRAM_NVAR_ENTRY_DATA_ONLY)) {// Data only auth. variables has no hash
|
||||||
|
if ((UINT32)tail.size() < sizeof(UINT64)) {
|
||||||
|
msgExtDataTooShort = true;
|
||||||
|
isInvalid = true;
|
||||||
|
// Do not parse further
|
||||||
|
goto parsing_done;
|
||||||
|
}
|
||||||
|
|
||||||
|
timestamp = *(UINT64*)(tail.constData() + sizeof(UINT8));
|
||||||
|
hasTimestamp = true;
|
||||||
|
msgUnknownExtDataFormat = false;
|
||||||
|
}
|
||||||
|
else { // Full or link variable have hash
|
||||||
if ((UINT32)tail.size() < sizeof(UINT64) + SHA256_HASH_SIZE) {
|
if ((UINT32)tail.size() < sizeof(UINT64) + SHA256_HASH_SIZE) {
|
||||||
msgExtDataTooShort = true;
|
msgExtDataTooShort = true;
|
||||||
isInvalid = true;
|
isInvalid = true;
|
||||||
@ -3158,16 +3172,18 @@ USTATUS FfsParser::parseNvarStore(const UModelIndex & index)
|
|||||||
|
|
||||||
timestamp = *(UINT64*)(tail.constData() + sizeof(UINT8));
|
timestamp = *(UINT64*)(tail.constData() + sizeof(UINT8));
|
||||||
hash = tail.mid(sizeof(UINT64) + sizeof(UINT8), SHA256_HASH_SIZE);
|
hash = tail.mid(sizeof(UINT64) + sizeof(UINT8), SHA256_HASH_SIZE);
|
||||||
hasTimestampAndHash = true;
|
hasTimestamp = true;
|
||||||
|
hasHash = true;
|
||||||
msgUnknownExtDataFormat = false;
|
msgUnknownExtDataFormat = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Entry is data-only (nameless and GUIDless entry or link)
|
// Entry is data-only (nameless and GUIDless entry or link)
|
||||||
if (entryHeader->Attributes & NVRAM_NVAR_ENTRY_DATA_ONLY) { // Data-only attribute is set
|
if (entryHeader->Attributes & NVRAM_NVAR_ENTRY_DATA_ONLY) { // Data-only attribute is set
|
||||||
isInvalidLink = true;
|
isInvalidLink = true;
|
||||||
UModelIndex nvarIndex;
|
UModelIndex nvarIndex;
|
||||||
// Search prevously added entries for a link to this variable //TODO:replace with linked lists
|
// Search prevously added entries for a link to this variable
|
||||||
for (int i = 0; i < model->rowCount(index); i++) {
|
for (int i = 0; i < model->rowCount(index); i++) {
|
||||||
nvarIndex = index.child(i, 0);
|
nvarIndex = index.child(i, 0);
|
||||||
PARSING_DATA nvarPdata = parsingDataFromUModelIndex(nvarIndex);
|
PARSING_DATA nvarPdata = parsingDataFromUModelIndex(nvarIndex);
|
||||||
@ -3269,15 +3285,18 @@ parsing_done:
|
|||||||
extendedHeaderSize, extendedHeaderSize,
|
extendedHeaderSize, extendedHeaderSize,
|
||||||
extendedAttributes) + nvarExtendedAttributesToUString(extendedAttributes) + UString(")");
|
extendedAttributes) + nvarExtendedAttributesToUString(extendedAttributes) + UString(")");
|
||||||
|
|
||||||
// Checksum
|
// Add checksum
|
||||||
if (hasChecksum)
|
if (hasChecksum)
|
||||||
info += usprintf("\nChecksum: %02Xh", storedChecksum) +
|
info += usprintf("\nChecksum: %02Xh", storedChecksum) +
|
||||||
(calculatedChecksum ? usprintf(", invalid, should be %02Xh", 0x100 - calculatedChecksum) : UString(", valid"));
|
(calculatedChecksum ? usprintf(", invalid, should be %02Xh", 0x100 - calculatedChecksum) : UString(", valid"));
|
||||||
// Authentication data
|
|
||||||
if (hasTimestampAndHash) {
|
// Add timestamp
|
||||||
info += usprintf("\nTimestamp: %" PRIX64 "h\nHash: ",
|
if (hasTimestamp)
|
||||||
timestamp) + UString(hash.toHex().constData());
|
info += usprintf("\nTimestamp: %" PRIX64 "h", timestamp);
|
||||||
}
|
|
||||||
|
// Add hash
|
||||||
|
if (hasHash)
|
||||||
|
info += UString("\nHash: ") + UString(hash.toHex().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add correct offset to parsing data
|
// Add correct offset to parsing data
|
||||||
|
Loading…
Reference in New Issue
Block a user