Mudr-209

/* Compute CRC over header+payload (excluding CRC field) */ hdr->crc32 = crc32_compute(record_buf, sizeof(mudr209_hdr_t) + len);

/* 3. Encrypt & MAC ----------------------------------------------------------*/ static void protect_record(void) MUDR-209

/* 2. Assemble record -------------------------------------------------------*/ static void assemble_record(const uint8_t *payload, uint32_t len) /* Compute CRC over header+payload (excluding CRC field)

flash_append(record_buf, sizeof(mudr209_hdr_t)+hdr->payload_sz); crc32 = crc32_compute(record_buf

static uint8_t record_buf[RECORD_MAX]; static uint32_t record_seq = 0;

/* Public API ---------------------------------------------------------------*/ void mudr209_log(const uint8_t *payload, uint32_t len)

uint8_t leaf_hash[SHA384_DIGEST_LEN]; sha384_hash(record_buf, sizeof(mudr209_hdr_t)+hdr->payload_sz, leaf_hash); merkle_tree_append(leaf_hash);