AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 59 Bitcoin

feat(se): Move 2 W1 — SE generation detection, gen-isolated backend, gen-1 page-8 gate

Public commit record

What the developer wrote

Authored by aaron

100/100 · Strong
feat(se): Move 2 W1 — SE generation detection, gen-isolated backend, gen-1 page-8 gate

- SeGen_t + GetSeGen(): classify the SE generation from the IMMUTABLE locked config manifest only (countMatch/chipOptions/slotConfig[8,13]/keyConfig[4,7,8,11,13]); fail-closed on UNPROVISIONED/INVALID. match_count is NOT used for classification (mutable; a transient slot-8 read must not flip a healthy device to INVALID).

- SeAccountBackend vtable + SeBackend() dispatcher: gen-1 wrappers map to the existing legacy derivation (derive_608/provision_608/on_unlock_success no-op); gen-2 stubs (filled in W2-W9); SeBackend() returns NULL for UNPROVISIONED/INVALID (fail closed).

- Gate the legacy page-8 wipe to SE_GEN_1 at the caller (AccountManagerInit) so it can never erase a gen-2 R_wrapped.

Scaffolding only: vtables in se_manager.c for now (physical split to src/managers/se/ during the gen-1 extraction); no callers wired -> zero runtime change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

add the function seCounter, matchCounter, rearm etc for se gen2

tmp

refactor the gen2 functions and add some functions in the driver

add the function for the gen2 R and K608 related usage

Gen2Provision608

change Gen2Provision608 and clear the secret K608

refactor the 608b logic and set add gen1 and gen2 backend logic

fix the building issues

fix the paras issues

update the solt/key config

show the se gen version in the device info

get the exsiting pwd to get R when adding the 2/3 wallet

check the device bricked in init on gen2

destroy the account and wipe device setting

add the se account status checking logic and change pwd logic

unset the pwd after change pwd and for gen2 use new way to get the existing account number

disable lock on add wallet and change password/pin

adjust current wallet limit and clear the r passs value as required

add the feature for forget password

fix the wrong pin limit issue and remove the logs

feat: add the weak pin modal

fix simulator and disable boot checking for dev build

fix: the weak-passcode modal free issue

clear the pw for R when lock the device

add data checking function when provision608 before R generation

init the view with g_proveOwnershipDone to false

roll kdf_i in the data check failed

set the state after all passed zero

fix the possible save account issues

prevent the pin dup try when reached back to lock view

add log for desstory account

fix the initail value issue on KeyboardWidget

fix: remove bump on the counter to enlarge the lifetime

refactor the code to move gen decision into the se backend

default to gen2 config in the blank chip

check the operation result to avoid mutation issue

fix the simulator

reorder the wipe function steps

add 10 limit on the password check try

drop the current working flow(add-wallet, change-pin etc) to home view if the password try reached limit and fix the memory leak issue

fix the R Recovery issue for nav back and forth on adding wallet view

fix the issue of drop forget pw flow

protect test R_wrapped value to prevent zero value caculation

remove the ForceLockScreen and fix create-wallet missing R issue

R protect: when forget pass, retype the same wallet pw and seed return not pass

clean the comment and salt value
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This is a large firmware commit for the Keystone 3 hardware wallet that restructures how the secure element (SE) chip is used. It introduces a generation-aware backend so the firmware can support two different SE configurations (gen-1, the current fielded design, and gen-2, a new production design) in one binary. The patch moves legacy gen-1 key derivation into its own file, adds a gen-2 backend with a different key-derivation scheme, adds lifecycle status pages so interrupted wallet create/change-PIN/delete operations can be safely resumed or erased at boot, and adds UI flows for weak-passcode warnings and a 'forget password' ownership-proof step. It also gates the legacy page-8 wipe to gen-1 only so it cannot accidentally erase gen-2 data. The commit is described by its authors as scaffolding with no runtime change for current gen-1 devices, but it does add substantial new crypto and state-machine code.

Recommended action

Treat this as a high-touch crypto refactor rather than a routine feature. Reviewers should verify: (1) the gen-2 manifest constants in ResolveSeGen exactly match Atecc608bWriteConfigGen2 and the factory gate, (2) no code path calls Atecc608bKdfNoAuth/DeriveKeyNoAuth on gen-1 slots, (3) SeBackend() NULL returns are handled fail-closed everywhere, (4) the K608 global is cleared on every error path between derive_608 and on_unlock_success, (5) SE_ArmProvisionRecovery does not retain a password past lock/logout/wipe boundaries, (6) the BUILD_PRODUCTION boot-update bypass is not present in release builds, and (7) the weak-passcode duplicate-check counter cannot be reset by an attacker to bypass the 10-attempt limit. Because the commit bundles many changes, it should be split or at least reviewed commit-by-commit in the PR history.

Security signals we found

01

Generation-aware SE backend with fail-closed NULL backend for UNPROVISIONED/INVALID chips

02

Legacy page-8 PIN-hash wipe gated to gen-1 only to avoid erasing gen-2 R_wrapped

03

Per-account lifecycle status pages for atomic crash recovery of create/change-PIN/delete

04

Gen-2 no-auth KDF/DeriveKey helpers added for slots configured without ReqAuth

05

Match-count attempt-limit and re-arm logic tied to SE monotonic counter

06

Weak passcode/password modal and 10-attempt duplicate-check flow added

07

Forget-password prove-ownership requires a different wallet's password on gen-2

08

Provision recovery arm/disarm lifecycle to avoid persisting another wallet's password

09

ClearSecretCache now also clears SE-side transient session secrets (gen-2 K608)

010

Boot brick check asserts counter < match_count for gen-2

011

Debug-only boot-update bypass added under BUILD_PRODUCTION guard

Risk score

Why this scored 59/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.