Check if the input command is selftest
(input: &[u8])
| 34 | ///Check if the input command is selftest |
| 35 | /// |
| 36 | pub 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)] |
| 48 | pub enum Error { |
no test coverage detected