package dmverity
import "github.com/Microsoft/hcsshim/ext4/dmverity"
Index ¶
- Constants
- Variables
- func ComputeAndWriteHashDevice(r io.ReadSeeker, w io.Writer) error
- func MerkleTree(r io.Reader) ([]byte, error)
- func NewDMVeritySuperblock(size uint64) *dmveritySuperblock
- func RootHash(tree []byte) []byte
- type VerityInfo
Constants ¶
const ( // MerkleTreeBufioSize is a default buffer size to use with bufio.Reader MerkleTreeBufioSize = memory.MiB // 1MB // RecommendedVHDSizeGB is the recommended size in GB for VHDs, which is not a hard limit. RecommendedVHDSizeGB = 128 * memory.GiB // VeritySignature is a value written to dm-verity super-block. VeritySignature = "verity" )
Variables ¶
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") ErrNotVeritySuperBlock = errors.New("invalid dm-verity super-block signature") )
Functions ¶
func ComputeAndWriteHashDevice ¶
func ComputeAndWriteHashDevice(r io.ReadSeeker, w io.Writer) error
ComputeAndWriteHashDevice builds merkle tree from a given io.ReadSeeker and writes the result hash device (dm-verity super-block combined with merkle tree) to io.Writer.
func MerkleTree ¶
MerkleTree constructs dm-verity hash-tree for a given io.Reader 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 ¶
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
func ReadDMVerityInfoReader ¶
func ReadDMVerityInfoReader(r io.Reader) (*VerityInfo, error)
Source Files ¶
- Version
- v0.12.9 (latest)
- Published
- Oct 30, 2024
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 13 hours ago –
Tools for package owners.