Skip to content

Commit 941f4e2

Browse files
authored
Merge pull request #220 from Phala-Network/backport/tdattributes-v15-v0.5.x
fix(quote): backport PERFMON reserved-bit fix to v0.5.x
2 parents 31a32a4 + 7a44914 commit 941f4e2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/quote.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,11 @@ impl TDAttributes {
204204
let kl = (input[3] & 0x80) != 0; // Bit 31
205205

206206
// Extract OTHER flags (bytes 4-7)
207-
let reserved_other = ((input[7] as u32) << 24)
207+
// Mask bit 7 of input[7] (= PERFMON, bit 63) out of reserved_other.
208+
let reserved_other = (((input[7] as u32) & 0x7F) << 24)
208209
| ((input[6] as u32) << 16)
209210
| ((input[5] as u32) << 8)
210-
| ((input[4] as u32) & 0x7F);
211+
| (input[4] as u32);
211212
let perfmon = (input[7] & 0x80) != 0; // Bit 63
212213

213214
Ok(TDAttributes {

0 commit comments

Comments
 (0)