Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalysisReport ¶
type AnalysisReport struct {
// Entries contains each block with different data.
Entries AnalysisReportEntries
// AddressMapper converts the address in DiffRange into a position in the SystemArtifact.
AddressMapper types.AddressMapper
// 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( diffMemRanges Ranges, memMapper types.AddressMapper, measurements Measurements, goodFirmware, badFirmware *biosimage.BIOSImage, ) (report AnalysisReport, err error)
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 DataChunks ¶ added in v2.8.0
type DataChunks []DataChunk
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 Measurement ¶ added in v2.8.0
type Measurement struct {
Description string
Chunks DataChunks
CustomData any
}
type Measurements ¶ added in v2.8.0
type Measurements []Measurement
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 Ranges ¶ added in v2.8.0
func Diff ¶
func Diff( memRanges pkgbytes.Ranges, memMapper types.AddressMapper, firmwareGood, firmwareBad *biosimage.BIOSImage, ignoreByteSet []byte, ) (Ranges, error)
Diff compares firmwareGoodData and firmwareBadData in areas specified by rangesOrig and returns the (memory) ranges where the data differs.
ignoreByteSet is a set of bytes, each of which is just skipped while looking for differences.
type RelatedMeasurement ¶
type RelatedMeasurement struct {
RelatedDataChunks DataChunks
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