Get a TDX quote for the given report data. Tries multiple methods in order: 1. ConfigFS (Linux 6.7+) 2. VSock to QGS service
(report_data: &TdxReportData)
| 164 | /// 1. ConfigFS (Linux 6.7+) |
| 165 | /// 2. VSock to QGS service |
| 166 | pub fn get_quote(report_data: &TdxReportData) -> Result<Vec<u8>> { |
| 167 | let _guard = TDX_LOCK.lock().map_err(|_| TdxAttestError::Busy)?; |
| 168 | |
| 169 | if is_configfs_available() { |
| 170 | return get_quote_via_configfs(report_data); |
| 171 | } |
| 172 | |
| 173 | if is_vsock_available() { |
| 174 | return get_quote_via_vsock(report_data); |
| 175 | } |
| 176 | |
| 177 | Err(TdxAttestError::NotSupported( |
| 178 | "no quote method available (configfs not mounted, no vsock port configured)".to_string(), |
| 179 | )) |
| 180 | } |
| 181 | |
| 182 | fn is_configfs_available() -> bool { |
| 183 | Path::new(CONFIGFS_DEFAULT).is_dir() || Path::new(CONFIGFS_BASE).is_dir() |