MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / is_selftest

Function is_selftest

tpm/src/emulator.rs:36–45  ·  view source on GitHub ↗

Check if the input command is selftest

(input: &[u8])

Source from the content-addressed store, hash-verified

34///Check if the input command is selftest
35///
36pub fn is_selftest(input: &[u8]) -> bool {
37 if input.len() >= TPM_REQ_HDR_SIZE {
38 let ordinal: &[u8; 4] = input[6..6 + 4]
39 .try_into()
40 .expect("slice with incorrect length");
41
42 return u32::from_ne_bytes(*ordinal).to_be() == 0x143;
43 }
44 false
45}
46
47#[derive(Error, Debug)]
48pub enum Error {

Callers 1

deliver_requestMethod · 0.85

Calls 2

try_intoMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected