verity

package
v1.75.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVersionNotFound = errors.New("version not found")
	ErrEmptyHash       = errors.New("empty hash")
)

Functions

func CloseMapper

func CloseMapper(ctx context.Context, name string) error

CloseMapper closes device mapper Equivalent shell command: veritysetup close <name>

func CreateImage

func CreateImage(ctx context.Context, modulePath, imagePath string) error

CreateImage uses mkfs.erofs to create image from module dir. Equivalent shell command: mkfs.erofs --aufs --quiet -Enoinline_data -T 1750791050 -Uclear -x-1 <imagePath> <modulePath>

func CreateImageByTar

func CreateImageByTar(ctx context.Context, rc io.ReadCloser, imagePath string) error

CreateImageByTar uses mkfs.erofs to create image from tar. Equivalent shell command: mkfs.erofs --tar=f --aufs --quiet -Enoinline_data -T 1750791050 -Uclear -x-1 <imagePath> <modulePath>

func CreateImageHash

func CreateImageHash(ctx context.Context, imagePath string) (string, error)

CreateImageHash computes hash from the image by veritysetup format Equivalent shell command: veritysetup format --data-block-size=4096 --hash-block-size=4096 --salt=<salt> <imagePath> <hashPath>

func CreateMapper

func CreateMapper(ctx context.Context, name, imagePath, hash string) error

CreateMapper creates device mapper for the erofs image. It creates two loop devices and attach image and hash file for them. Equivalent shell command: veritysetup open <imagePath> <name> <hashPath> <hash>

func GetVersionByDevice added in v1.75.0

func GetVersionByDevice(ctx context.Context, name string) (string, error)

GetVersionByDevice retrieves the image version from an active dm-verity device by querying its status via veritysetup and parsing the data device path. Equivalent shell command: veritysetup status <name>

func IsSupported

func IsSupported() bool

IsSupported scans /proc/filesystems for erofs type, it returns whether erofs is supported

func Mount

func Mount(ctx context.Context, name, mountPath string) error

Mount ensures the mount path and mounts the device mapper to it

func Unmount

func Unmount(ctx context.Context, mountPath string) error

Unmount unmounts image and remove mount path

func VerifyImage

func VerifyImage(ctx context.Context, imagePath, rootHash string) error

VerifyImage performs verification of the erofs image against its hash tree using veritysetup. Equivalent shell command: veritysetup verify <imagePath> <hashPath> <root_hash>

Types

This section is empty.

Jump to

Keyboard shortcuts

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