package
0.0.0-20211215024441-edbb0c75fc3b
Repository: https://github.com/chrisfenner/tpm-spam.git
Documentation: pkg.go.dev

# README

hashtree

package hashtree provides helpers for building and walking TPM2 PolicyOR trees.

Variables

var (
    ErrNodeIndexOutOfBounds = errors.New("node index out of bounds")
    ErrEmptyTree            = errors.New("tree is empty")
    ErrNodeNotAChild        = errors.New("node not a child")
)

Types

type PolicyHashTree

type PolicyHashTree [][]byte

PolicyHashTree represents a TPM2_PolicyOR tree as a complete 8-tree, where all internal nodes are hashes of PolicyOR commands, and all leaf nodes represent concrete policies used to create the tree. normalized sublist's policy.

func Build

func Build(alg crypto.Hash, leaves [][]byte) (*PolicyHashTree, error)

Build creates a PolicyHashTree holding the given leaves.

func (PolicyHashTree) ChildrenOf

func (t PolicyHashTree) ChildrenOf(index int) [][]byte

ChildrenOf returns the digests of all the children of the given internal node. If the node is a leaf node, returns nil.

func (PolicyHashTree) LeafIndex

func (t PolicyHashTree) LeafIndex(i int) (*int, error)

LeafIndex returns the index of the given leaf in the tree.

func (PolicyHashTree) Root

func (t PolicyHashTree) Root() ([]byte, error)

Root returns the root of the tree.

func (PolicyHashTree) RunOr

func (tree PolicyHashTree) RunOr(tpm io.ReadWriter, s tpmutil.Handle, index int) error

RunOr runs the PolicyOr command to go from the given node to its parent, in the given TPM session handle.


Readme created from Go doc with goreadme