fit

package
v3.0.0-...-66753ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package fit provides tools to read and verify FIT kernel images See https://doc.coreboot.org/lib/payloads/fit.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {

	// Cmdline is the command line for the new kernel.
	Cmdline string
	// Root is the FDT.
	Root *dt.FDT
	// Kernel is the name of the kernel node.
	Kernel string
	// InitRAMFS is the name of the initramfs node.
	InitRAMFS string
	// ConfigOverride is the optional FIT config to use instead of default
	ConfigOverride string
	// SkipInitRAMFS skips the search for an ramdisk entry in the config
	SkipInitRAMFS bool
	// BootRank ranks the priority of the images in boot menu
	BootRank int
	// KeyRing is the optional set of public keys used to validate images at Load
	KeyRing openpgp.KeyRing
	// contains filtered or unexported fields
}

Image is a Flattened Image Tree implementation for OSImage.

func New

func New(n string) (*Image, error)

New returns a new image initialized with a file containing an FDT.

func ParseConfig

func ParseConfig(r io.ReadSeeker) ([]Image, error)

ParseConfig reads r for a FIT image and returns a OSImage for each configuration parsed.

func (*Image) Edit

func (i *Image) Edit(f func(s string) string)

Edit edits the Image cmdline using a func.

func (*Image) GetConfigName

func (i *Image) GetConfigName() (string, error)

GetConfigName finds the name of the default configuration or returns the override config if available

func (*Image) Label

func (i *Image) Label() string

Label returns an Image Label.

func (*Image) Load

func (i *Image) Load(verbose bool) error

Load loads an image and reboots

func (*Image) LoadConfig

func (i *Image) LoadConfig() (string, string, error)

LoadConfig loads a configuration from a FIT image Returns <kernel_name>, <ramdisk_name>, error

func (*Image) Rank

func (i *Image) Rank() int

Rank returns an Image Rank.

func (*Image) ReadImage

func (i *Image) ReadImage(image string) (*bytes.Reader, error)

ReadImage reads an image node from an FDT and returns the `data` contents.

func (*Image) ReadSignedImage

func (i *Image) ReadSignedImage(image string, ring openpgp.KeyRing) (*bytes.Reader, error)

ReadSignedImage reads an image node from an FDT and verifies the content against a key set. Signature information is found in child nodes.

WARNING! Unlike many Go functions, this may return both the file and an error.

If the signature does not exist or does not match the keyring, both the file and a signature error will be returned.

func (*Image) String

func (i *Image) String() string

String is a Stringer for Image.

type PGPSignature

type PGPSignature struct {
	// contains filtered or unexported fields
}

PGPSignature implements a OpenPGP signature check.

func (PGPSignature) String

func (s PGPSignature) String() string

func (PGPSignature) Verify

func (s PGPSignature) Verify(b []byte, ring openpgp.KeyRing) (*bytes.Reader, error)

Verify runs a PKCS1v15 check using the RSA keys extracted from the provided key ring. Warning: If the signature does not exist or does not match the keyring, both the file and a signature error will be returned.

type RSASignature

type RSASignature struct {
	// contains filtered or unexported fields
}

RSASignature implements a PKCS1v15 signature check.

func (RSASignature) String

func (s RSASignature) String() string

func (RSASignature) Verify

func (s RSASignature) Verify(b []byte, ring openpgp.KeyRing) (*bytes.Reader, error)

Verify runs a OpenPGP check using the PGP keys extracted from the provided key ring. Warning: If the signature does not exist or does not match the keyring, both the file and a signature error will be returned.

type Signature

type Signature interface {
	fmt.Stringer
	// Warning: If the signature does not exist or does not match the keyring,
	// both the file and a signature error will be returned.
	// Returns a bytes.Reader to the original data array.
	Verify([]byte, openpgp.KeyRing) (*bytes.Reader, error)
}

Signature defines an extendable interface for verifying images using varying signing methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL