# A 2 s unlock budget on ESP32: where does the time go?

> One post from jmrp.io, published as its own document. Index: https://jmrp.io/llms-full.txt

Canonical: https://jmrp.io/blog/018-esp32-unlock-time-budget/
Language: en
Alternate: https://jmrp.io/es/blog/018-esp32-unlock-time-budget/index.md
License: https://creativecommons.org/licenses/by/4.0/
Type: TechArticle
Published: 2026-12-04
Instructions re-tested: 2026-12-04 · ESP-IDF 6.1.1 · PlatformIO espressif32 9.0.0 · Mbed TLS 4.1.1 · TF-PSA-Crypto 1.1.1 · LittleFS 1.23.4 (joltwallet/littlefs)
Author: José Manuel Requena Plens
Summary: An ESP32 password manager's unlock, timed phase by phase on each board: why the PIN screen, the list load and the flash now outweigh the key derivation.
Tags: Firmware, ESP32, Embedded, Performance, Security
Topics: Response time (Q578372), ESP32 (Q27921668), PBKDF2 (Q3952834), Flash memory (Q174077), Electronic paper (Q189897), Benchmark (Q816747)
Build-Date: 2026-12-05

Questions answered:

**What is the unlock time budget of the Kleidos firmware?**

Two figures. About 2 s is the budget the PBKDF2 work factor was sized to in July 2026, which is why the ESP32-S3 derives 175,000 iterations and the classic ESP32 40,000. 3 s is a cap set on 2026-11-14 for the whole unlock, from a correct PIN to the first frame of the credential list. The first sizes one phase; the second bounds all of them.

**Why does the PIN screen add a fixed 0.8 s to every dial unlock?**

On a dial board, 200 ms is the lock flash that confirms the last digit registered, and 600 ms is the verdict, a keyhole turn that takes the same time for a right and a wrong PIN. They run before and after the vault work, not during it. Drawing the turn itself costs a few milliseconds per frame; the 800 ms are pacing chosen for the person holding the device.

**Why does the M5Stack Core2 v1.3 pay the most to read its vault?**

It is the only board whose vault is not memory-mapped: its 112-page vault does not fit the classic ESP32's 64-page data window, so every LittleFS read is a flash read, and about nine tenths of LittleFS time goes to finding files rather than reading them. Running its flash at 80 MHz with the vault's read path in IRAM took about half a second off a full-vault console unlock (4.67 to 4.14 s, measured, 2026-11-29).

**Why does the CoreInk's unlock time vary so much between runs?**

Because the first frame of the list includes an e-paper refresh, and which refresh it gets varies with the run. On the full-vault run of 2026-11-14 it was the slow full refresh, about 2.1 s, in session and the fast one, about 0.2 to 0.3 s, after a reset; on a read bench the first frame took 2.1 s at two fills and 0.22 s at a third. Its unlock figures are what that board shows, not what the vault costs. On the batch of 4 December, with a full vault, it measured 4,908 ms in session and 3,086 ms after a reset.

**Does turning off LittleFS file modification times speed up unlocking?**

Not in the way expected. On a vault written with the timestamps, an image without them unlocked faster. But a vault written without them read slower with either image, so a board shipped without timestamps would settle about 0.46 s slower on the Core2 v1.3 and about 0.02 s slower on the T-Deck. The change was not merged.

**How do you time an unlock on an embedded device without a stopwatch?**

