fw: Rename partition digest to checksum

- Rename functions, defines, et c to indicate that it's a checksum
  over the partition, not necessarily a cryptographic hash digest even
  though we use a version of BLAKE2s.

- Add comments describing where the checksum is stored and what it is
  used for.

Co-authored-by: Mikael Ågren <mikael@tillitis.se>
This commit is contained in:
Michael Cardell Widerkrantz 2025-04-25 16:24:33 +02:00
parent 106a7a5613
commit 66ea8df1d9
No known key found for this signature in database
GPG key ID: D3DB3DDF57E704E5
2 changed files with 16 additions and 12 deletions

View file

@ -46,7 +46,7 @@
#define SIZE_STORAGE_AREA 0x20000UL // 128KiB
#define N_STORAGE_AREA 4
#define PART_DIGEST_SIZE 16
#define PART_CHECKSUM_SIZE 16
enum part_status {
PART_SLOT0_INVALID = 1,
@ -70,6 +70,8 @@ enum part_status {
/* - 1 byte status. */
/* - 16 bytes random nonce. */
/* - 16 bytes authentication tag. */
/**/
/*- Checksum over the above */
struct auth_metadata {
uint8_t nonce[16];
@ -99,7 +101,7 @@ struct partition_table {
struct partition_table_storage {
struct partition_table table;
uint8_t check_digest[PART_DIGEST_SIZE];
uint8_t checksum[PART_CHECKSUM_SIZE]; // Helps detect flash problems
} __attribute__((packed));
enum part_status part_get_status(void);