When random.bytes() runs but doesn't work
4 hours ago
- The Coldcard firmware bug was caused by a commit with a poor message-to-code-change ratio, introducing a weak random number generator.
- The commit disabled the hardware RNG (`MICROPY_HW_ENABLE_RNG (0)`) and attempted to override functions, but the overrides didn't affect the actual call path used for wallet generation.
- The developer silenced a compiler error by disabling the hardware RNG, leading to insecure entropy from the Yasmarang generator instead of the hardware RNG.
- The bug highlights the dangers of shipping code without understanding it, especially in critical security-sensitive Bitcoin applications.
- Complexity from multiple layers (Micropython, C bindings, custom code) contributed to the failure, as developers may not fully grasp the underlying system.