75: Make PCRs() take the digest algorithm (#77)

This commit is contained in:
Tom D
2019-08-20 11:52:12 -07:00
committed by GitHub
parent 6b09d5331a
commit 6e2e8693ad
8 changed files with 62 additions and 70 deletions

View File

@ -16,7 +16,6 @@ package attest
import (
"bytes"
"crypto"
"encoding/binary"
"fmt"
"io"
@ -251,16 +250,6 @@ func readAllPCRs20(tpm io.ReadWriter, alg tpm2.Algorithm) (map[uint32][]byte, er
return out, nil
}
func allPCRs20(tpm io.ReadWriter) (map[uint32][]byte, crypto.Hash, error) {
out256, err256 := readAllPCRs20(tpm, tpm2.AlgSHA256)
if err256 != nil {
// TPM may not implement active banks with SHA256 - try SHA1.
out1, err1 := readAllPCRs20(tpm, tpm2.AlgSHA1)
return out1, crypto.SHA1, err1
}
return out256, crypto.SHA256, nil
}
// LoadAIK loads a previously-created aik into the TPM for use.
// A key loaded via this function needs to be closed with .Close().
// Only blobs generated by calling AIK.Serialize() are valid parameters