From a957b0569c20e958bcecd2def7ea698365edbb54 Mon Sep 17 00:00:00 2001 From: Daniel Maslowski Date: Sat, 28 Sep 2024 22:37:38 +0200 Subject: [PATCH] pkg/uefi/meregion: fix type FTP->FPT Easily confused: FPTR is the name of one partition, whereas FPT is the Firmware Partition Table (as far as we know). Signed-off-by: Daniel Maslowski --- pkg/uefi/meregion.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/uefi/meregion.go b/pkg/uefi/meregion.go index dae07ef6..51ae4b02 100644 --- a/pkg/uefi/meregion.go +++ b/pkg/uefi/meregion.go @@ -18,10 +18,10 @@ import ( // // ME partition informations from http://me.bios.io/ME_blob_format -// MEFTPSignature is the sequence of bytes that an ME Flash Partition +// MEFPTSignature is the sequence of bytes that an ME Flash Partition // Table is expected to start with ie "$FPT". var ( - MEFTPSignature = []byte{0x24, 0x46, 0x50, 0x54} + MEFPTSignature = []byte{0x24, 0x46, 0x50, 0x54} ) const ( @@ -93,17 +93,17 @@ func (e MEPartitionEntry) Type() string { return fmt.Sprintf("Unknown (%d)", t) } -// FindMEDescriptor searches for an Intel ME FTP signature +// FindMEDescriptor searches for an Intel ME FPT signature func FindMEDescriptor(buf []byte) (int, error) { - if bytes.Equal(buf[16:16+len(MEFTPSignature)], MEFTPSignature) { + if bytes.Equal(buf[16:16+len(MEFPTSignature)], MEFPTSignature) { // 16 + 4 since the descriptor starts after the signature - return 16 + len(MEFTPSignature), nil + return 16 + len(MEFPTSignature), nil } - if bytes.Equal(buf[:len(MEFTPSignature)], MEFTPSignature) { + if bytes.Equal(buf[:len(MEFPTSignature)], MEFPTSignature) { // + 4 since the descriptor starts after the signature - return len(MEFTPSignature), nil + return len(MEFPTSignature), nil } - return -1, fmt.Errorf("ME Flash Partition Table signature %#02x not found: first 20 bytes are:\n%s", MEFTPSignature, hex.Dump(buf[:20])) + return -1, fmt.Errorf("ME Flash Partition Table signature %#02x not found: first 20 bytes are:\n%s", MEFPTSignature, hex.Dump(buf[:20])) } // Buf returns the buffer.