Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
func Diff(rangesOrig pkgbytes.Ranges, firmwareGoodData, firmwareBadData, ignoreByteSet []byte) pkgbytes.Ranges
Diff compares firmwareGoodData and firmwareBadData in areas specified by rangesOrig and returns the ranges where the data differs.
ignoreByteSet is a set of bytes, each of which is just skipped while looking for differences.
Types ¶
type AnalysisReport ¶
type AnalysisReport struct { // Entries contains each block with different data. Entries AnalysisReportEntries // FirstProblemOffset is the offset of the first byte with a different value. FirstProblemOffset uint64 // BytesChanged is a count of bytes with different values. BytesChanged uint64 // HammingDistance is a bit-wise hamming distance between images. HammingDistance uint64 // HammingDistanceNon00orFF is a bit-wise hamming distance between images, excluding // bytes 0x00 and 0xff HammingDistanceNon00orFF uint64 }
AnalysisReport contains an analyzed report for an UEFI image diff.
func Analyze ¶
func Analyze( diffRangesOrig pkgbytes.Ranges, measurements pcr.Measurements, goodFirmware Firmware, badData []byte, ) (report AnalysisReport)
Analyze generates a difference report filled with additional simple analytics, like hamming distance.
func (*AnalysisReport) AddOffset ¶
func (report *AnalysisReport) AddOffset(offset int64)
AddOffset just adds the offset to all offsets of the report
type AnalysisReportEntries ¶
type AnalysisReportEntries []AnalysisReportEntry
AnalysisReportEntries is a set of multiple AnalysisReportEntry-ies.
func (AnalysisReportEntries) DiffRanges ¶
func (s AnalysisReportEntries) DiffRanges() pkgbytes.Ranges
DiffRanges returns DiffRange-s.
type AnalysisReportEntry ¶
type AnalysisReportEntry struct { // DiffRange is the information about offsets where the data is different. DiffRange pkgbytes.Range // HammingDistance is a bit-wise hamming distance between the data blocks. HammingDistance uint64 // HammingDistanceNon00orFF is a bit-wise hamming distance between the data // blocks, excluding bytes 0x00 and 0xff HammingDistanceNon00orFF uint64 // RelatedMeasurements contains the list of measurements which overlaps // with the data block. RelatedMeasurements []RelatedMeasurement // Nodes contains the list of UEFI nodes (regions, volumes, modules, files) // which overlaps with the data block Nodes []NodeInfo }
AnalysisReportEntry contains information about on block with different data.
type Firmware ¶
type Firmware interface { Buf() []byte GetByRange(byteRange pkgbytes.Range) (nodes []*ffs.Node, err error) NameToRangesMap() map[string]pkgbytes.Ranges }
Firmware is an abstraction over *uefi.UEFI
type NodeInfos ¶
type NodeInfos []NodeInfo
NodeInfos is a slice of NodeInfo-s
func GetNodesInfo ¶
GetNodesInfo converts nodes to structures ready for human-readable printing.
TODO: move this to a "format" package
type RelatedMeasurement ¶
type RelatedMeasurement struct { RelatedDataChunks pcr.DataChunks pcr.Measurement }
RelatedMeasurement contains the related measurement and the data chunks specifically related to the diff.
type RelatedMeasurementsLaconic ¶
type RelatedMeasurementsLaconic []RelatedMeasurement
RelatedMeasurementsLaconic is a helper to print measurements in a laconic way
func (RelatedMeasurementsLaconic) String ¶
func (s RelatedMeasurementsLaconic) String() string
String implements fmt.Stringer