Skip to content

Commit

Permalink
AKPublic.VerifyAll: Additionally validate input parameters (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
twitchy-jsonp authored Jan 31, 2022
1 parent 82f2c9c commit 277c40c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions attest/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,17 @@ func (a *AKPublic) Verify(quote Quote, pcrs []PCR, nonce []byte) error {

// VerifyAll uses multiple quotes to verify the authenticity of all PCR
// measurements. See documentation on Verify() for semantics.
//
// An error is returned if any PCRs provided were not covered by a quote,
// or if no quote/nonce was provided.
func (a *AKPublic) VerifyAll(quotes []Quote, pcrs []PCR, nonce []byte) error {
if len(quotes) == 0 {
return errors.New("no quotes were provided")
}
if len(nonce) == 0 {
return errors.New("no nonce was provided")
}

for i, quote := range quotes {
if err := a.Verify(quote, pcrs, nonce); err != nil {
return fmt.Errorf("quote %d: %v", i, err)
Expand Down

0 comments on commit 277c40c

Please sign in to comment.