Documentation ¶
Overview ¶
package policy provides helpers for running the TPM2 policy rules corresponding to spam policy checks.
Index ¶
- Variables
- func Extend(alg crypto.Hash, currentPolicy []byte, rule *policypb.Rule) ([]byte, error)
- func For(alg crypto.Hash, rules []*policypb.Rule) ([]byte, error)
- func FromTextpbOrPanic(textpb string) *policypb.Policy
- func RuleFromTextpbOrPanic(textpb string) *policypb.Rule
- func RunRule(tpm io.ReadWriter, s tpmutil.Handle, r *policypb.Rule) error
- type InvalidPolicyError
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 ¶
Extend calculates the policy hash for a rule, given a starting policy, with the specified algorithm.
func For ¶
For calculates the TPM policy hash for the given sequence of rules, with the specified algorithm.
func FromTextpbOrPanic ¶
FromTextpbOrPanic returns a Policy parsed from a given textpb.
func RuleFromTextpbOrPanic ¶
RuleFromTextpbOrPanic returns a Rule parsed from a given textpb.
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
Click to show internal directories.
Click to hide internal directories.