Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve PCR comparison. #13

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions internal/enclave/nitro/pcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ func (p pcr) FromDebugMode() bool {

// Equal returns true if (and only if) the two given PCR maps are identical.
func (ours pcr) Equal(theirs pcr) bool {
// PCR4 contains a hash over the parent's instance ID. Our enclaves run
// on different parent instances, so PCR4 will therefore always differ:
// https://docs.aws.amazon.com/enclaves/latest/user/set-up-attestation.html
delete(ours, 4)
delete(theirs, 4)

if len(ours) != len(theirs) {
return false
}

for i, ourValue := range ours {
// PCR4 contains a hash over the parent's instance ID. If horizontal
// scaling is enabled, enclaves run on different parent instances, so
// PCR4 will differ:
// https://docs.aws.amazon.com/enclaves/latest/user/set-up-attestation.html
if i == 4 {
continue
}
theirValue, exists := theirs[i]
if !exists {
return false
Expand Down