Skip to content

Commit a842b81

Browse files
committed
feat: Remove storage and TDX-releated PCSs from SGX manifests
1 parent 7c6a48f commit a842b81

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

build/rofl/manifest.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (m *Manifest) Validate() error {
167167
return fmt.Errorf("unsupported app kind: %s", m.Kind)
168168
}
169169

170-
if err := m.Resources.Validate(); err != nil {
170+
if err := m.Resources.Validate(m.TEE); err != nil {
171171
return fmt.Errorf("bad resources config: %w", err)
172172
}
173173

@@ -443,13 +443,18 @@ type ResourcesConfig struct {
443443
}
444444

445445
// Validate validates the resources configuration for correctness.
446-
func (r *ResourcesConfig) Validate() error {
446+
func (r *ResourcesConfig) Validate(tee string) error {
447447
if r.Memory < 16 {
448448
return fmt.Errorf("memory size must be at least 16M")
449449
}
450450
if r.CPUCount < 1 {
451451
return fmt.Errorf("vCPU count must be at least 1")
452452
}
453+
454+
if tee == TEETypeSGX && r.Storage != nil {
455+
return fmt.Errorf("SGX apps do not support disk storage")
456+
}
457+
453458
if r.Storage != nil {
454459
err := r.Storage.Validate()
455460
if err != nil {

cmd/rofl/mgmt.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ var (
110110

111111
switch manifest.TEE {
112112
case buildRofl.TEETypeTDX:
113+
// TDX requires storage settings.
114+
if !reset {
115+
manifest.Resources.Storage = &buildRofl.StorageConfig{
116+
Kind: buildRofl.StorageKindDiskPersistent,
117+
Size: 512,
118+
}
119+
}
120+
113121
switch appKind {
114122
case buildRofl.AppKindRaw:
115123
artifacts := buildRofl.LatestBasicArtifacts // Copy.
@@ -235,6 +243,12 @@ var (
235243
debugMode = params.DebugAllowTestRuntimes
236244
}
237245

246+
// For TDX assign empty quote policies by default.
247+
var tdxQuotePolicy *pcs.TdxQuotePolicy
248+
if manifest.TEE == buildRofl.TEETypeTDX {
249+
tdxQuotePolicy = &pcs.TdxQuotePolicy{}
250+
}
251+
238252
// Generate manifest and a default policy which does not accept any enclaves.
239253
deployment = &buildRofl.Deployment{
240254
Network: npa.NetworkName,
@@ -246,7 +260,7 @@ var (
246260
PCS: &pcs.QuotePolicy{
247261
TCBValidityPeriod: 30,
248262
MinTCBEvaluationDataNumber: 18,
249-
TDX: &pcs.TdxQuotePolicy{},
263+
TDX: tdxQuotePolicy,
250264
},
251265
},
252266
Endorsements: []rofl.AllowedEndorsement{

0 commit comments

Comments
 (0)