Skip to main content

Module nonce

Module nonce 

Source
Expand description

Nonce command.

Loads bytes into the chip’s TempKey or MsgDigBuf register. The ATECC608B supports several modes, of which two are useful from the host side:

  • Random (mode 0): the host sends 20 bytes of input (NumIn), the chip mixes them with its TRNG output, hashes the result, and stores the hash in TempKey. The chip returns the 32-byte TRNG value (NumOut) that was mixed in, so the host can reconstruct TempKey if needed (this is what CheckMac and GenDig depend on).

  • Passthrough (mode 3): the host sends 32 bytes that are stored verbatim in TempKey or in MsgDigBuf. No mixing, no RNG. The chip responds with a single status byte. This is the mode used to load a message digest into TempKey before calling Sign.

Mode 1 (“no RNG re-generation”) and the ATECC608-specific Mode 2 variants are intentionally omitted: nothing in the project’s workflow needs them. They can be added later as additional methods rather than expanded as parameters on the existing ones, to keep each entry point unambiguous.

Reference: CryptoAuthLib lib/calib/calib_nonce.c, constants NONCE_MODE_SEED_UPDATE (0x00), NONCE_MODE_PASSTHROUGH (0x03), NONCE_MODE_TARGET_TEMPKEY (0x00), NONCE_MODE_TARGET_MSGDIGBUF (0x40), NONCE_NUMIN_SIZE (20), NONCE_NUMIN_SIZE_PASSTHROUGH (32).

Enums§

NonceTarget
Destination register for a passthrough Nonce.

Constants§

NONCE_MODE_PASSTHROUGH 🔒
param1 low bits for mode 3 (passthrough).
NONCE_MODE_RANDOM 🔒
param1 low bits for mode 0 (random nonce, seed update).
NONCE_NUMIN_SIZE
Size of the NumIn block in a random Nonce command.
NONCE_NUMOUT_SIZE
Size of the NumOut block returned by a random Nonce command.
NONCE_PASSTHROUGH_SIZE
Size of the data field in a passthrough Nonce command.
NONCE_TARGET_MSGDIGBUF 🔒
param1 bit 6 set selects MsgDigBuf as the passthrough target.
NONCE_TARGET_TEMPKEY 🔒
param1 bit 6 cleared selects TempKey as the passthrough target.