Skip to content

Commit

Permalink
manifest: add ProductName field
Browse files Browse the repository at this point in the history
  • Loading branch information
Freax13 committed Aug 19, 2024
1 parent 3568fe4 commit cb4e329
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions internal/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ func (r SNPReferenceValues) Validate() error {
return fmt.Errorf("field MicrocodeVersion in manifest cannot be empty")
}

switch r.ProductName {
case Milan, Genoa:
default:
return fmt.Errorf("unknown product name: %s", r.ProductName)
}

if len(r.TrustedMeasurement) != abi.MeasurementSize*2 {
return fmt.Errorf("trusted measurement has invalid length: %d (expected %d)", len(r.TrustedMeasurement), abi.MeasurementSize*2)
}
Expand Down
11 changes: 11 additions & 0 deletions internal/manifest/referencevalues.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type EmbeddedReferenceValues map[string]ReferenceValues
// SNPReferenceValues contains reference values for SEV-SNP.
type SNPReferenceValues struct {
MinimumTCB SNPTCB
ProductName ProductName
TrustedMeasurement HexString
}

Expand Down Expand Up @@ -78,6 +79,16 @@ func (s *SVN) UnmarshalJSON(data []byte) error {
return nil
}

// ProductName is the name mentioned in the VCEK/ASK/ARK.
type ProductName string

const (
// Milan is the product name for 3rd generation EPYC CPUs.
Milan ProductName = "Milan"
// Genoa is the product name for 4th generation EPYC CPUs.
Genoa ProductName = "Genoa"
)

// HexString is a hex encoded string.
type HexString string

Expand Down
11 changes: 9 additions & 2 deletions packages/by-name/contrast/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ let
microsoft.kata-igvm.launch-digest
)
);
productName = "Milan";
}
];
};
Expand All @@ -82,8 +83,14 @@ let
kata.snp-launch-digest;
in
[
{ trustedMeasurement = lib.removeSuffix "\n" (builtins.readFile "${launch-digest}/milan.hex"); }
{ trustedMeasurement = lib.removeSuffix "\n" (builtins.readFile "${launch-digest}/genoa.hex"); }
{
trustedMeasurement = lib.removeSuffix "\n" (builtins.readFile "${launch-digest}/milan.hex");
productName = "Milan";
}
{
trustedMeasurement = lib.removeSuffix "\n" (builtins.readFile "${launch-digest}/genoa.hex");
productName = "Genoa";
}
];
};

Expand Down

0 comments on commit cb4e329

Please sign in to comment.