From b47e659df50d3e2b63a2b822840d61c28874432b Mon Sep 17 00:00:00 2001 From: Dmitrii Okunev Date: Wed, 13 Apr 2022 15:24:49 +0100 Subject: [PATCH] [intel/fit] Fix ACMv3 headers parser HeaderVersion field is 32bits long, not 16bits long. The initial constant is a typo. Fixing it. Signed-off-by: Dmitrii Okunev --- pkg/intel/metadata/fit/ent_startup_ac_module_entry.go | 8 ++++++-- pkg/intel/metadata/fit/errors.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/intel/metadata/fit/ent_startup_ac_module_entry.go b/pkg/intel/metadata/fit/ent_startup_ac_module_entry.go index 58238bf7..15969900 100644 --- a/pkg/intel/metadata/fit/ent_startup_ac_module_entry.go +++ b/pkg/intel/metadata/fit/ent_startup_ac_module_entry.go @@ -106,12 +106,16 @@ type ACModuleHeaderVersion uint32 const ( // ACHeaderVersion0 is version "0.0 – for SINIT ACM before 2017" - ACHeaderVersion0 = ACModuleHeaderVersion(0x0000) + ACHeaderVersion0 = ACModuleHeaderVersion(0x00000000) // ACHeaderVersion3 is version "3.0 – for SINIT ACM of converge of BtG and TXT" - ACHeaderVersion3 = ACModuleHeaderVersion(0x0300) + ACHeaderVersion3 = ACModuleHeaderVersion(0x00030000) ) +func (ver ACModuleHeaderVersion) GoString() string { + return fmt.Sprintf("0x%08X", ver) +} + // ACChipsetID defines the module release identifier type ACChipsetID uint16 diff --git a/pkg/intel/metadata/fit/errors.go b/pkg/intel/metadata/fit/errors.go index 9ac68855..08ae7976 100644 --- a/pkg/intel/metadata/fit/errors.go +++ b/pkg/intel/metadata/fit/errors.go @@ -27,7 +27,7 @@ type ErrUnknownACMHeaderVersion struct { } func (err *ErrUnknownACMHeaderVersion) Error() string { - return fmt.Sprintf("unknown ACM header version: %v", err.ACHeaderVersion) + return fmt.Sprintf("unknown ACM header version: %#v", err.ACHeaderVersion) } // ErrInvalidTXTPolicyRecordVersion means TXT Policy entry has invalid version.