| 377 | } |
| 378 | |
| 379 | pub fn cancel_cmd(&mut self) -> Result<()> { |
| 380 | let mut res: PtmResult = 0; |
| 381 | |
| 382 | // Check if emulator implements Cancel Cmd |
| 383 | if (self.caps & PTM_CAP_CANCEL_TPM_CMD) != PTM_CAP_CANCEL_TPM_CMD { |
| 384 | return Err(Error::CheckCaps(anyhow!( |
| 385 | "Emulator does not implement 'Cancel Command' Capability" |
| 386 | ))); |
| 387 | } |
| 388 | self.run_control_cmd( |
| 389 | Commands::CmdCancelTpmCmd, |
| 390 | &mut res, |
| 391 | 0, |
| 392 | mem::size_of::<u32>(), |
| 393 | )?; |
| 394 | Ok(()) |
| 395 | } |
| 396 | |
| 397 | /// Configure buffersize to use while communicating with swtpm |
| 398 | fn set_buffer_size(&mut self, wantedsize: usize) -> Result<usize> { |