Skip to main content

Module slots

Module slots 

Source
Expand description

Slot-mapping convention used by this firmware.

Slot allocation is project policy, not a chip primitive. The same chip could be programmed differently. Putting the convention in one place keeps it visible and reviewable.

The authoritative reference is docs/config-zone-layout.md. This module exposes named constants for the slots the service code references; it must stay in sync with the configuration zone the chip is provisioned with.

SlotTypePurposePolicy summary
0ECC P-256Primary identity, GenKey-onlyReqAuth=1, AuthKey=5 (PIN-gated). PrivWrite forbidden.
1ECC P-256Secondary identity, GenKey-onlySame as slot 0.
2-4ECC P-256User keys, GenKey + encrypted importPIN-gated. Lockable individually.
5Data 32 BPIN hash SHA256(PIN || salt)EncryptWrite via slot 8. LimitedUse via Counter0 (cap 5).
6Data 32 BPUK hash SHA256(PUK || salt)EncryptWrite via slot 8. LimitedUse via Counter1 (cap 10).
7ECC P-256User key, GenKey + encrypted importSame as slots 2-4.
8Data 32 BI/O Protection master keyWritten pre-data-lock, immutable after. Never written again.
9-15ECC P-256Reserve for V2Same configuration as slots 2-4/7, kept unused for now.

ยงNotes

  • Slots 2-4 and 7 all share the same configuration as user-rotatable ECC keys with PIN gating. They are interchangeable from the policy point of view. Project conventions may earmark them for specific roles in the future.
  • Slots 9-15 are configured exactly like user slots so they can be used in a later iteration without re-provisioning. Treat them as reserve, do not rely on their contents until a future revision explicitly assigns them.

Constantsยง

PIN_DEFAULT ๐Ÿ”’
Default PIN at factory provisioning. Must be changed on first use.
PIN_MAX_RETRIES ๐Ÿ”’
Size of one PIN batch on Counter0. The โ€œeffective triesโ€ available to the user inside a batch is PIN_MAX_RETRIES - 1 (= 4), because refresh_counter_batch lands count one past the next multiple so that count % PIN_MAX_RETRIES == 0 is an unambiguous saturation signal usable by emergency_reset. See service::retries_remaining.
PUK_MAX_RETRIES ๐Ÿ”’
Size of one PUK batch on Counter1. Effective tries inside a batch is PUK_MAX_RETRIES - 1 (= 9), for the same reason as PIN_MAX_RETRIES.
SLOT_IO_KEY ๐Ÿ”’
Slot holding the I/O protection master key.
SLOT_PIN_HASH ๐Ÿ”’
Slot holding the SHA-256 hash of the PIN.
SLOT_PUK_HASH ๐Ÿ”’
Slot holding the SHA-256 hash of the PUK.