- 
                Notifications
    You must be signed in to change notification settings 
- Fork 83
Replace eventlog logic to go-eventlog #591
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
base: main
Are you sure you want to change the base?
Conversation
| /gcbrun | 
Remove tcg eventlog logic in server/eventlog, use go-eventlog instead. Update go-tdx-guest package Add VerifyOpts.AllowEmptySBVar, which is an opt in go-eventlog Add FirmwareLogState -> MachineState conversion func and tests Signed-off-by: Jiankun Lu <[email protected]>
44ee116    to
    efa498f      
    Compare
  
    | /gcbrun | 
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.
Can you create an issue to remove the conversion logic? We can either migrate to the go eventlog proto directly. For example MachineState go-eventlog's PlatformState. Or, we can embed the go-eventlog FirmwareLogState into MachineState
| Digest: event.Digest, | ||
| DigestVerified: bytes.Equal(digest, event.Digest), | ||
| } | ||
| func convertToPbDatabase(cert *gepb.Database) *pb.Database { | 
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.
cert should be named db or gedb
| if bytes.HasPrefix(grubCmd, prefix) { | ||
| return len(prefix) | ||
| func matchWellKnownCert(cert *gepb.Certificate) (pb.WellKnownCertificate, error) { | ||
| if cert.GetWellKnown() != gepb.WellKnownCertificate_UNKNOWN { | 
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: invert this if statement and return early to avoid nesting two conditionals
| return convertToMachineState(tpmfirmwarestate) | ||
| } | ||
|  | ||
| func convertToMachineState(tpmfirmwarestate *gepb.FirmwareLogState) (*pb.MachineState, 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.
consider exporting this, as it is already implemented in google3
@yawangwang FYI
| case gepb.GCEConfidentialTechnology_AMD_SEV_SNP: | ||
| return pb.GCEConfidentialTechnology_AMD_SEV_SNP | ||
| default: | ||
| return pb.GCEConfidentialTechnology_NONE | 
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.
return an error by default
| } | ||
| } | ||
|  | ||
| var efiState *pb.EfiState | 
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 support for https://github.com/google/go-eventlog/blob/main/proto/state.proto#L176-L181 here or create an issue
| }, | ||
| } | ||
|  | ||
| func TestParseEventLogs(t *testing.T) { | 
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.
I know these are copied over to go-eventlog, but it would be good to keep these tests to ensure the output is still the same despite the conversion
Remove tcg eventlog logic in server/eventlog, use go-eventlog instead.
Update go-tdx-guest package
Add VerifyOpts.AllowEmptySBVar, which is an opt in go-eventlog Add FirmwareLogState -> MachineState conversion func and tests