Skip to content

Commit

Permalink
Added individual types
Browse files Browse the repository at this point in the history
Signed-off-by: Yogesh Deshpande <[email protected]>
  • Loading branch information
yogeshbdeshpande committed Jan 24, 2025
1 parent 2e5ff74 commit e9a7bf5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
4 changes: 2 additions & 2 deletions comid/tdx-profile/example_seam_refval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func setTDXSeamMvalExtensions(val *comid.Mval) error {

svn := teeSVN(10)
teeTcbEvNum := teeTcbEvalNum(11)
teeAttr := teeAttributes([]byte{0x01, 0x01})
teeAttr := TeeAttributes([]byte{0x01, 0x01})

err := val.Extensions.Set("tcbdate", &tcbDate)
if err != nil {
Expand Down Expand Up @@ -307,7 +307,7 @@ func decodeMValExtensions(m comid.Measurement) error {
return fmt.Errorf("failed to decode attributes from measurement extensions")
}

tA, ok := val.(*teeAttributes)
tA, ok := val.(*TeeAttributes)
if !ok {
fmt.Printf("val was not pointer to teeAttributes")
}
Expand Down
2 changes: 1 addition & 1 deletion comid/tdx-profile/mval_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type MValExtensions struct {
InstanceID *InstanceID `cbor:"-77,keyasint,omitempty" json:"instanceid,omitempty"`
PCEID *TeePCEID `cbor:"-80,keyasint,omitempty" json:"pceid,omitempty"`
MiscSelect *TeeMiscSelect `cbor:"-81,keyasint,omitempty" json:"miscselect,omitempty"`
Attributes *teeAttributes `cbor:"-82,keyasint,omitempty" json:"attributes,omitempty"`
Attributes *TeeAttributes `cbor:"-82,keyasint,omitempty" json:"attributes,omitempty"`
MrSigner *teeDigest `cbor:"-84,keyasint,omitempty" json:"mrsigner,omitempty"`
IsvProdID *IsvProdID `cbor:"-85,keyasint,omitempty" json:"isvprodid,omitempty"`
TcbEvalNum *teeTcbEvalNum `cbor:"-86,keyasint,omitempty" json:"tcbevalnum,omitempty"`
Expand Down
21 changes: 21 additions & 0 deletions comid/tdx-profile/teeattributes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tdx

import "fmt"

type TeeAttributes maskType

func NewTeeAttributes(val []byte) *TeeAttributes {
var teeAttributes TeeAttributes
if val == nil {
return nil
}
teeAttributes = TeeAttributes(val)
return &teeAttributes
}

func (o TeeAttributes) Valid() error {
if o == nil {
return fmt.Errorf("nil TeeAttributes")
}
return nil
}
13 changes: 13 additions & 0 deletions comid/tdx-profile/teemiscselect.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
package tdx

import "fmt"

type TeeMiscSelect maskType

func NewTeeMiscSelect(val []byte) *TeeMiscSelect {
var miscSelect TeeMiscSelect
if val == nil {
return nil
}
miscSelect = TeeMiscSelect(val)
return &miscSelect
}

func (o TeeMiscSelect) Valid() error {
if o == nil {
return fmt.Errorf("nil TeeMiscSelect")
}
return nil
}
2 changes: 0 additions & 2 deletions comid/tdx-profile/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ type teeTcbEvalNum uint

type teeTcbCompSvn [16]teeSVN

type teeAttributes maskType

type teeIsvProdID []byte

Check failure on line 25 in comid/tdx-profile/types.go

View workflow job for this annotation

GitHub Actions / Lint

type `teeIsvProdID` is unused (unused)

type teeInstanceID uint

Check failure on line 27 in comid/tdx-profile/types.go

View workflow job for this annotation

GitHub Actions / Lint

type `teeInstanceID` is unused (unused)
Expand Down

0 comments on commit e9a7bf5

Please sign in to comment.