MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / build_qgs_get_quote_request

Function build_qgs_get_quote_request

tdx-attest/src/linux.rs:567–589  ·  view source on GitHub ↗

Build QGS get_quote request message Message format: - qgs_msg_header_t (16 bytes) - report_size (4 bytes) - id_list_size (4 bytes) - report data (1024 bytes)

(report: &[u8; TDX_REPORT_SIZE])

Source from the content-addressed store, hash-verified

565/// - id_list_size (4 bytes)
566/// - report data (1024 bytes)
567fn build_qgs_get_quote_request(report: &[u8; TDX_REPORT_SIZE]) -> Vec<u8> {
568 let report_size = TDX_REPORT_SIZE as u32;
569 let id_list_size: u32 = 0;
570
571 // Calculate total message size (header + fields + report)
572 let msg_size: u32 = 16 + 4 + 4 + report_size;
573
574 let mut msg = Vec::with_capacity(msg_size as usize);
575
576 // QGS message header (16 bytes)
577 msg.extend_from_slice(&QGS_MSG_VERSION_MAJOR.to_le_bytes()); // major_version
578 msg.extend_from_slice(&QGS_MSG_VERSION_MINOR.to_le_bytes()); // minor_version
579 msg.extend_from_slice(&QGS_MSG_GET_QUOTE_REQ.to_le_bytes()); // type
580 msg.extend_from_slice(&msg_size.to_le_bytes()); // size
581 msg.extend_from_slice(&0u32.to_le_bytes()); // error_code (unused in request)
582
583 // Request body
584 msg.extend_from_slice(&report_size.to_le_bytes()); // report_size
585 msg.extend_from_slice(&id_list_size.to_le_bytes()); // id_list_size
586 msg.extend_from_slice(report); // report data
587
588 msg
589}
590
591/// Parse QGS get_quote response and extract the quote
592///

Callers 1

get_quote_via_vsockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected