Skip to main content

Module gendig

Module gendig 

Source
Expand description

GenDig command.

Computes a digest combining the contents of a slot, the OTP, or the config zone with the current TempKey and stores the result back in TempKey. The result is what subsequent commands like an encrypted Write or PrivWrite use as the shared secret with the host.

In this project’s provisioning flow:

  1. The host calls crate::AteccChannel::nonce_random to establish a shared TempKey value between host and chip.
  2. The host calls AteccChannel::gendig with the I/O Protection Key slot (slot 8). The chip computes SHA256(IOKey || OpCode || Mode || KeyId || SN || padding || TempKey) and replaces TempKey with the result. The host computes the same digest off-chip.
  3. The host XORs the new TempKey with the plaintext to write, appends a MAC, and sends an encrypted Write or PrivWrite.

The driver does not orchestrate the host-side digest derivation: that is a service-layer concern.

Reference: CryptoAuthLib lib/calib/calib_gendig.c, constants GENDIG_ZONE_CONFIG (0x00), GENDIG_ZONE_OTP (0x01), GENDIG_ZONE_DATA (0x02).

Enums§

GenDigZone
param1 zone bits.