-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add pk and kek to the SecureBootState proto message and populate them. #534
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add/update tests for the happy path at least.
proto/attest.proto
Outdated
@@ -149,6 +149,10 @@ message SecureBootState { | |||
// Authority events post-separator. Pre-separator authorities | |||
// are currently not supported. | |||
Database authority = 4; | |||
// Platform Keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please keep comments consistent:
"The Secure Boot Platform key, used to sign key exchange keys."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// Platform Keys | ||
Database pk = 5; | ||
// Exchange Keys | ||
Database kek = 6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The Secure Boot Key Exchange Keys, used to sign db and dbx updates."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing (https://github.com/google/go-tpm-tools/actions/runs/13159943001/job/36742118354?pr=534). You need to regenerate the pb files and check the changes in using go generate ./...
server/eventlog_test.go
Outdated
for _, cert := range msState.GetSecureBoot().GetKek().GetCerts() { | ||
switch c := cert.GetRepresentation().(type) { | ||
case *attestpb.Certificate_Der: | ||
if !bytes.Equal(c.Der, MicrosoftKEKCA2011Cert) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it would be nice to update
go-tpm-tools/server/eventlog.go
Line 418 in 7fe225f
func matchWellKnown(cert x509.Certificate) (pb.WellKnownCertificate, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
And as discussed offline, I also added GceDefaultPKCert to this list of well known certificates.
Done. Regenerated attest.pb.go and tpm.pb.go. |
server/eventlog_test.go
Outdated
case *attestpb.Certificate_WellKnown: | ||
if c.WellKnown == attestpb.WellKnownCertificate_UNKNOWN { | ||
t.Error(("found WellKnownCertificate_UNKNOWN in pk")) | ||
} | ||
if c.WellKnown == attestpb.WellKnownCertificate_GCE_DEFAULT_PK { | ||
containsGCEDefaultPK = true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be simplified:
certs := msState.GetSecureBoot().GetPk().GetCerts()
if len(certs) != 1 {
t.Error()
}
wkRep, ok := certs[0].(*attestpb.Certificate_WellKnown)
if !ok {
t.Error()
}
if wkRep.WellKnown != WellKnownCertificate_GCE_DEFAULT_PK{
t.Error()
}
Same with the KEK check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be simplified:
certs := msState.GetSecureBoot().GetPk().GetCerts() if len(certs) != 1 { t.Error() } wkRep, ok := certs[0].(*attestpb.Certificate_WellKnown) if !ok { t.Error() } if wkRep.WellKnown != WellKnownCertificate_GCE_DEFAULT_PK{ t.Error() }
Same with the KEK check.
Done
No description provided.