Skip to content

Commit b7140f0

Browse files
committed
Fixup: Better organisation of code
1 parent f7662bc commit b7140f0

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

go/runtime/host/sgx/ecdsa.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/oasisprotocol/oasis-core/go/common/sgx/aesm"
88
"github.com/oasisprotocol/oasis-core/go/common/sgx/pcs"
9-
"github.com/oasisprotocol/oasis-core/go/common/sgx/quote"
109
consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
1110
"github.com/oasisprotocol/oasis-core/go/runtime/bundle/component"
1211
"github.com/oasisprotocol/oasis-core/go/runtime/host"
@@ -65,16 +64,15 @@ func (ec *teeStateECDSA) Update(ctx context.Context, sp *sgxProvisioner, conn pr
6564
return nil, fmt.Errorf("failed to get quote: %w", err)
6665
}
6766

68-
var quotePolicy *quote.Policy
67+
var pcsQuotePolicy *pcs.QuotePolicy
6968
if ec.cfg.Component.Kind == component.RONL {
70-
quotePolicy, err = sgxCommon.GetRONLQuotePolicy(ctx, ec.cfg.ID, ec.cfg.Component.Version, sp.consensus)
69+
quotePolicy, err := sgxCommon.GetRONLQuotePolicy(ctx, ec.cfg.ID, ec.cfg.Component.Version, sp.consensus)
7170
if err != nil {
7271
return nil, fmt.Errorf("failed to fetch RONL quote policy: %w", err)
7372
}
74-
}
75-
var pcsQuotePolicy *pcs.QuotePolicy
76-
if quotePolicy != nil {
77-
pcsQuotePolicy = quotePolicy.PCS
73+
if quotePolicy != nil {
74+
pcsQuotePolicy = quotePolicy.PCS
75+
}
7876
}
7977

8078
quoteBundle, err := sp.pcs.ResolveQuote(ctx, rawQuote, pcsQuotePolicy)

go/runtime/host/sgx/epid.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,15 @@ func (ep *teeStateEPID) update(
108108
return nil, fmt.Errorf("error while getting quote: %w", err)
109109
}
110110

111-
var quotePolicy *sgxQuote.Policy
111+
var minTCBEvaluationDataNumber uint32
112112
if ep.cfg.Component.Kind == component.RONL {
113-
quotePolicy, err = sgxCommon.GetRONLQuotePolicy(ctx, ep.cfg.ID, ep.cfg.Component.Version, sp.consensus)
113+
quotePolicy, err := sgxCommon.GetRONLQuotePolicy(ctx, ep.cfg.ID, ep.cfg.Component.Version, sp.consensus)
114114
if err != nil {
115115
return nil, fmt.Errorf("failed to fetch RONL quote policy: %w", err)
116116
}
117-
}
118-
var minTCBEvaluationDataNumber uint32
119-
if quotePolicy != nil && quotePolicy.IAS != nil {
120-
minTCBEvaluationDataNumber = quotePolicy.IAS.MinTCBEvaluationDataNumber
117+
if quotePolicy != nil && quotePolicy.IAS != nil {
118+
minTCBEvaluationDataNumber = quotePolicy.IAS.MinTCBEvaluationDataNumber
119+
}
121120
}
122121

123122
evidence := ias.Evidence{

go/runtime/host/tdx/qemu.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,7 @@ func (p *qemuProvisioner) updateCapabilityTEE(ctx context.Context, hp *sandbox.H
434434
rekPub := rspRep.RuntimeCapabilityTEERakReportResponse.RekPub
435435
rawQuote := rspRep.RuntimeCapabilityTEERakReportResponse.Report
436436

437-
// Prepare the quote policy for local verification. In case a policy is not available or it
438-
// indicates that TDX is not supported, use the fallback policy so we can provision something.
437+
// Use the fallback policy for ROFL components and RONL components with no TDX policy so that provisioning can proceed.
439438
fallbackPolicy := &sgxQuote.Policy{
440439
PCS: &pcs.QuotePolicy{
441440
TCBValidityPeriod: 30,

0 commit comments

Comments
 (0)