// GetTpmMeasurement retrieves the specified PCRs as well as a Quote over the PCRs
// and returnes it as an attestationreport TPM Measurement object
GetTpmMeasurement retrieves the specified PCRs as well as a Quote over the PCRs
and returnes it as an attestationreport TPM Measurement object
// GetTpmMeasurement retrieves the specified PCRs as well as a Quote over the PCRs // and returnes it as an attestationreport TPM Measurement object
func GetTpmMeasurement(t *Tpm, nonce []byte, pcrs []int) ([]attest.PCR, *attest.Quote, error) {
	if tpm == nil {
		return nil, nil, fmt.Errorf("TPM is not opened")
	}
	if ak == nil {
		return nil, nil, fmt.Errorf("AK does not exist")
	}
	log.Trace("Trying to get lock on TPM for measurements")
	t.Mu.Lock()
	log.Trace("Got lock on TPM for measurements")
	defer func() {
		log.Trace("Releasing TPM Lock for measurements")
		t.Mu.Unlock()
		log.Trace("Released TPM Lock for measurements")
	}()
	pcrValues, err := tpm.PCRs(attest.HashSHA256)
	if err != nil {
		return nil, nil, fmt.Errorf("Failed to get TPM PCRs: %v", err)
	}
	log.Trace("Finished reading PCRs from TPM")
	quote, err := ak.QuotePCRs(tpm, nonce, attest.HashSHA256, pcrs)
	if err != nil {
		return nil, nil, fmt.Errorf("Failed to get TPM quote - %v", err)
	}
	log.Trace("Finished getting Quote from TPM")
	return pcrValues, quote, nil
}
func GetTpmMeasurement ( t * Tpm , nonce [ ] byte , pcrs [ ] int ) ( [ ] attest . PCR , * attest . Quote , error ) { if tpm == nil { return nil , nil , fmt . Errorf ( " " ) } if ak == nil { return nil , nil , fmt . Errorf ( " " ) } log . Trace ( " " ) t . Mu . Lock ( ) log . Trace ( " " ) defer func ( ) { log . Trace ( " " ) t . Mu . Unlock ( ) log . Trace ( " " ) } ( ) pcrValues , err := tpm . PCRs ( attest . HashSHA256 ) if err != nil { return nil , nil , fmt . Errorf ( " " , err ) } log . Trace ( " " ) quote , err := ak . QuotePCRs ( tpm , nonce , attest . HashSHA256 , pcrs ) if err != nil { return nil , nil , fmt . Errorf ( " " , err ) } log . Trace ( " " ) return pcrValues , quote , nil }
GetTpmMeasurement retrieves the specified PCRs as well as a Quote over the PCRs
and returnes it as an attestationreport TPM Measurement object
GetTpmMeasurement retrieves the specified PCRs as well as a Quote over the PCRs and returnes it as an attestationreport TPM Measurement object
// Read and Store PCRs into TPM Measurement structure. Lock this access, as only // one instance can have write access at the same time // Retrieve quote and store quote data and signature in TPM measurement object