Esempio n. 1
0
func (c *Context) GetPolicy() (*Policy, error) {
	p := new(Policy)
	if result := C.Tspi_GetPolicyObject(C.TSS_HOBJECT(c.tpm), C.TSS_POLICY_USAGE, &p.policy); isError(result) {
		return nil, Error{result}
	}

	return p, nil
}
Esempio n. 2
0
func (rsa *RSA) GetPolicy() (*Policy, error) {
	p := new(Policy)
	if result := C.Tspi_GetPolicyObject(C.TSS_HOBJECT(rsa.handle), C.TSS_POLICY_USAGE, &p.policy); isError(result) {
		return nil, Error{result}
	}

	return p, nil
}
Esempio n. 3
0
File: tpm.go Progetto: krnowak/rkt
// GetPolicy returns the TSS policy associated with the TPM.
func (tpm *TPM) GetPolicy(poltype int) (*Policy, error) {
	var policyHandle C.TSS_HPOLICY
	err := tspiError(C.Tspi_GetPolicyObject((C.TSS_HOBJECT)(tpm.handle), (C.TSS_FLAG)(poltype), &policyHandle))
	return &Policy{handle: policyHandle, context: tpm.context}, err
}