Renode v1.16 changed the LimitTimer constructor signature from
`long frequency` to `ulong frequency`. Without this cast, the
LiteX_Timer_32 peripheral fails to compile against current Renode
versions, causing emulation to exit immediately with a peripheral
build failure rather than booting Xous.
Tested with Renode v1.16.1.4499 (build 9d55b4e6-202604170227)
against the standard emulation/xous-release.resc startup. With
the cast, Xous boots through to the main loop. Without it,
Renode exits before any boot output appears.
an instance of the SPI interface timing out was observed on boot.
It's rare, but it happens.
This wraps those early calls with a retry loop and then
fail to reboot in case something really goes wrong.
Assisted-by: qwen3.6:27b (local)
The BIP-39 backup-key confirmation flow compared the entered
key against the in-memory FPGA key with `==`, which
short-circuits on the first mismatching byte and leaks
prefix-length information through timing.
Switch to `subtle::ConstantTimeEq`. The `subtle` crate is
already a direct dependency and used in the same crate's
`backups.rs` for the same purpose.
Signed-off-by: tunnell <tunnell@users.noreply.github.com>
Assisted-by: Claude Code (Opus 4.7)
turns out you don't just flip everything all the time! when
you flip the board upside down, the camera also flips. so then
you end up with a flipped image which is super-confusing.
however, the overlay text needs to flip. so this adds the
cases to handle that.
`process_inner.mem_heap_size + delta` can wrap on RV32 if a
client requests a `delta` close to `usize::MAX`. A wrapped
value can land below `mem_heap_max` and pass the cap check,
letting the call proceed with a bogus heap size.
Use `checked_add` and return `Error::OutOfMemory` on overflow.
Adds a hosted-mode behavioral test that sends `usize::MAX` as
`delta` and asserts the syscall rejects it. The test doesn't
cleanly distinguish patched from unpatched code on 64-bit hosted
(both paths reject absurd deltas, just at different layers), but
it locks in the expected behavior as regression coverage.
Signed-off-by: tunnell <tunnell@users.noreply.github.com>
Assisted-by: Claude Code (Opus 4.7)
GAM auth tokens are 128-bit capabilities bound to their owning
process. The previous `==` compare on `[u32; 4]` short-circuits
on the first mismatching element, leaking prefix-length information
through timing.
Switch to `subtle::ConstantTimeEq`, which is already present in
the dep graph via ed25519-dalek and used elsewhere in the crypto
stack.
Signed-off-by: tunnell <tunnell@users.noreply.github.com>
Assisted-by: Claude Code (Opus 4.7)
this prevents warm boot hold-up in case of latent key press
during wakeup option: for warm boot it's assumed that when
the user presses a key the intention is to wake up and go
to normal operation, not wake up and wait for an update.
a bit convoluted:
- RTC wakeup goes through the "always on" subsystem
- keyboard routes through "always on" because the system can wake
on keyboard press
- thus the keyboard mechanism is abused/re-used to pass wakeup
events throughout the system.
Other notes - a wakeup alarm sent within 2 seconds of the current
time will trigger an assert. It's not recommended to use the RTC
for very near-term wakeups because if you e.g. hit swap or have
something else going on that's very "busy" (like QR code scanning)
the system might not get to waking things up in time.
Some code can be written to handle this and set up a degenerate
wakeup, maybe, but for now, I am leaving it as an assert because
I want to remind myself that there is an edge case here.