Hello community, here is the log from the commit of package UEFITool for openSUSE:Factory checked in at 2019-10-23 15:54:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/UEFITool (Old) and /work/SRC/openSUSE:Factory/.UEFITool.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "UEFITool" Wed Oct 23 15:54:35 2019 rev:5 rq:742131 version:20181230 Changes: -------- --- /work/SRC/openSUSE:Factory/UEFITool/UEFITool.changes 2018-12-18 14:57:52.922297620 +0100 +++ /work/SRC/openSUSE:Factory/.UEFITool.new.2352/UEFITool.changes 2019-10-23 15:54:37.310939214 +0200 @@ -1,0 +2,6 @@ +Wed Oct 23 12:00:21 UTC 2019 - Martin Pluskal <mplus...@suse.com> + +- Update to version 20181230: + * Implement custom LZMA dictionary size support, fixes #154 + +------------------------------------------------------------------- Old: ---- UEFITool-20180624.tar.xz New: ---- UEFITool-20181230.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ UEFITool.spec ++++++ --- /var/tmp/diff_new_pack.wym7TD/_old 2019-10-23 15:54:37.986939945 +0200 +++ /var/tmp/diff_new_pack.wym7TD/_new 2019-10-23 15:54:37.986939945 +0200 @@ -1,7 +1,7 @@ # # spec file for package UEFITool # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: UEFITool -Version: 20180624 +Version: 20181230 Release: 0 Summary: Tools to inspect and work on UEFI BIOSes License: BSD-2-Clause @@ -44,7 +44,7 @@ for i in UEFIPatch UEFIReplace; do pushd $i %qmake5 - %make_jobs + %make_build popd done ++++++ UEFITool-20180624.tar.xz -> UEFITool-20181230.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/LZMA/LzmaCompress.c new/UEFITool-20181230/LZMA/LzmaCompress.c --- old/UEFITool-20180624/LZMA/LzmaCompress.c 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/LZMA/LzmaCompress.c 2018-12-30 16:37:27.000000000 +0100 @@ -64,7 +64,8 @@ CONST UINT8 *Source, UINT32 SourceSize, UINT8 *Destination, - UINT32 *DestinationSize + UINT32 *DestinationSize, + UINT32 DictionarySize ) { SRes LzmaResult; @@ -79,8 +80,7 @@ } LzmaEncProps_Init(&props); - // TODO: need to detect this instead of hardcoding - props.dictSize = LZMA_DICTIONARY_SIZE; + props.dictSize = DictionarySize; props.level = 9; props.fb = 273; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/LZMA/LzmaCompress.h new/UEFITool-20181230/LZMA/LzmaCompress.h --- old/UEFITool-20180624/LZMA/LzmaCompress.h 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/LZMA/LzmaCompress.h 2018-12-30 16:37:27.000000000 +0100 @@ -21,7 +21,7 @@ extern "C" { #endif -#define LZMA_DICTIONARY_SIZE 0x800000 +#define DEFAULT_LZMA_DICTIONARY_SIZE 0x800000 #define _LZMA_SIZE_OPT EFI_STATUS @@ -30,7 +30,8 @@ const UINT8 *Source, UINT32 SourceSize, UINT8 *Destination, - UINT32 *DestinationSize + UINT32 *DestinationSize, + UINT32 DictionarySize ); #ifdef __cplusplus diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/ffsengine.cpp new/UEFITool-20181230/ffsengine.cpp --- old/UEFITool-20180624/ffsengine.cpp 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/ffsengine.cpp 2018-12-30 16:37:27.000000000 +0100 @@ -1590,8 +1590,16 @@ .arg(compressionTypeToQString(algorithm)) .hexarg(compressedSectionHeader->UncompressedLength).arg(compressedSectionHeader->UncompressedLength); + UINT32 dictionarySize = DEFAULT_LZMA_DICTIONARY_SIZE; + if (algorithm == COMPRESSION_ALGORITHM_LZMA) { + // Dictionary size is stored in bytes 1-4 of LZMA-compressed data + dictionarySize = *(UINT32*)(body.constData() + 1); + info += tr("\nLZMA dictionary size: %1h").hexarg(dictionarySize); + } + // Add tree item index = model->addItem(Types::Section, sectionHeader->Type, algorithm, name, "", info, header, body, parent, mode); + model->setDictionarySize(index, dictionarySize); // Show message if (!parseCurrentSection) @@ -1632,6 +1640,8 @@ .hexarg2(guidDefinedSectionHeader->Attributes, 4); UINT8 algorithm = COMPRESSION_ALGORITHM_NONE; + UINT32 dictionarySize = DEFAULT_LZMA_DICTIONARY_SIZE; + // Check if section requires processing if (guidDefinedSectionHeader->Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) { // Tiano compressed section @@ -1664,6 +1674,10 @@ if (algorithm == COMPRESSION_ALGORITHM_LZMA) { info += tr("\nCompression type: LZMA"); info += tr("\nDecompressed size: %1h (%2)").hexarg(processed.length()).arg(processed.length()); + + // Dictionary size is stored in bytes 1-4 of LZMA-compressed data + dictionarySize = *(UINT32*)(body.constData() + 1); + info += tr("\nLZMA dictionary size: %1h").hexarg(dictionarySize); } else info += tr("\nCompression type: unknown"); @@ -1743,6 +1757,7 @@ // Add tree item index = model->addItem(Types::Section, sectionHeader->Type, algorithm, name, "", info, header, body, parent, mode); + model->setDictionarySize(index, dictionarySize); // Show messages if (msgUnknownGuid) @@ -2164,6 +2179,7 @@ QByteArray created; UINT8 result; QModelIndex fileIndex; + UINT32 defaultDictionarySize = DEFAULT_LZMA_DICTIONARY_SIZE; if (!index.isValid() || !index.parent().isValid()) return ERR_INVALID_PARAMETER; @@ -2344,18 +2360,21 @@ sectionHeader->UncompressedLength = body.size(); // Set compression type - if (algorithm == COMPRESSION_ALGORITHM_NONE) + if (algorithm == COMPRESSION_ALGORITHM_NONE) { sectionHeader->CompressionType = EFI_NOT_COMPRESSED; - else if (algorithm == COMPRESSION_ALGORITHM_EFI11 || algorithm == COMPRESSION_ALGORITHM_TIANO) + } + else if (algorithm == COMPRESSION_ALGORITHM_EFI11 || algorithm == COMPRESSION_ALGORITHM_TIANO) { sectionHeader->CompressionType = EFI_STANDARD_COMPRESSION; - else if (algorithm == COMPRESSION_ALGORITHM_LZMA || algorithm == COMPRESSION_ALGORITHM_IMLZMA) + } + else if (algorithm == COMPRESSION_ALGORITHM_LZMA || algorithm == COMPRESSION_ALGORITHM_IMLZMA) { sectionHeader->CompressionType = EFI_CUSTOMIZED_COMPRESSION; + } else return ERR_UNKNOWN_COMPRESSION_ALGORITHM; // Compress body QByteArray compressed; - result = compress(body, algorithm, compressed); + result = compress(body, algorithm, defaultDictionarySize, compressed); if (result) return result; @@ -2381,7 +2400,7 @@ case EFI_SECTION_GUID_DEFINED:{ // Compress body QByteArray compressed; - result = compress(body, algorithm, compressed); + result = compress(body, algorithm, defaultDictionarySize, compressed); if (result) return result; @@ -2843,7 +2862,7 @@ } } -UINT8 FfsEngine::compress(const QByteArray & data, const UINT8 algorithm, QByteArray & compressedData) +UINT8 FfsEngine::compress(const QByteArray & data, const UINT8 algorithm, const UINT32 dictionarySize, QByteArray & compressedData) { UINT8* compressed; @@ -2933,10 +2952,10 @@ case COMPRESSION_ALGORITHM_LZMA: { UINT32 compressedSize = 0; - if (LzmaCompress((const UINT8*)data.constData(), data.size(), NULL, &compressedSize) != ERR_BUFFER_TOO_SMALL) + if (LzmaCompress((const UINT8*)data.constData(), data.size(), NULL, &compressedSize, dictionarySize) != ERR_BUFFER_TOO_SMALL) return ERR_CUSTOMIZED_COMPRESSION_FAILED; compressed = new UINT8[compressedSize]; - if (LzmaCompress((const UINT8*)data.constData(), data.size(), compressed, &compressedSize) != ERR_SUCCESS) { + if (LzmaCompress((const UINT8*)data.constData(), data.size(), compressed, &compressedSize, dictionarySize) != ERR_SUCCESS) { delete[] compressed; return ERR_CUSTOMIZED_COMPRESSION_FAILED; } @@ -2953,10 +2972,10 @@ UINT32 headerSize = sizeOfSectionHeader(sectionHeader); header = data.left(headerSize); QByteArray newData = data.mid(headerSize); - if (LzmaCompress((const UINT8*)newData.constData(), newData.size(), NULL, &compressedSize) != ERR_BUFFER_TOO_SMALL) + if (LzmaCompress((const UINT8*)newData.constData(), newData.size(), NULL, &compressedSize, dictionarySize) != ERR_BUFFER_TOO_SMALL) return ERR_CUSTOMIZED_COMPRESSION_FAILED; compressed = new UINT8[compressedSize]; - if (LzmaCompress((const UINT8*)newData.constData(), newData.size(), compressed, &compressedSize) != ERR_SUCCESS) { + if (LzmaCompress((const UINT8*)newData.constData(), newData.size(), compressed, &compressedSize, dictionarySize) != ERR_SUCCESS) { delete[] compressed; return ERR_CUSTOMIZED_COMPRESSION_FAILED; } @@ -3919,21 +3938,29 @@ EFI_COMPRESSION_SECTION* compessionHeader = (EFI_COMPRESSION_SECTION*)header.data(); // Set new uncompressed size compessionHeader->UncompressedLength = reconstructed.size(); - // Compress new section body - QByteArray compressed; - result = compress(reconstructed, model->compression(index), compressed); - if (result) - return result; + // Correct compression type - if (model->compression(index) == COMPRESSION_ALGORITHM_NONE) + if (model->compression(index) == COMPRESSION_ALGORITHM_NONE) { compessionHeader->CompressionType = EFI_NOT_COMPRESSED; - else if (model->compression(index) == COMPRESSION_ALGORITHM_LZMA || model->compression(index) == COMPRESSION_ALGORITHM_IMLZMA) - compessionHeader->CompressionType = EFI_CUSTOMIZED_COMPRESSION; - else if (model->compression(index) == COMPRESSION_ALGORITHM_EFI11 || model->compression(index) == COMPRESSION_ALGORITHM_TIANO) + } + else if (model->compression(index) == COMPRESSION_ALGORITHM_EFI11 || model->compression(index) == COMPRESSION_ALGORITHM_TIANO) { compessionHeader->CompressionType = EFI_STANDARD_COMPRESSION; + } + else if (model->compression(index) == COMPRESSION_ALGORITHM_LZMA) { + compessionHeader->CompressionType = EFI_CUSTOMIZED_COMPRESSION; + } + else if (model->compression(index) == COMPRESSION_ALGORITHM_IMLZMA) { + compessionHeader->CompressionType = EFI_CUSTOMIZED_COMPRESSION; + } else return ERR_UNKNOWN_COMPRESSION_ALGORITHM; + // Compress new section body + QByteArray compressed; + result = compress(reconstructed, model->compression(index), model->dictionarySize(index), compressed); + if (result) + return result; + // Replace new section body reconstructed = compressed; } @@ -3941,7 +3968,7 @@ EFI_GUID_DEFINED_SECTION* guidDefinedHeader = (EFI_GUID_DEFINED_SECTION*)header.data(); // Compress new section body QByteArray compressed; - result = compress(reconstructed, model->compression(index), compressed); + result = compress(reconstructed, model->compression(index), model->dictionarySize(index), compressed); if (result) return result; // Check for authentication status valid attribute diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/ffsengine.h new/UEFITool-20181230/ffsengine.h --- old/UEFITool-20180624/ffsengine.h 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/ffsengine.h 2018-12-30 16:37:27.000000000 +0100 @@ -76,7 +76,7 @@ // Compression routines UINT8 decompress(const QByteArray & compressed, const UINT8 compressionType, QByteArray & decompressedData, UINT8 * algorithm = NULL); - UINT8 compress(const QByteArray & data, const UINT8 algorithm, QByteArray & compressedData); + UINT8 compress(const QByteArray & data, const UINT8 algorithm, const UINT32 dictionarySize, QByteArray & compressedData); // Construction routines UINT8 reconstructImageFile(QByteArray &reconstructed); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/treeitem.cpp new/UEFITool-20181230/treeitem.cpp --- old/UEFITool-20180624/treeitem.cpp 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/treeitem.cpp 2018-12-30 16:37:27.000000000 +0100 @@ -23,6 +23,7 @@ itemType(type), itemSubtype(subtype), itemCompression(compression), + itemDictionarySize(0), itemName(name), itemText(text), itemInfo(info), @@ -198,6 +199,16 @@ return itemAction; } +UINT32 TreeItem::dictionarySize() const +{ + return itemDictionarySize; +} + +void TreeItem::setDictionarySize(const UINT32 dictionarySize) +{ + itemDictionarySize = dictionarySize; +} + void TreeItem::setAction(const UINT8 action) { itemAction = action; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/treeitem.h new/UEFITool-20181230/treeitem.h --- old/UEFITool-20180624/treeitem.h 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/treeitem.h 2018-12-30 16:37:27.000000000 +0100 @@ -72,12 +72,16 @@ UINT8 compression() const; + UINT32 dictionarySize() const; + void setDictionarySize(const UINT32 dictionarySize); + private: QList<TreeItem*> childItems; UINT8 itemAction; UINT8 itemType; UINT8 itemSubtype; UINT8 itemCompression; + UINT32 itemDictionarySize; QString itemName; QString itemText; QString itemInfo; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/treemodel.cpp new/UEFITool-20181230/treemodel.cpp --- old/UEFITool-20180624/treemodel.cpp 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/treemodel.cpp 2018-12-30 16:37:27.000000000 +0100 @@ -218,6 +218,14 @@ return item->compression(); } +UINT32 TreeModel::dictionarySize(const QModelIndex &index) const +{ + if (!index.isValid()) + return 0; + TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); + return item->dictionarySize(); +} + void TreeModel::setSubtype(const QModelIndex & index, const UINT8 subtype) { if (!index.isValid()) @@ -268,6 +276,16 @@ emit dataChanged(this->index(0, 0), index); } +void TreeModel::setDictionarySize(const QModelIndex &index, const UINT32 dictionarySize) +{ + if (!index.isValid()) + return; + + TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); + item->setDictionarySize(dictionarySize); + emit dataChanged(this->index(0, 0), index); +} + QModelIndex TreeModel::addItem(const UINT8 type, const UINT8 subtype, const UINT8 compression, const QString & name, const QString & text, const QString & info, const QByteArray & header, const QByteArray & body, const QModelIndex & parent, const UINT8 mode) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/treemodel.h new/UEFITool-20181230/treemodel.h --- old/UEFITool-20180624/treemodel.h 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/treemodel.h 2018-12-30 16:37:27.000000000 +0100 @@ -47,7 +47,7 @@ void setSubtype(const QModelIndex &index, const UINT8 subtype); void setName(const QModelIndex &index, const QString &name); void setText(const QModelIndex &index, const QString &text); - void setParsingData(const QModelIndex &index, const QByteArray &data); + void setDictionarySize(const QModelIndex &index, const UINT32 dictionarySize); QString name(const QModelIndex &index) const; QString text(const QModelIndex &index) const; @@ -58,10 +58,9 @@ bool hasEmptyHeader(const QModelIndex &index) const; QByteArray body(const QModelIndex &index) const; bool hasEmptyBody(const QModelIndex &index) const; - QByteArray parsingData(const QModelIndex &index) const; - bool hasEmptyParsingData(const QModelIndex &index) const; UINT8 action(const QModelIndex &index) const; UINT8 compression(const QModelIndex &index) const; + UINT32 dictionarySize(const QModelIndex &index) const; QModelIndex addItem(const UINT8 type, const UINT8 subtype = 0, const UINT8 compression = COMPRESSION_ALGORITHM_NONE, const QString & name = QString(), const QString & text = QString(), const QString & info = QString(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UEFITool-20180624/version.h new/UEFITool-20181230/version.h --- old/UEFITool-20180624/version.h 2018-06-24 16:07:52.000000000 +0200 +++ new/UEFITool-20181230/version.h 2018-12-30 16:37:27.000000000 +0100 @@ -11,9 +11,9 @@ */ -#ifndef __VERSION_H__ -#define __VERSION_H__ +#ifndef VERSION_H +#define VERSION_H -#define PROGRAM_VERSION "0.25.1" +#define PROGRAM_VERSION "0.26.0" -#endif \ No newline at end of file +#endif // VERSION_H ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.wym7TD/_old 2019-10-23 15:54:38.134940104 +0200 +++ /var/tmp/diff_new_pack.wym7TD/_new 2019-10-23 15:54:38.134940104 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/LongSoft/UEFITool.git</param> - <param name="changesrevision">e6f84f9f7ddd61a95a968a2b3a89df39038f4f03</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">4bee991c949b458739ffa96b88dbc589192c7689</param></service></servicedata> \ No newline at end of file