Skip to content

Commit

Permalink
Correcting QE Tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yogesh Deshpande <[email protected]>
  • Loading branch information
yogeshbdeshpande committed Jan 26, 2025
1 parent ce686b5 commit e8d4885
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions comid/tdx-profile/example_qe_refval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ func Example_encode_tdx_QE_refval_without_profile() {
}

// Output:
// a301a1005043bbe37f2e614b33aed353cff1428b200281a30065494e54454c01d8207168747470733a2f2f696e74656c2e636f6d028301000204a1008182a100a300d86f4c6086480186f84d01020304050171496e74656c20436f72706f726174696f6e02703031323334353637383941424344454681a101a438480a385046c000fbff000038538282015820e45b72f5c0c0b572db4d8d3ab7e97f368ff74e62347a824decb67a84e5224d7582075830e45b72f5c0c0b572db4d8d3ab7e97f368ff74e62347a824decb67a84e5224d75e45b72f5c0c0b572db4d8d3ab7e97f3638550b
// {"tag-identity":{"id":"43bbe37f-2e61-4b33-aed3-53cff1428b20"},"entities":[{"name":"INTEL","regid":"https://intel.com","roles":["creator","tagCreator","maintainer"]}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"oid","value":"2.16.840.1.113741.1.2.3.4.5"},"vendor":"Intel Corporation","model":"0123456789ABCDEF"}},"measurements":[{"value":{"isvsvn":10,"miscselect":"wAD7/wAA","mrsigner":["sha-256;5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXU=","sha-384;5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXXkW3L1wMC1cttNjTq36X82"],"tcbevalnum":11}}]}]}}
// a301a1005043bbe37f2e614b33aed353cff1428b200281a30065494e54454c01d8207168747470733a2f2f696e74656c2e636f6d028301000204a1008182a100a300d86f4c6086480186f84d01020304050171496e74656c20436f72706f726174696f6e02703031323334353637383941424344454681a101a538480a385046c000fbff000038538282015820e45b72f5c0c0b572db4d8d3ab7e97f368ff74e62347a824decb67a84e5224d7582075830e45b72f5c0c0b572db4d8d3ab7e97f368ff74e62347a824decb67a84e5224d75e45b72f5c0c0b572db4d8d3ab7e97f3638540138550b
// {"tag-identity":{"id":"43bbe37f-2e61-4b33-aed3-53cff1428b20"},"entities":[{"name":"INTEL","regid":"https://intel.com","roles":["creator","tagCreator","maintainer"]}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"oid","value":"2.16.840.1.113741.1.2.3.4.5"},"vendor":"Intel Corporation","model":"0123456789ABCDEF"}},"measurements":[{"value":{"isvsvn":10,"miscselect":"wAD7/wAA","mrsigner":["sha-256;5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXU=","sha-384;5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXXkW3L1wMC1cttNjTq36X82"],"isvprodid":{"type":"uint","value":1},"tcbevalnum":11}}]}]}}
}

func setTDXQEMvalExtensions(val *comid.Mval) error {
Expand Down
5 changes: 5 additions & 0 deletions comid/tdx-profile/teeisvproid.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ func NewISVProdID(val interface{}) *TeeIsvProdID {
return &TeeIsvProdID{val: t}
case []byte:
return &TeeIsvProdID{val: t}
case int:
if t < 0 {
return nil
}
return &TeeIsvProdID{val: t}
default:
return nil
}
Expand Down
11 changes: 8 additions & 3 deletions comid/tdx-profile/test_vars.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package tdx

var (
TestRegID = "https://intel.com"
TestOID = "2.16.840.1.113741.1.2.3.4.5"

TestRegID = "https://intel.com"
TestOID = "2.16.840.1.113741.1.2.3.4.5"
TestUIntInstance = 45
TestByteInstance = []byte{0x45, 0x46, 0x47}
TestInvalidProdID = -23
TestUIntISVProdID = 23
TestBytesInstance = []byte{0x01, 0x02, 0x03}
TestInvalidInstance = -1
TDXPCERefValTemplate = `{
"lang": "en-GB",
"tag-identity": {
Expand Down

0 comments on commit e8d4885

Please sign in to comment.