github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/fit/errors.go (about) 1 // Copyright 2017-2021 the LinuxBoot Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package fit 6 7 import ( 8 "fmt" 9 10 "github.com/linuxboot/fiano/pkg/intel/metadata/fit/consts" 11 ) 12 13 // ErrACMInvalidKeySize means ACM entry has invalid key size 14 type ErrACMInvalidKeySize struct { 15 ExpectedKeySize uint64 16 RealKeySize uint64 17 } 18 19 func (err *ErrACMInvalidKeySize) Error() string { 20 return fmt.Sprintf("invalid key size, expected:%d, real:%d", 21 err.ExpectedKeySize, err.RealKeySize) 22 } 23 24 // ErrUnknownACMHeaderVersion means ACM entry has invalid header version 25 type ErrUnknownACMHeaderVersion struct { 26 ACHeaderVersion ACModuleHeaderVersion 27 } 28 29 func (err *ErrUnknownACMHeaderVersion) Error() string { 30 return fmt.Sprintf("unknown ACM header version: %#v", err.ACHeaderVersion) 31 } 32 33 // ErrInvalidTXTPolicyRecordVersion means TXT Policy entry has invalid version. 34 type ErrInvalidTXTPolicyRecordVersion struct { 35 EntryVersion EntryVersion 36 } 37 38 func (err *ErrInvalidTXTPolicyRecordVersion) Error() string { 39 return fmt.Sprintf("invalid TXT policy record version: %v", err.EntryVersion) 40 } 41 42 // ErrExpectedFITHeadersMagic means FIT magic string was not found where 43 // it was expected. 44 type ErrExpectedFITHeadersMagic struct { 45 Received []byte 46 } 47 48 func (err *ErrExpectedFITHeadersMagic) Error() string { 49 return fmt.Sprintf("string '%s' was expected as the Address value of the FIT header entry, but received: '%s'", 50 consts.FITHeadersMagic, err.Received) 51 } 52 53 // ErrNotFound literally means "not found". 54 type ErrNotFound struct{} 55 56 func (ErrNotFound) Error() string { 57 return "not found" 58 }