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

client.GetQuoteProvider: return error if none supported #132

Merged
merged 1 commit into from
Aug 16, 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
26 changes: 18 additions & 8 deletions client/client_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,28 @@ func (*LinuxConfigFsQuoteProvider) Product() *spb.SevProduct {

// GetQuoteProvider returns a supported SEV-SNP QuoteProvider.
func GetQuoteProvider() (QuoteProvider, error) {
preferred := &LinuxConfigFsQuoteProvider{}
if !preferred.IsSupported() {
return &LinuxIoctlQuoteProvider{}, nil
var provider QuoteProvider
provider = &LinuxConfigFsQuoteProvider{}
if provider.IsSupported() {
return provider, nil
}
return preferred, nil
provider = &LinuxIoctlQuoteProvider{}
if provider.IsSupported() {
return provider, nil
}
return nil, fmt.Errorf("no supported SEV-SNP QuoteProvider found")
}

// GetLeveledQuoteProvider returns a supported SEV-SNP LeveledQuoteProvider.
func GetLeveledQuoteProvider() (LeveledQuoteProvider, error) {
preferred := &LinuxConfigFsQuoteProvider{}
if !preferred.IsSupported() {
return &LinuxIoctlQuoteProvider{}, nil
var provider LeveledQuoteProvider
provider = &LinuxConfigFsQuoteProvider{}
if provider.IsSupported() {
return provider, nil
}
provider = &LinuxIoctlQuoteProvider{}
if provider.IsSupported() {
return provider, nil
}
return preferred, nil
return nil, fmt.Errorf("no supported SEV-SNP LeveledQuoteProvider found")
}
Loading