Description
Certain delays between last message FIFO write and HMAC_CMD_HASH_STOP_BIT and HMAC_CMD_HASH_PROCESS commands cause the HMAC.STATUS register to get stuck with hmac_idle bit cleared.
Reproduction steps (pseudo-code):
status = msg_fifo_write(data, len - leftover_len);
// delay here, even this small is enough
for (size_t i = 0; i < 10; i = launder32(i + 1))
;
// Time to tell HMAC HWIP to stop, because we do not have enough message
// bytes for another round.
uint32_t cmd_reg =
bitfield_bit32_write(HMAC_CMD_REG_RESVAL, HMAC_CMD_HASH_STOP_BIT, 1);
abs_mmio_write32(kHmacBaseAddr + HMAC_CMD_REG_OFFSET, cmd_reg);
// Wait for HMAC HWIP operation to be completed.
// In the error condition, this function will block forever.
status = hmac_idle_wait();
During regular operating conditions, interrupts can fire at any time, causing delays similar to what is captured in the reproduction steps. This may cause hangs in the field that will be very difficult to debug / root cause.
Issue reported by @vsukhoml.
CC: @vogelpi, @martin-velay, @johannheyszl, @gdessouky