dmverity

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RecommendedVHDSizeGB is the recommended size in GB for VHDs, which is not a hard limit.
	RecommendedVHDSizeGB = 128 * 1024 * 1024 * 1024
)

Variables

View Source
var (
	ErrSuperBlockReadFailure  = errors.New("failed to read dm-verity super block")
	ErrSuperBlockParseFailure = errors.New("failed to parse dm-verity super block")
	ErrRootHashReadFailure    = errors.New("failed to read dm-verity root hash")
)

Functions

func MerkleTree

func MerkleTree(data []byte) ([]byte, error)

MerkleTree constructs dm-verity hash-tree for a given byte array with a fixed salt (0-byte) and algorithm (sha256).

func NewDMVeritySuperblock

func NewDMVeritySuperblock(size uint64) *dmveritySuperblock

NewDMVeritySuperblock returns a dm-verity superblock for a device with a given size, salt, algorithm and versions are fixed.

func RootHash

func RootHash(tree []byte) []byte

RootHash computes root hash of dm-verity hash-tree

Types

type VerityInfo

type VerityInfo struct {
	// Offset in blocks on hash device
	HashOffsetInBlocks int64
	// Set to true, when dm-verity super block is also written on the hash device
	SuperBlock    bool
	RootDigest    string
	Salt          string
	Algorithm     string
	DataBlockSize uint32
	HashBlockSize uint32
	DataBlocks    uint64
	Version       uint32
}

VerityInfo is minimal exported version of dmveritySuperblock

func ReadDMVerityInfo

func ReadDMVerityInfo(vhdPath string, offsetInBytes int64) (*VerityInfo, error)

ReadDMVerityInfo extracts dm-verity super block information and merkle tree root hash

Jump to

Keyboard shortcuts

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