-
Notifications
You must be signed in to change notification settings - Fork 279
Plumb hash_envelope_reference_info.cose #2622
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -95,6 +95,10 @@ func GetDefaultReferenceInfoFilePath() string { | |||||
| return filepath.Join(defaultConfidentialWCOWOSBootFilesPath(), "reference_info.cose") | ||||||
| } | ||||||
|
|
||||||
| func GetDefaultHashEnvelopeReferenceInfoFilePath() string { | ||||||
| return filepath.Join(defaultConfidentialWCOWOSBootFilesPath(), "hash_envelope_reference_info.cose") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| // NewDefaultOptionsWCOW creates the default options for a bootable version of | ||||||
| // WCOW. The caller `MUST` set the `BootFiles` on the returned value. | ||||||
| // | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,28 @@ func WithUVMReferenceInfo(referenceRoot string, referenceName string) Confidenti | |
| } | ||
| } | ||
|
|
||
| // WithUVMHashEnvelopeReferenceInfo reads UVM hash envelope reference info file | ||
| // and base64 encodes the content before setting it for the resource. This is | ||
| // no-op if the `referenceName` is empty or the file doesn't exist. | ||
| func WithUVMHashEnvelopeReferenceInfo(referenceRoot string, referenceName string) ConfidentialUVMOpt { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we refactor this? This and |
||
| return func(ctx context.Context, r *guestresource.ConfidentialOptions) error { | ||
| if referenceName == "" { | ||
| return nil | ||
| } | ||
| fullFilePath := filepath.Join(referenceRoot, referenceName) | ||
| encoded, err := base64EncodeFileContents(fullFilePath) | ||
| if err != nil { | ||
| if os.IsNotExist(err) { | ||
| log.G(ctx).WithField("filePath", fullFilePath).Debug("UVM hash envelope reference info file not found") | ||
| return nil | ||
| } | ||
| return fmt.Errorf("failed to read UVM hash envelope reference info file: %w", err) | ||
| } | ||
| r.EncodedUVMHashEnvelopeReference = encoded | ||
| return nil | ||
| } | ||
| } | ||
|
|
||
| // SetConfidentialUVMOptions sends information required to run the UVM on | ||
| // SNP hardware, e.g., security policy and enforcer type, signed UVM reference | ||
| // information, etc. | ||
|
|
||
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.
Heads-up that last time I was testing, the pipeline was producing
snp_reference_info.coseinstead ofreference_info.cosewhich the code expects (line#95 above). One of them has to change. Same forhash_envelope_reference_info.cose- we need to make sure the name matches what the pipeline is producing (or vice-versa)