Exemple #1
0
func (tt *TPM2Tao) loadQuote() (tpm2.Handle, error) {
	qh, err := tpm2.LoadContext(tt.rw, tt.quoteContext)
	if err != nil {
		return tpm2.Handle(0), errors.New("Load Context fails for quote")
	}
	return qh, nil
}
Exemple #2
0
// IAH: does it build?
func (tt *TPM2Tao) loadSeal() (tpm2.Handle, error) {
	sh, err := tpm2.LoadContext(tt.rw, tt.sealContext)
	if err != nil {
		return tpm2.Handle(0), errors.New("Load Context fails for root")
	}
	return sh, nil
}
Exemple #3
0
func (tt *TPM2Tao) loadRoot() (tpm2.Handle, error) {
	rh, err := tpm2.LoadContext(tt.rw, tt.rootContext)
	if err != nil {
		return tpm2.Handle(0), errors.New("Load Context fails for root")
	}
	return rh, nil
}
Exemple #4
0
// FinalizeTPM2Tao releases the resources for the TPM2Tao.
func FinalizeTPM2Tao(tt *TPM2Tao) {
	if tt.sessionHandle != 0 {
		tpm2.FlushContext(tt.rw, tpm2.Handle(tt.sessionHandle))
	}
	tt.sessionHandle = 0
	if tt.rootHandle != 0 {
		tpm2.FlushContext(tt.rw, tpm2.Handle(tt.rootHandle))
	}
	tt.rootHandle = 0
	if tt.sealHandle != 0 {
		tpm2.FlushContext(tt.rw, tpm2.Handle(tt.sealHandle))
	}
	tt.sealHandle = 0

	// Release the file handle.
	tt.rw.Close()
}
Exemple #5
0
func (tt *TPM2Tao) loadSession() (tpm2.Handle, []byte, error) {
	sh, digest, err := tpm2.AssistCreateSession(tt.rw,
		tpm2.AlgTPM_ALG_SHA1, tt.pcrs)
	if err != nil {
		return tpm2.Handle(0), nil, err
	}
	return sh, digest, nil
}