A host script drives the board's own input through a debug console: injected dial presses, touch coordinates or key presses. It times from the last digit (on the device's clock) or from OK or ENTER (on the host's clock) to the log line the firmware prints when the first frame of the list is on the glass, and checks that the production derivation engine ran.


---

The [third post](https://jmrp.io/blog/012-device-bound-key-derivation/) in this series sized the key derivation of **[a hardware password manager I'm building](https://kleidos.dev/) (not yet released)** to an unlock of about 2 seconds, and the [previous post](https://jmrp.io/blog/017-pbkdf2-esp32-s3-sha-engine/) made that derivation cheap on the ESP32-S3: 175,000 PBKDF2 iterations in about 0.83 s. A cheaper derivation does not make an unlock 2 s long, though. Between the last digit and the first line of the credential list there is a PIN screen that paces itself, a vault that has to be opened and read from flash, an attempt counter written before anything is derived, and, on one board, an e-paper panel that takes its own time to repaint.

This post times that whole path, phase by phase, on each board the firmware runs on. My thesis: **once the derivation got cheap, the unlock budget became a property of the rest of the pipeline, and the slowest boards are slow for reasons that have nothing to do with cryptography.** The classic ESP32 boards pay for a software SHA-256, the CoreInk for its e-paper, and the Core2 v1.3 for a vault it cannot map into memory.

As in the previous posts, I've kept the evidence labels from the bench. A figure is **measured** when it came off a board, and I give the board, the image and the date. It is **computed** when I derived it from measured figures, **estimated** when it is a projection, and **not measured** when nobody has run it. Every end-to-end figure here comes from a debug-console build that keeps the production work factor: a `_stress` image, or for the hardened StickS3 the bench's hardened image; the section on [how it is timed](#how-is-an-unlock-timed-on-the-board) says what that does and does not tell you about a release image.

## TL;DR: where a Kleidos unlock spends its time

- There are **two figures**: about **2 s**, the budget the PBKDF2 work factor was sized to in July 2026, and **3 s**, a cap set in November for the **whole** unlock, from a correct PIN to the first frame of the list.
- An unlock is a pipeline: a **200 ms** lock flash, opening the vault, an attempt counter written to NVS **before** deriving, the derivation on a worker task on core 0, the list loaded in units, a **600 ms** verdict and the first frame. About **0.8 s** of every dial unlock is fixed screen time that no cryptography touches, and it is there on purpose.
- On the 2026-12-04 batch, seven of the nine boards came in within the 3 s cap at 30 credentials and 10 2FA entries, in session and after a reset, and six with their full vault; only the Cardputer ADV is under 2 s, at 30 + 10 (1.81 s; 2.01 to 2.21 s with its full vault), and the Core2 v1.3 (3.77 s at 30 + 10) and the CoreInk (4.76 s at 30 + 10) are over 3 s with either vault.
- The two slowest boards are slow for different reasons: the **CoreInk** waits on an e-paper refresh whose length varies, the **Core2 v1.3** reads its vault straight from flash because it is the one board that cannot memory-map it. Running that board's flash at **80 MHz** with the read path in IRAM took a full-vault console unlock from 4.67 s to 4.14 s (measured), still over the cap.
- Turning off LittleFS's per-file modification times **did not** turn out as expected: an image without them reads any vault faster, but a vault written without them reads slower, so a board shipped without them would settle slower (Core2 v1.3 5,087 against 4,625 ms, T-Deck 1,707 against 1,689 ms). It was not merged.
- Nothing here is timed on a release image, with real fingers or on a hardened board with the current derivation.

**Note: Re-measured on 4 December 2026**

The per-board unlock times on this page are from a batch of 4 December 2026 on all nine boards, on the batch's firmware, built with ESP-IDF 6.1.1, which replaced ESP-IDF 6.0.3 on main the evening before, 3 December (Mbed TLS and TF-PSA-Crypto are the same in both; LittleFS went from 1.22.1 to 1.23.4). The key derivation measured the same on both. The figures dated 14 to 29 November are history, taken on ESP-IDF 6.0.3, and each says its date.

**Quick glossary (if the bench vocabulary isn't your background)**

- **Unlock**: here, from the moment the PIN is complete (the last digit locked, or OK or ENTER pressed) to the first frame of the credential list on the screen.
- **Real path · console path**: the real path drives the board's own input (dial, touch or keyboard); the console path sends the PIN over the serial console and skips the screen's waits. It follows the PIN screen's vault code since 2026-11-29; the console figures before that carry a second mount the PIN screen never made.
- **Device clock · host clock**: the device clock is the firmware's own timestamp in its log; the host clock is the PC's, and includes the cable trip and the injected press.
- **`_stress` image**: a debug-console build with the production PBKDF2 count; release images have no console to drive or time an unlock.
- **30 + 10 · full vault**: 30 credentials and 10 2FA entries; a full vault holds each board's capacity (500 + 50 on the CoreS3 SE, T-Deck and Core2 v1.3, 250 + 40 on the StickS3 and Cardputer ADV, 90 + 40 on the StickC Plus2 and 90 + 30 on the StickC Plus 1.1, Plus SE and CoreInk).
- **Memory map**: reading the vault partition through the flash cache's address window instead of one SPI flash read per access.
- **LittleFS**: the flash file system the vault's files live in.
- **Lean loop · software core**: the S3's register-level PBKDF2 on the SHA engine, and the classic ESP32's own SHA-256 in IRAM ([post 017](https://jmrp.io/blog/017-pbkdf2-esp32-s3-sha-engine/) has both).

---

## Which 2 s is the budget, and which 3 s is the cap?

The repository uses two different numbers, and this post keeps them apart because they bound different things.

**The two figures**

| Figure | What it bounds |
| --- | --- |
| About 2 s (July 2026) | The size of the PBKDF2 work factor: an unlock of about 2 s on an open build, on the derivation engines of July |
| 3 s (November 2026) | The whole unlock, correct PIN to the first frame of the list |

The 2 s figure is older and narrower. The baseline of 2026-07-06 was taken at the counts of the time, 35,000 iterations on the S3 and 25,000 on the classic chip, with ESP-IDF 6.0.1: the whole unlock was estimated at about 2.05 to 2.1 s on a StickS3 and 2.2 s on a Core2, with PBKDF2 more than four fifths of it. In July, with the move to ESP-IDF 6.0.2, the counts were raised at that same fixed budget to 175,000 on the S3, then estimated at about 1.54 s of derivation, and 40,000 on the classic chip, about 1.57 s (neither these counts nor the ones before them reached release builds, which from 2026-06-17 to 2026-08-21 derived at a 600,000 fallback nobody chose, as [post 017](https://jmrp.io/blog/017-pbkdf2-esp32-s3-sha-engine/#who-chose-the-600000-iterations) tells). The firmware's notes still describe the count that way, as sized to a ~2 s unlock on an open build with the engines of July 2026, and it is defined in one place, a build option per chip family:

**platformio.ini: the work factor, one value per chip family**

```ini
[kdf]
iterations_esp32s3 =
    -DCRYPTO_PBKDF2_ITERATIONS=175000
iterations_esp32 =
    -DCRYPTO_PBKDF2_ITERATIONS=40000
```

So the 2 s figure sized one phase. The 3 s figure is a cap I set on 2026-11-14, while answering an audit of the firmware's cryptography, for all of them: from a correct PIN to the first frame of the list. It also fences the work factor from the other side: the S3's count may only grow toward OWASP's 600,000 for as long as the whole unlock stays within 3 s. At 600,000 the derivation alone takes 2,836 ms on the lean loop (measured), so that count does not fit; [post 017](https://jmrp.io/blog/017-pbkdf2-esp32-s3-sha-engine/#why-was-the-lean-saving-spent-on-time-not-iterations) explains why the lean saving went to time rather than iterations. Moving either figure is my call, and nothing about it is decided. Where a chart below draws a line at 2 s and another at 3 s, those are the two.

---

## What happens between the last digit and the first list frame?

An unlock is not one operation. On a dial board with the current firmware, it is this sequence, each step waiting for the one before:

**One dial unlock, in order (firmware main, December 2026)**

1. `Lock flash`: 200 ms, dial only
2. `Wait frame`: lockout read, base clock
3. `Boost`: 240 MHz, whole chip
4. `Vault open`: mount + meta.bin
5. `Counter`: NVS, before deriving
6. `Derivation`: vault worker, core 0
7. `List load`: one segment per unit
8. `Verdict`: keyhole turn, 600 ms
9. `First frame`: boost released

The two fixed screen waits, 200 ms and 600 ms, sit outside the vault work: the flash ends before the vault opens, and the verdict starts after the list is loaded. On touch and keyboard boards the entry ends at OK or ENTER, and the verdict is the same 600 ms.

In code, starting from the PIN screen:

1. **The last digit locks.** The entry screen logs `Digit N locked` (the index starts at 0, so a six-digit PIN ends at `Digit 5 locked`), plays a 200 ms lock flash and logs `PIN entered, verifying...`. Touch keypads log `Secret entered, verifying...` and keyboards `Passphrase entered, verifying...`; only the dial entry has the lock flash. The screen then paints the wait's first frame and `onPinVerify` reads the lockout state, still at the base clock: 81 ms on the StickS3 at 30 + 10, from the `verifying` line to the raised clock.
2. **The clock goes up first.** `onPinVerify` in `src/states/pin_state.cpp` raises the CPU from its 80 MHz base clock to 240 MHz with a `CpuBoostGuard` before it mounts the vault, as the console path already did. The clock is the whole chip's, so the vault task on core 0, which mounts and derives, runs at 240 MHz too. (That 80 MHz is the CPU's base clock, not the flash clock; the flash has a clock of its own, which matters for the Core2 v1.3 below.) This order is on firmware main since 2026-11-29, so the batch of 2026-12-04 below has it on every board; the older figures further down were timed on firmware that opened the vault at the base clock and raised it afterwards. On the 4 December batch the console path spent 17 to 27 ms (medians per cell; single runs 16 to 27) from its raised clock to the start of the derivation, the mount included, on the S3 boards and the StickC Plus 1.1 and Plus SE, 33 to 35 ms on the CoreInk, 52 to 60 ms on the StickC Plus2 (single runs to 61) and 43 to 70 ms on the Core2 v1.3. The console raises the clock before that window opens. The PIN screen now raises it before its mount too, and only the T-Deck has a before-and-after pair for that change (29 November, full vault): the mount took 4.8 ms at the base clock and 2.1 ms with the clock raised first, and LittleFS's share before the derivation fell from 26 to 11 ms; the whole unlock moved by less than its run-to-run spread.
3. **The vault opens and the counter goes down to flash.** `VaultStore::begin()` mounts the file system, checks the layout and reads `meta.bin`, then logs `Vault initialized`, and `BruteForceGuard::registerFailure()` records the attempt in NVS, in one commit, **before** anything is derived. Since 2026-12-01 it returns the count it wrote, and a count that did not land refuses the unlock before any derivation. An outcome that never weighed the secret (an unreadable `meta.bin`, a backend that would not run, a MAC that failed under the right secret) gives the attempt back; only a wrong secret keeps it. The device fails closed: pulling the battery mid-derivation leaves a failed attempt on record, never a free guess.
4. **The derivation runs on the vault worker.** `VaultStore::unlockVault()` hands the work to a task called `kleidos-vault`, pinned to core 0 at priority 3, while the UI task keeps core 1. Since 2026-11-29, with the PIN-change rotation, a secret epoch kept in `meta.bin` is checked against a counter in NVS before anything is derived, on every unlock, PIN check and boot. A record older than the counter, or one with no counter beside it, is one a rollback brought back: it is refused as `RolledBack` without weighing the secret, and the attempt counted before it is given back. At boot such a vault goes to the recovery prompt instead of the PIN screen. A counter that cannot be read decides nothing either way. Inside, the KEK is derived (PBKDF2, then the device binding of [post 012](https://jmrp.io/blog/012-device-bound-key-derivation/), a no-op on open builds), the record's `wrapTag` is verified before anything is decrypted, the PIN verifier is checked and the vault key is unwrapped. On the S3 the derivation is the lean loop behind its self-test; on the classic chip, the software core in IRAM.
5. **The lists load in units.** `AppContext::readListsInUnits` reads one index segment per unit and hands control back to the UI task between units, and the wait ring is painted from inside each unit's wait (`platform/hooks/wait_pump.h`).
6. **The counter resets and the clock is held.** `resetAttempts()` clears the counter, `cpuBoost.holdPastScope()` hands the boost to a latch that keeps the CPU at 240 MHz through the entry to the home screen, and the log says `Vault unlocked`. After a wrong PIN there is no latch: the boost is released when `onPinVerify` returns.
7. **The verdict.** A keyhole turn of 600 ms, the same for a right and a wrong PIN.
8. **The first frame.** The home screen draws the list, logs `boost: released after N ms held` and drops back to the base clock. That line ends every measurement in this post.

The two calls that matter most for the order are a few lines apart in `pin_state.cpp`:

**src/states/pin_state.cpp (excerpt): the counter before the derivation, the derivation on the worker**

```cpp
const BruteForceGuard::FailureCount preFail = BruteForceGuard::registerFailure();
if ( !preFail.counted() ) {
    // The count did not land (a store that refuses writes, a record that
    // would not authenticate): weighing the secret now would be a guess
    // nobody counted, so none is weighed (WB-2). Nothing was learned, so
    // no cross and no "incorrect" either.
    VaultStore::end();
    KLEIDOS_LOGE( kTag, "Unlock refused: the attempt could not be counted" );
    s_pinCtx->authUI.suppressResultFeedback();
    ...
    return false;
}
...
kleidos::platform::watchdog::resetCurrentTask();
const kleidos::vault::UnlockOutcome outcome =
    VaultStore::unlockVault( input, s_pinCtx->vault.vaultKey.data() );
```

On an S3 `_stress` image, with the unlock trace compiled in, the lines that bound one unlock look like this (more `boost:` lines sit in between):

**Serial log of one dial unlock on an S3 _stress image (trace build; no secrets)**

```text
Digit 5 locked
PIN entered, verifying...
Vault initialized
kdf: 175000 iterations: 827 ms @ 240 MHz engine=lean
Vault unlocked
boost: released after N ms held
```

On 2026-11-29 the screen's order changed: it now raises the clock **before** mounting the vault rather than after. On the T-Deck that took the LittleFS time of the whole unlock from 474.7 to 459.3 ms, and the part before the key derivation from 26.4 to 11.1 ms (PIN screen under the LittleFS probe, full vault, three runs, 2026-11-29). The same work removed a second mount per unlock that only the console path made, which took the T-Deck's console unlock from 1,684 to 1,668 ms (host clock). Those PIN-screen runs timed LittleFS only; the batch of 2026-12-04 below is the first end-to-end figure from the PIN screen since.

A debug build without the trace logs `Key derived (175000 iterations)` instead of the `kdf:` line, and prints no `boost: released after` line at all; a release image logs at ERROR and prints neither, which is why the release images can't be timed this way (more on that below).

### Why 0.8 s of every dial unlock is fixed, and why it stays

Two of those steps take a fixed time whatever the vault holds:

**pin_entry_ui.cpp and unlock_feedback.h: the fixed screen waits**

```cpp
static constexpr uint32_t
    kLockFlashMs = 200;
inline constexpr uint32_t
    kResultDwellMs = 600;
inline constexpr uint32_t
    kVerdictMs = kResultDwellMs;
```

Together that is 0.8 s of every dial unlock during which no derivation, no flash read and no list load happens. It would be easy to call that waste, and it isn't. The 200 ms flash is the screen's fill animation (`kLockFlashMs` equals `unlock_feedback::kFillMs`): it shows the last digit locking in before the screen moves on. The 600 ms verdict is the answer itself, and it lasts the same for a right and a wrong PIN, so how long the screen pauses does not depend on the answer. Touch and keyboard boards wait the same 600 ms for the verdict. Before 2026-11-27 the keyboards' passphrase prompt held its result 500 ms (measured 504 to 508 ms on 2026-11-14); the touch keypad already held 600 ms (measured about 610 ms).

What the animation itself costs was measured on the day the keyhole turn landed, on `_debug` images at the base clock: one frame of the turn takes 4.6 to 5.8 ms on the StickS3 and 5.5 to 6.9 ms on the StickC Plus2 when only the keyhole's box is repainted, against about 55 ms on the StickS3 for the whole mark. End to end, against the 2026-11-21 figures, the turn moved the real path by 10 ms on the StickS3 (2,036 to 2,046 ms) and 23 ms on the Plus2 (2,742 to 2,765 ms). The 800 ms are a decision about pacing; drawing them is almost free.

---

## How is an unlock timed on the board?

With a script on the host, `qa/tools/unlock_path_bench.py`, run from the QA virtualenv against a board flashed with its `<board>_stress` image:

**How a row is taken (qa/tools/unlock_path_bench.py)**

```text
python tools/unlock_path_bench.py <dut> \
    --out <file.jsonl> \
    [--history stepped|one-pass] \
    [--levels fleet,half,full] \
    [--console 5] [--console-cold 5] \
    [--real 5] [--real-cold 5] \
    [--engine auto|any|<name>] \
    [--max-kdf-ms <ms>]
```

It times two paths. The **console** path sends the PIN over the serial console and starts on the device's clock at `boost: console unlock at`; it skips the screen's waits, and since 2026-11-29 it follows the PIN screen's vault code; until then it also mounted the vault a second time, which the PIN screen never did. The **real** path drives the board's own input:

- **Dial boards** (the Sticks hold button A; the CoreInk holds the centre of its dial, the long press its entry screen takes for each digit): an injected press aimed at the centre of each digit's window, timed on the **device's** clock from the last `Digit N locked`.
- **Touch boards** (Core2 v1.3, CoreS3 SE): `TOUCH x y` on each of the six digits and then on OK, which every PIN on the keypad needs (nothing submits after the sixth digit), timed on the **host's** clock from writing the OK tap.
- **Keyboard boards** (Cardputer ADV, T-Deck): the keys and `ENTER`, timed on the **host's** clock from ENTER.

Every row ends at `boost: released after`, the first frame of the list on the glass, and records which derivation engine ran. A row fails if the engine is not the production one (the lean loop, on an S3) or if the derivation went over `--max-kdf-ms`. Every derivation in the 2026-12-04 batch printed the engine it finished on: all 96 on the ESP32-S3 boards on the lean loop, all 120 on the classic boards on the software core, their only engine. The engine counters read `fallbacks=0 lean_refused=0` before each board's run and after it, but both readings count only from a boot: the first was taken before the run's factory reset, the second after the last reset, which held one unlock; on the classic ESP32 they cannot move.

Two rules come with it. First, **a vault's history moves the figure at the same fill**: up to 400 ms with a full vault, in either direction, depending on how the records were written. Hence `--history stepped` (erase, then 30 + 10, half and full on the same vault) or `one-pass`, and the rule that rows from different fills or histories are not compared. Second, **the host clock is not the device's**: on touch and keyboard boards it includes the cable trip and the injected press, so a real finger lands somewhere between the host figure and what the device saw.

### What a `_stress` image does and does not tell you

Release images can't be timed from outside, by construction. The unlock trace, and the `boost: released after` line that ends every row, only compile into builds that have the serial console's button injection:

**src/platform/hooks/perf_switches.h: why a base image can't be timed from outside**

```cpp
#ifndef KLEIDOS_UNLOCK_TRACE
    #ifdef DEBUG_SERIAL_BUTTONS
        #define KLEIDOS_UNLOCK_TRACE 1
    #else
        #define KLEIDOS_UNLOCK_TRACE 0
    #endif  // DEBUG_SERIAL_BUTTONS
#endif      // KLEIDOS_UNLOCK_TRACE
```

A base image also has no console to create a vault or enter a PIN. So every figure here is from a debug-console image, and all but the hardened StickS3's from a `_stress` image: the `_debug` image with the production work factor put back, through this section:

**platformio.ini: the [stress] section of every <board>_stress environment**

```ini
[stress]
build_unflags =
    -DCORE_DEBUG_LEVEL=1
    -DCRYPTO_PBKDF2_ITERATIONS=1
```

Each `<board>_stress` environment extends `<board>_debug`, and its `build_unflags` replaces `_debug`'s: it still drops the base log level, as `_debug` does, but drops the one-iteration count instead of the production one, so the `[kdf]` count reaches the compiler. That count is the one difference from `_debug`, and the derivation it times is the production one. A release image differs in more: none of the debug configuration, the profiling and diagnostics switches or the debug partition table, and its code sits elsewhere in flash, which on the Core2 v1.3 alone [moved the cost of each read](#what-did-the-core2-v13-flash-fix-buy). So a release image is not necessarily faster than the figures below. How it compares has **not been measured**.

---

## How long does each board take today?

This is the 2026-12-04 batch, on `_stress` images of firmware main built with ESP-IDF 6.1.1. The bench started each board from a factory reset, set the bench PIN from the console, wrote one console command of twelve branded credentials and four 2FA entries, then the rest one record at a time: first up to 30 + 10, where it measured, then on up to the board's full vault, where it measured again (two levels). At each level it took three unlocks per path in session and three each after its own reset, from the console and from the PIN screen: 12 per level, 24 per board. Each bar splits the real path into the derivation, the rest of what the console path measured, and what the screen and the input add on top:

**Real-path unlock per board, 30 credentials and 10 2FA entries (measured, 2026-12-04)**

| Board | Key derivation | Rest of the console path | Screen and input (real minus console) | Total | Note |
| --- | --- | --- | --- | --- | --- |
| Cardputer ADV | 828 ms | 239 ms | 747 ms | 1814 ms | keyboard, host clock · after reset 1,813 ms |
| StickS3 | 828 ms | 259 ms | 943 ms | 2030 ms | dial, device clock · after reset 2,070 ms |
| T-Deck | 828 ms | 360 ms | 844 ms | 2032 ms | keyboard, host clock · after reset 2,030 ms |
| CoreS3 SE | 828 ms | 386 ms | 1147 ms | 2361 ms | touch, host clock · after reset 2,364 ms |
| StickC Plus 1.1 | 1500 ms | 184 ms | 932 ms | 2616 ms | dial, device clock · after reset 2,651 ms |
| StickC Plus SE | 1500 ms | 184 ms | 936 ms | 2620 ms | dial, device clock · after reset 2,643 ms |
| StickC Plus2 | 1500 ms | 284 ms | 958 ms | 2742 ms | dial, device clock · after reset 2,795 ms |
| Core2 v1.3 | 1565 ms | 955 ms | 1249 ms | 3769 ms (over 3000 ms) | touch, host clock · after reset 3,967 ms |
| CoreInk | 1500 ms | 2272 ms | 986 ms | 4758 ms (over 3000 ms) | dial, device clock · after reset 4,793 ms |

Reference lines: 2 s budget at 2000 ms; 3 s cap at 3000 ms.

Medians of three unlocks in session; the note gives the after-reset median. The derivation is drawn at the middle of each chip's range over the batch's 216 unlocks: 828 ms on the ESP32-S3 (826 to 831), 1,500 ms on the classic Sticks and the CoreInk (1,497 to 1,504) and 1,565 ms on the Core2 v1.3 (1,564 to 1,566). The real path of the touch and keyboard boards runs on the host clock from the moment the bench wrote OK or Enter, so the hatched part there also holds the cable trip; the dial boards and every console path run on the device clock. _stress images, ESP-IDF 6.1.1.

By the cap, the Cardputer ADV, the StickS3, the T-Deck, the CoreS3 SE and the three classic Sticks (StickC Plus 1.1, Plus SE and Plus2) unlock within 3 s, in session and after a reset; the Core2 v1.3 and the CoreInk do not. Only the Cardputer ADV came in under 2 s, at 1,814 ms in session and 1,813 ms after a reset; in session the StickS3 missed it by 30 ms and the T-Deck by 32 ms.

Two things stand out. The hatched part, what the screen and the input add over the console path, is 0.75 to 1.25 s at 30 + 10: 0.93 to 0.99 s on the dial boards, which hold the 800 ms of fixed waits (the 200 ms lock flash and the 600 ms verdict); 0.75 s on the Cardputer and 0.84 s on the T-Deck, which have no lock flash and hold the 600 ms verdict and the host clock's share; and 1.15 s on the CoreS3 SE and 1.25 s on the Core2 v1.3, which hold the verdict, the host clock's share and a repaint of the whole keypad before the derivation: 250 to 410 ms from the keypad's `verifying` to the vault open, where the keyboards take 40 to 60. And on the S3 boards the derivation is now 828 of the StickS3's 2,030 ms, about two fifths, and the fixed screen waits are almost as much. On the StickS3, two of its three runs at 30 + 10 took 2,030 ms each: the lock flash 208 ms, the wait's first frame, the lockout read, the vault open and the counter before the derivation 111 ms (81 of them before the clock goes up), the derivation 829 ms, the list load and audit 222 ms, the verdict 606 ms, and the handover and first frame 54 ms. The two fixed waits are 814 of those 2,030 ms, almost as much as the derivation. The derivation is no longer where an S3 unlock goes.

### And with a full vault?

The same batch then filled each board's vault to its capacity and timed it again, on the same paths:

**Real-path unlock per board, full vault (measured, 2026-12-04)**

| Board | Key derivation | Rest of the console path | Screen and input (real minus console) | Total | Note |
| --- | --- | --- | --- | --- | --- |
| Cardputer ADV | 828 ms | 441 ms | 745 ms | 2014 ms | 250 + 40 · keyboard · after reset 2,209 ms |
| T-Deck | 828 ms | 650 ms | 749 ms | 2227 ms | 500 + 50 · keyboard · after reset 2,431 ms |
| StickS3 | 828 ms | 473 ms | 943 ms | 2244 ms | 250 + 40 · dial · after reset 2,367 ms |
| StickC Plus SE | 1500 ms | 302 ms | 930 ms | 2732 ms | 90 + 30 · dial · after reset 2,803 ms |
| StickC Plus 1.1 | 1500 ms | 304 ms | 932 ms | 2736 ms | 90 + 30 · dial · after reset 2,803 ms |
| CoreS3 SE | 828 ms | 686 ms | 1242 ms | 2756 ms | 500 + 50 · touch · after reset 2,961 ms |
| StickC Plus2 | 1500 ms | 572 ms | 965 ms | 3037 ms (over 3000 ms) | 90 + 40 · dial · after reset 3,157 ms |
| Core2 v1.3 | 1565 ms | 1802 ms | 1208 ms | 4575 ms (over 3000 ms) | 500 + 50 · touch · after reset 5,386 ms |
| CoreInk | 1500 ms | 671 ms | 2737 ms | 4908 ms (over 3000 ms) | 90 + 30 · dial, e-paper · after reset 3,086 ms |

Reference lines: 2 s budget at 2000 ms; 3 s cap at 3000 ms.

Each row's note gives the fill (credentials + 2FA entries), the input and the after-reset median. Medians of three in session; derivation and clocks as in the chart above. The CoreInk's hatched part is mostly one full refresh of its e-paper, as the text below explains. _stress images, ESP-IDF 6.1.1.

With their full vault, the four S3 boards and the StickC Plus SE and Plus 1.1 stay under 3 s in session and after a reset: from 2,014 ms (the Cardputer ADV in session) to 2,961 ms (the CoreS3 SE after a reset). The StickC Plus2 misses the cap by 37 ms in session and 157 ms after a reset, and the Core2 v1.3 by 1.6 s in session and 2.4 s after a reset. The CoreInk measured 4,908 ms in session and 3,086 ms after a reset, and the [section on the slow boards](#why-are-the-classic-esp32-and-the-coreink-slow-for-different-reasons) explains why that is not a typo. With the full vault the hatched part is 0.93 to 0.97 s on the Sticks, 0.75 s on both keyboards and 1.21 to 1.24 s on the touch boards; the CoreInk's hatched part (2.74 s) is mostly one full refresh of its e-paper (1.9 s) that HOME's first frame took on the PIN screen and in only one of the three console runs; the rest is the dial's 800 ms of fixed waits.

With a full vault, from the PIN screen in session, the StickS3 went from 4,273 to 2,244 ms (device clock, from the last digit), the CoreS3 SE from 4,386 to 2,756 ms and the Core2 v1.3 from 5,592 to 4,575 ms (host clock, from the input that submits the PIN). The older figures are of 14 November, on that day's firmware and ESP-IDF 6.0.3, before the lean loop reached the ESP32-S3 boards. Both batches wrote the vault in steps from an erased one, but not the same steps: 14 November stopped at half the vault on the way and 4 December did not, and the order a vault was written in moves a full vault's unlock by up to 0.4 s. 14 November took five unlocks a cell and 4 December three, and the touch boards then took a four-digit PIN that submitted itself where they now take six digits and OK.

---

## Which phase dominates once the derivation is cheap?

To see the phases separately, the clearest data is older: the baseline run of that cryptography audit, with a full vault on eight boards, on main on 2026-11-14, before the memory map landed that night, and a week before the lean loop. It predates both changes, so it is the picture of where an unlock went **before** the derivation got cheap, not a current figure:

**Full-vault unlock by phase, before the lean loop and the memory map (measured, 2026-11-14)**

| Board | To vault open | Counter + clock | Derivation | List load | Result wait | First frame | Host clock, not attributed | Total | Note |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Cardputer ADV | 196 ms | 20 ms | 1434 ms | 1485 ms | 504 ms | 34 ms | 160 ms | 3833 ms (over 3000 ms) | S3 · keyboard |
| T-Deck | 119 ms | 17 ms | 1433 ms | 1479 ms | 508 ms | 56 ms | 216 ms | 3828 ms (over 3000 ms) | S3 · keyboard |
| StickS3 | 473 ms | 26 ms | 1471 ms | 1642 ms | 607 ms | 54 ms | 0 ms | 4273 ms (over 3000 ms) | S3 · dial |
| CoreS3 SE | 322 ms | 22 ms | 1505 ms | 1496 ms | 610 ms | 73 ms | 358 ms | 4386 ms (over 3000 ms) | S3 · touch |
| StickC Plus SE | 438 ms | 32 ms | 1501 ms | 656 ms | 615 ms | 67 ms | 0 ms | 3309 ms (over 3000 ms) | classic · dial |
| StickC Plus 1.1 | 447 ms | 30 ms | 1500 ms | 690 ms | 610 ms | 68 ms | 0 ms | 3345 ms (over 3000 ms) | classic · dial |
| Core2 v1.3 | 463 ms | 44 ms | 1569 ms | 2286 ms | 611 ms | 123 ms | 496 ms | 5592 ms (over 3000 ms) | classic · touch |
| CoreInk | 485 ms | 20 ms | 1500 ms | 640 ms | 609 ms | 2106 ms | 0 ms | 5360 ms (over 3000 ms) | classic · e-paper |

Reference lines: 2 s at 2000 ms; 3 s at 3000 ms.

Medians in session, _stress images on main before the memory map, full vault per board written as a stepped history. Phases on the device clock from the last entry; the total on the host clock on touch and keyboard boards, so the hatched gap there is time the device did not attribute. Phases are medians and need not sum exactly. 'To vault open' on dial boards includes the 200 ms lock flash. The result wait was 500 ms on the keyboards then; the keyhole turn did not exist yet.

On the four S3 boards, the derivation and the list load were the same size, about 1.4 to 1.6 s each. On the classic Sticks the list was small (90 + 30) and the derivation was almost half the unlock. The Core2 v1.3's list load, 2.3 s, was its largest phase, and the CoreInk's was its first frame, 2.1 s. After a reset, only the list load moved, by 0.16 to 1.0 s; every other phase moved by less than 35 ms, except the CoreInk's first frame.

Then two changes took the two big S3 phases apart:

- **The lean loop** ([post 017](https://jmrp.io/blog/017-pbkdf2-esp32-s3-sha-engine/)) took 0.58 to 0.71 s off each S3 board's console unlock and 0.59 to 0.81 s off its real path, at the same count.
- **The memory map**, on main since the night of 2026-11-14, reads the vault partition through the flash cache's window instead of one flash read per access. With a full vault, on the console path:

**Full-vault console unlock, plain read vs memory map (measured, 2026-11-14)**

| Metric | Before | After | Change |
| --- | --- | --- | --- |
| StickS3 (open), 250 + 40 | 3.390 s | 2.076 s | -1.314 s (-38.8%), better |
| StickC Plus SE, 90 + 30 | 2.782 s | 2.018 s | -0.764 s (-27.5%), better |

Console path, full vault, _stress images, same day. The open StickS3 at 250 + 40, the StickC Plus SE at 90 + 30 (2.781 to 2.782 s plain, 2.017 to 2.018 s mapped). On the hardened StickS3, the list load alone went from 1,008 to 376 ms.

What is left on an S3 board is mostly the screen and the list, and of those only the list scales with the vault. On the 2026-12-04 batch, from the PIN screen in session, the span from the derivation's end to HOME's first list frame, the 600 ms verdict included, took 987 ms on the T-Deck at 30 + 10 and 1,293 ms with its full vault, and 1,539 and 2,412 ms on the Core2 v1.3; the list load alone was 324 and 628 ms on the T-Deck and 814 and 1,680 ms on the Core2 v1.3. Two smaller findings from the same work belong here because they bound what else could come off:

- **Opening the vault early would save little.** `VaultStore::begin()` alone (mount, layout check, `meta.bin`) costs 27 to 177 ms with a full vault: 26.8 ms on the CoreS3 SE at 240 MHz, 176.7 ms on the StickS3 at the 80 MHz base clock it opened at then, the same after a reset as in session to within 2 ms (measured, 2026-11-14). Starting it before the last digit would save at most that, and on the 2026-12-04 batch the console path spent 17 to 70 ms from its raised clock to the derivation, the mount included.
- **The screen slows the derivation a little.** On the S3, the derivation measured slower from the PIN screen than from the console while the ring was painting: 1,505 against 1,424 ms on the CoreS3 SE (5.7%), 1,471 against 1,423 on the StickS3, both on the port loop. The probable cause, not isolated, is the UI painting on core 1 while the worker derives on core 0. With the lean loop the gap is 830 to 831 against 826 to 827 ms on the CoreS3 SE (2026-12-04; 835 against 828 on 14 and 15 November).

- **2026-07: Counts raised at the ~2 s budget**: 175,000 on the S3, 40,000 on the classic ESP32; ESP-IDF 6.0.2.
- **2026-08: The count becomes a build flag**: One [kdf] value per chip family. Neither the June nor the July counts had reached release builds: from 2026-06-17 to 2026-08-21 every one derived at a 600,000 fallback nobody chose.
- **2026-10-12: Clock boost inside the derivation**: Every derivation at 240 MHz (160 MHz on a classic board with Wi-Fi on).
- **2026-11-14: Verify wait reworked, then memory map**: The ring is painted from the worker's wait; CoreS3 SE full vault 5,403 to 4,386 ms. The map lands on eight boards that night.
- **2026-11-21: Lean loop on main**: 175,000 iterations in about 0.83 s on the S3, against 1.42 s.
- **2026-11-27: Keyhole verdict**: 600 ms on every surface; the keyboards had waited 500 ms.
- **2026-11-29: Core2 v1.3 flash at 80 MHz**: Vault read path in IRAM.
- **2026-12-03: ESP-IDF 6.1.1**: The toolchain moves from ESP-IDF 6.0.3, and LittleFS from 1.22.1 to 1.23.4; the derivation measures the same. The nine-board batch on this page is timed on it the next day.

---

## Why are the classic ESP32 and the CoreInk slow for different reasons?

Because three different costs land on them, and only one is cryptography.

**Three slow boards, three costs**

| Board | What it pays for |
| --- | --- |
| Every classic ESP32 board | Software SHA-256: 40,000 iterations in about 1.5 s, against 175,000 in about 0.83 s on the S3 |
| CoreInk | Its e-paper: a first frame of about 1.9 to 2.1 s or 0.15 to 0.3 s, depending on which refresh the run gets |
| Core2 v1.3 | Its flash: a 112-page vault that does not fit the 64-page window, so every read goes to flash |

**The classic ESP32 pays for software SHA-256.** The S3 runs 175,000 iterations of the lean loop on its SHA engine in 826 to 831 ms. The classic chip runs 40,000 iterations of the firmware's own SHA-256 core in IRAM in about 1.5 s: 1,497 to 1,504 ms on the StickC Plus2, Plus SE, Plus 1.1 and CoreInk, 1,564 to 1,566 ms on the Core2 v1.3, 37.4 to 39.2 µs per iteration (measured, 2026-12-04). It derives less than a quarter of the iterations in almost twice the time. The classic chip's SHA engine would do the same derivation about four times faster, but that path exists only as a bench measurement; [post 017](https://jmrp.io/blog/017-pbkdf2-esp32-s3-sha-engine/#the-classic-engine-397x-on-the-bench-nowhere-in-production) explains why production does not use it. On the StickC Plus2 that is most of its gap to the StickS3: 0.67 s more derivation in a real path 0.71 s longer, still under the cap.

The StickC Plus2 runs about 0.1 s behind the Plus 1.1 and the Plus SE on the same derivation (1,784 against 1,684 ms from the console at 30 + 10). Its traces put the difference in the flash reads, not the key: 52 against 26 ms before the derivation, every list unit about 1.45 times longer (an index segment 12.2 against 8.4 ms, the 2FA segment 70 against 49 ms), and HOME's first frame 70 against 45 ms. The likely cause is the flash clock. Since the toolchain update of 3 December the Plus 1.1 and the Plus SE read their memory-mapped vault at 80 MHz, while the Plus2's in-package PSRAM sets the shared bus back to 40 MHz when it starts, and its screen buffer lives in that PSRAM. The CoreInk, a classic ESP32 with no PSRAM whose flash still runs at 40 MHz, reads like the Plus2 (33 to 35 ms before the derivation, an index segment 9.6 to 11.2 ms, the 2FA segment 67 ms). The Plus2 itself did not slow down (1,817 ms in the same cell on 27 November); the other two sped up. This is read from the images and ESP-IDF's source, not measured on its own.

**The CoreInk pays for its e-paper.** Its first list frame includes a panel refresh, and which refresh it gets varies with the run. It is a full refresh whenever the panel left its fast waveform just before, since leaving it forces one; why it left it in those runs is not in the traces. On the full-vault run of 2026-11-14 it was the slow full refresh, about 2.1 s, in session, and the fast one, about 0.2 to 0.3 s, after a reset (5,360 against 3,653 ms); on the 2026-12-04 batch, with a full vault, it measured 4,908 ms in session and 3,086 ms after a reset. On a read bench the first frame took 2,100 ms at 30 + 10 and at 45 + 15, and 221 ms at 90 + 30, on both paths, which is why the fuller vault unlocked sooner. On the 2026-12-04 batch, in the cells where HOME's first frame went out as a full refresh of the e-paper (1,900 ms), 2.2 to 3.0 s of the unlock came after the derivation: all four cells at 30 + 10 (2,240 and 2,279 ms from the console, 2,858 and 2,895 ms from the PIN screen) and the full vault's PIN screen in session (3,008 ms). Where HOME went out as a 145 ms fast partial, the same part took 0.5 to 0.6 s from the console and 1.2 s from the PIN screen after a reset, which is why the full vault's unlock after a reset (3,086 ms) beat the one in session (4,908 ms); the full vault's console median in session, 2,171 ms, hides runs of 2,046 to 3,923 ms. Its PIN-screen figures are also short by at least about 40 ms: its `Digit N locked` line is logged after a 145 ms e-paper flush, so its dial window opens late, by an amount the data cannot size exactly. Its console path skips the PIN screen's waits but still ends on that first frame, and at 30 + 10 it took 3,772 ms against the StickC Plus2's 1,784 ms: about 2 s more, for the same derivation. During the verify wait the CoreInk shows a fixed full ring and repaints nothing, because each fast partial refresh of its e-paper takes 143 to 236 ms on this batch (the firmware's comment in `unlock_feedback.h` puts one at about 245 ms). Its figures are what that board shows, not what the vault costs.

**The Core2 v1.3 pays for its flash.** It is the one board in the fleet whose vault is not memory-mapped. Its vault spans 112 pages, which does not fit the classic ESP32's 64-page data window, so it reads `plain`: one flash read per LittleFS read. The other eight boards map the whole vault. On the 2026-12-04 batch its real path took 3,769 ms from OK in session and 3,967 ms after a reset, with the 1,565 ms derivation less than half of it. On the 27 November batch, on ESP-IDF 6.0.3 and before the 80 MHz flash, the read path in IRAM and the clock raised before the PIN screen's mount, the same path (30 + 10, in session, from OK on the host clock) measured 4,170 ms; the batch does not separate what each of those changes took off.

---

## What did the Core2 v1.3 flash fix buy?

The first step was to find where its LittleFS time went. A probe build counted every LittleFS call and its cost on the console path, three runs per row, each the first unlock after a reset (measured, 2026-11-28, `tdeck_stress` and `core2_v13_stress` on a branch over main with debug-only instruments):

**Console unlock by cost, T-Deck vs Core2 v1.3 (measured, 2026-11-28)**

| Board, fill | LittleFS lookups | LittleFS data reads | Other LittleFS | Derivation | Other crypto | Rest (unlock minus the above) | Total |
| --- | --- | --- | --- | --- | --- | --- | --- |
| T-Deck, 30 + 10 | 237 ms | 6 ms | 3 ms | 827 ms | 59 ms | 169 ms | 1301 ms |
| T-Deck, 250 + 25 | 433 ms | 21 ms | 5 ms | 827 ms | 87 ms | 220 ms | 1593 ms |
| T-Deck, 500 + 50 | 404 ms | 39 ms | 5 ms | 827 ms | 128 ms | 333 ms | 1736 ms |
| Core2 v1.3, 30 + 10 | 1734 ms | 38 ms | 20 ms | 1565 ms | 98 ms | 434 ms | 3889 ms (over 3000 ms) |
| Core2 v1.3, 250 + 25 | 3371 ms | 182 ms | 28 ms | 1565 ms | 134 ms | 492 ms | 5772 ms (over 3000 ms) |
| Core2 v1.3, 500 + 50 | 3151 ms | 352 ms | 24 ms | 1565 ms | 190 ms | 656 ms | 5938 ms (over 3000 ms) |

Reference lines: 3 s at 3000 ms.

Unlock on the host clock, the costs as device sums. On the Core2 v1.3 the rest includes its console stall at 115,200 baud. Like every console figure before 2026-11-29, these include a second mount of the vault that the PIN screen never made. The Core2 v1.3 rows predate the 80 MHz change below, and none of them is that board's floor.

Nine tenths of LittleFS time goes to **finding** files, not reading them. With a full vault, one unlock makes 313 `lfs_stat` calls, 122 opens, 139 `lfs_getattr` calls and 782 reads. On the T-Deck, which maps the vault, all of that costs about 0.45 s; on the Core2 v1.3, where each lookup walks metadata through real flash reads, about 3.5 s. Each Core2 v1.3 read also cost more in that image than it had before: 124 µs, against 88 µs on 2026-11-14 and 89 µs in a sister image that differed by only 580 bytes of code in flash, a difference worth about 1.1 s of the unlock.

The follow-up traced that read cost to the image's code layout, **where the read-path code sat in flash**, and ruled out the CPU clock: all 2,301 calls of each unlock run at 240 MHz and none changes the clock midway. Reflashed, that image still read at 124.2 µs, so the cost is its own; but it cannot be rebuilt, and in the current tree 8 KB of padding moved each read only from 87.6 to 90.0 µs, so a padding test shows the effect in kind without reproducing its size. Two changes reached main on 2026-11-29: the three functions of the vault's read path moved into IRAM, which applies only to builds that read the vault plain (today, the Core2 v1.3 alone), and the Core2 v1.3's flash went from 40 to 80 MHz (DIO). Measured on the console path under the same probe, first unlock after a reset, full vault (500 credentials and 50 2FA entries), device clock, `_stress` images with the debug partition table, each change alone and both:

**Core2 v1.3, full vault, console unlock: read path in IRAM and flash at 80 MHz (measured, 2026-11-29)**

| Metric | Before | After | Change |
| --- | --- | --- | --- |
| Read path in IRAM only | 4.674 s | 4.623 s | -0.051 s (-1.1%), better |
| Flash at 80 MHz only | 4.674 s | 4.163 s | -0.511 s (-10.9%), better |
| Flash at 80 MHz only, OTA-updated board (old 40 MHz bootloader) | 4.674 s | 4.164 s | -0.510 s (-10.9%), better |
| Both (on main) | 4.674 s | 4.136 s | -0.538 s (-11.5%), better |
| LittleFS share, both | 2.311 s | 1.995 s | -0.316 s (-13.7%), better |

Console unlocks under the LittleFS probe, medians of five, each the first after a reset; not unlocks from the PIN screen. Baseline the same day: 4.674 s. The OTA row is the 80 MHz-only image on a board updated over the air, which keeps its old 40 MHz bootloader: it measures the same as a flashed one. The merged image has not been measured by OTA. Timestamps on, as in the fleet.

The flash clock did almost all of it; the IRAM move alone was worth 0.05 s, and together they took each read from 87.6 to 73.6 µs. Quad I/O mode would have gone further, to 3.93 s, and was left out because the flash chip on this board could not be checked (its data sheet could not be read; the bench unit already has the chip's quad-enable bit set, which does not prove the bootloader sets it; and an OTA-updated board would end with the cache in DIO and the driver in QIO). The result is still over the 3 s cap, and it is a console figure under the probe. The 2026-12-04 batch, which has both flash changes, timed the real path: 3,769 ms at 30 + 10, and 4,575 ms in session and 5,386 ms after a reset with a full vault (500 + 50), still over the cap. What the change does not remove is the lookups. The other two options on the table were asking LittleFS fewer times, which nobody has measured, and replacing it with a record store of the firmware's own, estimated from the 2026-11-28 bench image at a console unlock of about 2.6 to 2.8 s on this board. A review of the file system recommended keeping LittleFS, and I decided so on 2026-11-29. A store of the firmware's own would spend more flash blocks per credential and have lower capacity ceilings; for security it would add only hiding how full the vault is in a dump of a hardened board, a leak already accepted. What the firmware wants most from a store of its own, erasing what a write has superseded and bounding what remains in flash, can be had on LittleFS by sweeping its free blocks, which was tested on a PC against the real LittleFS. That leaves the lookups to be cut by asking LittleFS fewer times.

---

## What did turning off the file timestamps do?

LittleFS can store each file's modification time as an attribute, and the component's default, `CONFIG_LITTLEFS_USE_MTIME`, turns that on fleet-wide. Nothing in the firmware ever reads it. Each `lfs_getattr` in the count above is a lookup that a board without the option would not make, so turning it off looked like a free saving, and a first run on 2026-11-28 seemed to confirm it: a bench-only image with the option off took the Core2 v1.3's full-vault console unlock from 5,938 to 4,227 ms and the T-Deck's from 1,685 to 1,588 ms. The T-Deck pair came from a separate session. On the Core2 v1.3, only about 0.8 s of that 1.7 s difference was the option (139 `lfs_getattr` calls and 1,402 reads saved); the rest came with that image's cheaper flash reads, the code-placement effect above.

The image would only ever add one line to the firmware's configuration:

**The configuration line the experiment's image adds (not on main)**

```text
# CONFIG_LITTLEFS_USE_MTIME is not set
```

A second, cleaner run on 2026-11-29 separated the two things that line changes: the **image** that reads the vault, and the **vault** it reads, which carries the attribute or not depending on which image wrote it. Console unlocks under the same probe, medians of five, each the first after a reset, device clock, `_stress` images of main from before the Core2 v1.3 flash change:

**Unlock by how the vault was written and which image reads it (ms, measured)**

| Vault | Image on | Image off |
| --- | --- | --- |
| T-Deck, on | **1,689** | 1,589 |
| T-Deck, off | 1,848 | **1,707** |
| Core2, on | **4,625** | 4,224 |
| Core2, off | 5,755 | **5,087** |

Rows: how the vault was written, with the timestamps on or off. Columns: the image that reads it. Highlighted: today's setting of the option (a vault written with timestamps, read by an image with them) and the state a board shipped without them would settle in (both without). Full vault, console unlocks. The Core2 v1.3 figures predate its 80 MHz change; timestamps off and the 80 MHz flash were never measured together. The Core2 v1.3 vault written without timestamps measured the same on two separate fills of the same full vault.

On a vault written **with** the timestamps, the image without them helps: 0.1 s on the T-Deck, 0.4 s on the Core2 v1.3. On a vault written **without** them, both images read slower than on the other vault. So the fair comparison is the diagonal: a board shipped without the option would end up with vaults written without it, read by an image without it, and that settles at 5,087 ms on the Core2 v1.3 against 4,625 with the timestamps on (on the image before the 80 MHz flash change, and a different vault from the 4.67 s baseline above), about 0.46 s **slower**, and 1,707 against 1,689 ms on the T-Deck, about 0.02 s slower.

The probable cause, not isolated, is how LittleFS keeps its metadata. Without the attribute each write is smaller, so the file system compacts its metadata less often and each lookup walks a longer log: on the Core2 v1.3, a vault written without the timestamps needs 23,690 flash reads per unlock against 20,256 with them. The change was not merged and the option stays on fleet-wide. It is reported here as what it was: an experiment that did not turn out as expected, not a saving.

---

## What about a hardened board?

On a hardened StickS3, the vault sits on an encrypted partition, and the only unlock figures are older than the lean loop. They come from the bench's hardened image (Secure Boot under the bench key, flash encryption in development mode, device binding, a debug console), not a production `_secure` image. With the old 1,423 ms derivation and a plain read, console unlocks after a reset measured 3,025 to 3,323 ms at 30 + 10, 3,332 to 3,897 at 125 + 20 and 4,255 to 4,261 at 250 + 40 (from a freshly erased region, 2026-11-03; from the partition's production start, 0xFF written through the encrypted path and then a formatting boot, 2026-11-04 and 07: 3,060 to 4,329 ms; the two starts ran on different builds). Mapping the vault took each read from 79 to 80 µs down to 2 µs, and on the read bench of 2026-11-14 (bench builds of that image with the `[stress]` unflags), at 250 + 40:

**Hardened StickS3, 250 + 40: plain read vs memory map (measured, 2026-11-14)**

| Metric | Before | After | Change |
| --- | --- | --- | --- |
| Console path | 3.020 s | 2.008 s | -1.012 s (-33.5%), better |
| From the last digit | 5.676 s | 3.890 s | -1.786 s (-31.5%), better |

Both before the lean loop (1,423 ms of derivation). Console: median of five after a reset. From the last digit: three runs each on that day's PIN screen, 5.672 to 5.679 s plain and 3.886 to 3.894 s mapped, before the verify wait was reworked.

The hardened unit has not been re-measured with the lean loop. Subtracting the lean loop's 0.6 s from 2,008 ms gives an estimate, not a figure, and how much of the hardened unlock is LittleFS has never been split. The device binding of [post 012](https://jmrp.io/blog/012-device-bound-key-derivation/), `bindKek()`, an HKDF after the PBKDF2, is not inside the `kdf:` line: its cost falls in what comes after the derivation, and it has never been measured separately. No `_secure` image has been timed at all.

---

## What has been measured, and on what?

**Evidence, by label**

- **Measured**: the real and console paths on nine boards at 30 + 10 and with each board's full vault, in session and after a reset, on 2026-12-04 with ESP-IDF 6.1.1. As dated history, on ESP-IDF 6.0.3: the 30 + 10 batch of 2026-11-27; the full-vault real paths of 2026-11-14 and 15; the phase breakdown of 2026-11-14; the vault open alone; the LittleFS call counts of 2026-11-28; the Core2 v1.3 flash change and the timestamp experiment, reported on 2026-11-29; the hardened StickS3's plain and mapped reads; the T-Deck's clock-order and second-mount figures of 2026-11-29. All on `_stress` images, and the hardened StickS3's debug-console image at the production count.
- **Warning**: **Computed**: the split of each bar into derivation, console and screen; the StickS3's share of fixed waits; each board's margin to the cap; the diagonal of the timestamp grid.
- **Warning**: **Estimated**: the 2026-07-06 unlock estimates at the old counts, and the July derivation times at the new ones; about 2.6 to 2.8 s for the Core2 v1.3 with a record store of its own (from the 2026-11-28 bench image); the hardened unlock with the lean loop.
- **Optional**: **Not measured**: a `_release` or `_secure` image (the hardened bench StickS3 was last timed on 14 November, on a debug image of that posture and the older derivation, so not with the lean loop); a person's finger on any board (every input was injected over the serial line, which lies inside the timed window on the touch and keyboard boards); a vault written in one pass, or one in use, on this firmware; an unlock after the production sleep rather than a software reset; what each change since 27 November took off on its own, except the T-Deck's clock order and single console mount, the Core2 v1.3's flash change (29 November, on the console) and the key derivation across the ESP-IDF move; the Core2 v1.3 with LittleFS's modification time off, from the PIN screen; the Core2 v1.3's landed image (read path in IRAM, 80 MHz flash) on a board updated by OTA; Quad I/O delivered by OTA, or on any board or batch but the Core2 v1.3's of 29 November; the device binding's own cost.

The 4 December batch is the first fleet-wide timing of main with the changes that reached it after the 27 November batch (the T-Deck's clock order and the console's single mount, and the Core2 v1.3's flash, were each timed on their own on 29 November). On the PIN screen's path they are the clock raised before the mount on every board, the secret-epoch check every unlock now makes before the derivation (it came with the PIN-change rotation), the attempt counter written in one NVS commit instead of four, a sweep on mount of an interrupted `meta.bin` temporary file, the Kleidos mark drawn in one pass, the brand logos redrawn and stored in a smaller layout, a new Pass tab icon, the Core2 v1.3's flash at 80 MHz with its plain read path in IRAM, and the move to ESP-IDF 6.1.1 with LittleFS 1.23.4. The console's unlock also stopped mounting twice: it now reads the lists on its own mount, as the PIN screen always did.

---

## The honest costs and limits

**What you accept with this design**

- **Warning**: **0.8 s of every dial unlock is pacing**, not work ([why](#why-08-s-of-every-dial-unlock-is-fixed-and-why-it-stays)). Shortening it would make the unlock faster and the screen harder to trust.
- **Warning**: **The attempt counter is written to NVS before every derivation.** A power cut mid-unlock costs an attempt; it never grants a free one.
- **Warning**: **The release image is untimed.** Every figure is from a debug-console image with debug logging and the unlock trace, and a release image differs in more than that.
- **Warning**: **The classic ESP32 has no engine path in production**, so its unlocks pay about 1.5 s of software SHA-256.
- **Warning**: **The Core2 v1.3 cannot map its vault**, and its LittleFS lookups remain its largest cost after the flash change.
- **Warning**: **The CoreInk's unlock depends on which refresh the e-paper does**, by up to about 2 s.
- **Warning**: **LittleFS stays**, and so do its per-file timestamps ([why](#what-did-turning-off-the-file-timestamps-do)). A review of the file system recommended keeping it, and I decided so on 2026-11-29: a store of the firmware's own would cost more blocks per credential, and wiping superseded data can be done on LittleFS by sweeping its free blocks.
- **The work factor stays at 175,000 and 40,000** while the whole unlock is held to 3 s; raising it is a separate decision against that cap.

---

## Wrap: a budget for the pipeline, not for one phase

In July the unlock budget was a sentence about PBKDF2: pick the count that takes about 2 s. That made sense while the derivation was, by the July estimate, more than four fifths of the unlock. By November the S3's derivation was a fraction of a second, and the budget had to become a statement about the whole path, which is why the cap is now 3 s from a correct PIN to the list.

Measured that way, the unlock stops being a cryptography problem. On the S3 boards the deliberate screen pacing is now the same order of time as the derivation. The classic boards pay about 1.5 s for a software hash, which by itself still leaves room under the cap. The two that miss the cap with either vault miss it for reasons a faster KDF would never touch: an e-paper panel that chooses its own refresh, and a vault too large for its chip's memory window, read through a file system that spends nine tenths of its time looking for files. The fix for the second one so far was to make the flash faster, and the one idea that looked like a free saving, dropping the file timestamps, made the steady state slower. On the batch of 4 December, seven of the nine boards unlock within 3 s at 30 + 10 and six with a full vault; the StickC Plus2 misses it with a full vault, by 37 ms in session and 157 ms after a reset, and the Core2 v1.3 and the CoreInk miss it with either.

