INNER CODE UNIT · Rust
CONFIG_TLV_FIXED
TheMaxMur/RS-Key · crates/rsk-devconf/src/lib.rs:116
const CONFIG_TLV_FIXED: usize = 1 + (2 + 2) + (2 + 4) + (2 + 1) + (2 + 3) + CONFIG_LOCK_TLV_LEN;
/// The trailing `CONFIG_LOCK` entry `config_tlv` always appends after the echo.
const CONFIG_LOCK_TLV_LEN: usize = 2 + 1;
/// Build the READ CONFIG TLV: a leading overall-length byte, then
/// USB_SUPPORTED / SERIAL / FORM_FACTOR / VERSION, then either the persisted
/// `EF_DEV_CONF` blob or the default USB_ENABLED / DEVICE_FLAGS / CONFIG_LOCK
/// tail. Public because the OTP applet serves the same TLV (P1=0x13).
pub fn config_tlv<S: Storage>(serial: &[u8; 4], fs: &mut Fs<S>, res: &mut ResBuf) -> Sw {
let mut buf = [0u8; 128];
let mut n = 1; // byte 0 = overall length, filled at the end.
push_tlv(
&mut buf,
&mut n,
TAG_USB_SUPPORTED,
&SUPPORTED_CAPS.to_be_bytes(),