Skip to content

Commit

Permalink
measurements: compare to constants for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasten committed Mar 29, 2023
1 parent 83e6b4d commit 091fe3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/attestation/measurements/measurements.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (m *M) EqualTo(other M) bool {
func (m *M) GetEnforced() []uint32 {
var enforced []uint32
for idx, measurement := range *m {
if !measurement.ValidationOpt {
if measurement.ValidationOpt == Enforce {
enforced = append(enforced, idx)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/attestation/vtpm/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (v *Validator) Validate(ctx context.Context, attDocRaw []byte, nonce []byte
}
for idx, pcr := range v.expected {
if !bytes.Equal(pcr.Expected[:], attDoc.Attestation.Quotes[quoteIdx].Pcrs.Pcrs[idx]) {
if !pcr.ValidationOpt {
if pcr.ValidationOpt == measurements.Enforce {
return nil, fmt.Errorf("untrusted PCR value at PCR index %d", idx)
}
v.log.Warnf("Encountered untrusted PCR value at index %d", idx)
Expand Down

0 comments on commit 091fe3e

Please sign in to comment.