//! K2135 PID1: verifies an Off ticket is refused on the Reset path, commits a //! Reset ticket to arm SYSTEM_RESET, rejects reused boot log and stale boot //! identity observations, and verifies the fresh BOOT0 reboot observation. #![no_std] #![no_main] use turkos_os_feature_user::{call, exit}; const REQUEST: u64 = 16; const ARM_RESET: u64 = 17; const OBSERVE: u64 = 19; const REFUSED: u64 = 1 << 63; const SYSTEM_RESET: u64 = 0x8400_0009; #[unsafe(no_mangle)] #[unsafe(link_section = ".text._start")] pub extern "C" fn _start(_: u64, _: u64) -> ! { let off_ticket = call(REQUEST, 1, 0, 0); if off_ticket != 1 { exit(0x11) } if call(ARM_RESET, 0, 0, 0) & REFUSED == 0 { exit(0x12) } let reset_ticket = call(REQUEST, 2, 0, 0); if reset_ticket != 2 { exit(0x13) } if call(ARM_RESET, 0, 0, 0) != SYSTEM_RESET { exit(0x14) } if call(OBSERVE, 0, 0, 0) & REFUSED == 0 { exit(0x15) } if call(OBSERVE, 1, 0, 0) & REFUSED == 0 { exit(0x16) } if call(OBSERVE, 2, 0, 0) != 1 { exit(0x17) } exit(reset_ticket << 8 | 2) }