Skip to content

Commit

Permalink
pkg/uefi/meregion: fix type FTP->FPT
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
orangecms committed Sep 29, 2024
1 parent d9260b5 commit a957b05
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/uefi/meregion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a957b05

Please sign in to comment.