policy

package
v0.0.0-...-edbb0c7 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

README

policy

package policy provides helpers for running the TPM2 policy rules corresponding to spam policy checks.

Variables

var (
    ErrInvalidType       = errors.New("invalid type")
    ErrInvalidIndex      = errors.New("invalid index")
    ErrInvalidComparison = errors.New("invalid comparison")
    ErrInvalidAssertion  = errors.New("invalid assertion")
    ErrNoSubpolicies     = errors.New("no subpolicies")
    ErrOverflow          = errors.New("offset + data length > 64")
    ErrNilPolicy         = errors.New("nil policy")
)

Functions

func Extend

func Extend(alg crypto.Hash, currentPolicy []byte, rule *policypb.Rule) ([]byte, error)

Extend calculates the policy hash for a rule, given a starting policy, with the specified algorithm.

func For

func For(alg crypto.Hash, rules []*policypb.Rule) ([]byte, error)

For calculates the TPM policy hash for the given sequence of rules, with the specified algorithm.

func FromTextpbOrPanic

func FromTextpbOrPanic(textpb string) *policypb.Policy

FromTextpbOrPanic returns a Policy parsed from a given textpb.

func RuleFromTextpbOrPanic

func RuleFromTextpbOrPanic(textpb string) *policypb.Rule

RuleFromTextpbOrPanic returns a Rule parsed from a given textpb.

func RunRule

func RunRule(tpm io.ReadWriter, s tpmutil.Handle, r *policypb.Rule) error

RunRule runs the rule in the given session handle.

Types

type InvalidPolicyError

type InvalidPolicyError struct { ... }

InvalidPolicyError indicates that something is wrong with a spam policy.

func (InvalidPolicyError) Error

func (e InvalidPolicyError) Error() string

func (InvalidPolicyError) Unwrap

func (e InvalidPolicyError) Unwrap() error


Readme created from Go doc with goreadme

Documentation

Overview

package policy provides helpers for running the TPM2 policy rules corresponding to spam policy checks.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidType       = errors.New("invalid type")
	ErrInvalidIndex      = errors.New("invalid index")
	ErrInvalidComparison = errors.New("invalid comparison")
	ErrInvalidAssertion  = errors.New("invalid assertion")
	ErrNoSubpolicies     = errors.New("no subpolicies")
	ErrOverflow          = errors.New("offset + data length > 64")
	ErrNilPolicy         = errors.New("nil policy")
)

Functions

func Extend

func Extend(alg crypto.Hash, currentPolicy []byte, rule *policypb.Rule) ([]byte, error)

Extend calculates the policy hash for a rule, given a starting policy, with the specified algorithm.

func For

func For(alg crypto.Hash, rules []*policypb.Rule) ([]byte, error)

For calculates the TPM policy hash for the given sequence of rules, with the specified algorithm.

func FromTextpbOrPanic

func FromTextpbOrPanic(textpb string) *policypb.Policy

FromTextpbOrPanic returns a Policy parsed from a given textpb.

func RuleFromTextpbOrPanic

func RuleFromTextpbOrPanic(textpb string) *policypb.Rule

RuleFromTextpbOrPanic returns a Rule parsed from a given textpb.

func RunRule

func RunRule(tpm io.ReadWriter, s tpmutil.Handle, r *policypb.Rule) error

RunRule runs the rule in the given session handle.

Types

type InvalidPolicyError

type InvalidPolicyError struct {
	Policy interface{}
	Err    error
}

InvalidPolicyError indicates that something is wrong with a spam policy.

func (InvalidPolicyError) Error

func (e InvalidPolicyError) Error() string

func (InvalidPolicyError) Unwrap

func (e InvalidPolicyError) Unwrap() error

Jump to

Keyboard shortcuts

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