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

Function extend_rtmr_via_sysfs

tdx-attest/src/linux.rs:243–258  ·  view source on GitHub ↗
(index: u32, digest: &[u8; 48])

Source from the content-addressed store, hash-verified

241}
242
243fn extend_rtmr_via_sysfs(index: u32, digest: &[u8; 48]) -> Result<()> {
244 let path = format!("{}/rtmr{}:sha384", RTMR_SYSFS_BASE, index);
245
246 let mut file = OpenOptions::new()
247 .write(true)
248 .open(&path)
249 .map_err(|e| TdxAttestError::ExtendFailure(format!("open {path}: {e}")))?;
250
251 file.write_all(digest).map_err(|e| match e.raw_os_error() {
252 Some(libc::EINVAL) => TdxAttestError::InvalidRtmrIndex(index),
253 Some(libc::EPERM) | Some(libc::EACCES) => {
254 TdxAttestError::ExtendFailure(format!("permission denied for RTMR {index}"))
255 }
256 _ => TdxAttestError::ExtendFailure(format!("write {path}: {e}")),
257 })
258}
259
260fn extend_rtmr_via_ioctl(index: u32, digest: [u8; 48]) -> Result<()> {
261 let file = OpenOptions::new()

Callers 1

extend_rtmrFunction · 0.85

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected