fibercrypto / fibercrypto/skywallet-mcu
Firmware panic
- Dominant language
- C
- Stars
- 2
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
**Feature description**
Add ability to freeze firmware execution
**Is your feature request related to a problem? Please describe.**
If critical crypto conditions detected then device should be locked to prevent access to coins and preserve funds in wallet.
**Describe the solution you'd like**
Implement a function that relies on built-in device traps to halt device execution .
**Describe alternatives you've considered**
Setting a flag in order to exit main loop gracefully , might be hijacked (i.e. flag value reverted after failure detected but prior to loop conditional).
**Additional context**
Skycoin core panics if some (serious) crypto errors are detected at run time . This is to protect coins . Firmware does not support doing so .
**Possible implementation**
- [x] Add `void panic(char *)` in `error.h`
- [x] Trigger `EXTI0` ISR from software so as to abandon stack execution context right away and enter an infinite loop in the end
- [x] Send `Failure` message with `Failure_FirmwarePanic` reason
- [ ] Replace inline `TODO` comments related to `abort()` in `skycoin-api` with a call to `panic()`
- [x] Implement firmware panic for emulator by displaying error message and disabling all interaction
Contributor guide
Assessment
This issue has not been assessed yet.