pub fn read_frame<R: Read>(
reader: &mut R,
buf: &mut Vec<u8>,
) -> Result<(), TpmDeviceError>Expand description
Reads one complete TPM frame from a blocking stream into buf.
The header is read first to learn the frame’s declared size, then exactly
that many bytes (header included) are read; buf is cleared beforehand. The
framing is identical for command and response frames, so this serves a host
reading responses and a responder reading commands alike.
§Errors
Returns UnexpectedEof when the
stream ends before a complete frame, Io on any
other read failure, or
InvalidResponse when the header
declares an out-of-range size.