Skip to main content

checkmac_other_data

Function checkmac_other_data 

Source
pub(crate) fn checkmac_other_data(key_id: u8, chip_serial: &[u8; 9]) -> [u8; 13]
Expand description

Build the other_data block for a CheckMac call against key_id on this project’s slots, with zero OTP coupling.

other_data is 13 bytes long. Bytes 0..4 carry the opcode, mode, and key_id that the chip substitutes into the hash at message offsets 84..88. Bytes 4..7 are reserved for OTP coupling, which we never use (kept at zero). Bytes 7..13 are six free-form bytes that the chip hashes verbatim at message offsets 80..84 and 88..96. Their actual values are not constrained by the protocol: any sequence works as long as both the host (in checkmac_response) and the chip-side computation receive the same bytes. We seed them from chip_serial to bind a successful CheckMac to a specific chip, defeating a replay of a pre-computed response against a different physical chip with the same slot value.