measurements: compare to constants for clarity

This commit is contained in:
Thomas Tendyck 2023-03-29 10:52:57 +02:00 committed by Thomas Tendyck
parent 83e6b4d64d
commit 091fe3e2d7
2 changed files with 2 additions and 2 deletions

View File

@ -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)
}
}

View File

@ -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)