The password verification in RootKeys compared hashed passwords
byte-by-byte with an early return on mismatch. This leaks how many
leading bytes match through timing, weakening the protection that
bcrypt provides.
Replace the loop with subtle::ConstantTimeEq::ct_eq, which is
already used elsewhere in this crate (backups.rs, FPGA key check).
Signed-off-by: Finn Glas <finn@finnmglas.com>
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)
this bug highlights a fairly big weakness in the rkyv-based
serialization in that there is no inherent type checking of
the sender to the receiver. In this case, a typo of just one
character lead to a regression which, probably in an earlier
version of rkyv, was not a problem because the ordering of
elements was different. In this case it lead to incorrect behavior,
which upon debugging lead to panics because we were interpreting
the data incorrectly after it was unpacked.
This is probably an issue to be worried about in the longer-term,
and it leaves me with a lingering question of what attack
surface exists through the deserialization mechanism for
attackers who send malformed buffers as messages.
have to absorb a version change due to xous-semver change
might as well also update the utra/svd generator dependencies
since that's been held off for a long time now.
This relies on a trick I was not aware of previously, which is
that transitive dependencies absorb the additive set of features
enabled within a crate.
see
https://doc.rust-lang.org/cargo/reference/features.html#feature-unification
for the full description. but basically by referring to the feature
required in "aes" despite not being used in the crate but pulled
in by aes-gcm-siv, i can ensure that the transitive dependency
is in fact used.
I think this was always there but previously I just didn't understand
it correctly or didn't use it right when I tried to deploy it, but
this time I think I got it right.