Skip to content

Commit c4736de

Browse files
committed
update workload id calculation
1 parent 3570e29 commit c4736de

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

server/workload_id.go

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ const (
1313
// Raw quote has a 48-byte header before the TD10ReportBody
1414
HEADER_LENGTH = 48
1515
TD_REPORT10_LENGTH = 584
16-
17-
// TDX workload constants
18-
TD_XFAM_FPU = 0x0000000000000001
19-
TD_XFAM_SSE = 0x0000000000000002
20-
TD_TDATTRS_VE_DISABLED = 0x0000000010000000
21-
TD_TDATTRS_PKS = 0x0000000040000000
22-
TD_TDATTRS_KL = 0x0000000080000000
2316
)
2417

2518
// ComputeWorkloadID computes the workload ID from Automata's serialized verifier output
@@ -51,24 +44,10 @@ func ComputeWorkloadID(rawQuote []byte) ([32]byte, error) {
5144
xfam := binary.BigEndian.Uint64(reportBody[128 : 128+8])
5245
tdAttributes := binary.BigEndian.Uint64(reportBody[120 : 120+8])
5346

54-
// Apply transformations as per the Solidity implementation
55-
// expectedXfamBits = TD_XFAM_FPU | TD_XFAM_SSE
56-
expectedXfamBits := uint64(TD_XFAM_FPU | TD_XFAM_SSE)
57-
58-
// ignoredTdAttributesBitmask = TD_TDATTRS_VE_DISABLED | TD_TDATTRS_PKS | TD_TDATTRS_KL
59-
ignoredTdAttributesBitmask := uint64(TD_TDATTRS_VE_DISABLED | TD_TDATTRS_PKS | TD_TDATTRS_KL)
60-
61-
// Transform xFAM: xFAM ^ expectedXfamBits
62-
transformedXfam := xfam ^ expectedXfamBits
63-
64-
// Transform tdAttributes: tdAttributes & ~ignoredTdAttributesBitmask
65-
transformedTdAttributes := tdAttributes & ^ignoredTdAttributesBitmask
66-
67-
// Convert transformed values back to bytes (big-endian, to match Solidity bytes8)
6847
xfamBytes := make([]byte, 8)
6948
tdAttributesBytes := make([]byte, 8)
70-
binary.BigEndian.PutUint64(xfamBytes, transformedXfam)
71-
binary.BigEndian.PutUint64(tdAttributesBytes, transformedTdAttributes)
49+
binary.BigEndian.PutUint64(xfamBytes, xfam)
50+
binary.BigEndian.PutUint64(tdAttributesBytes, tdAttributes)
7251

7352
// Concatenate all fields
7453
var concatenated []byte

0 commit comments

Comments
 (0)