mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-01 11:16:06 -04:00
fw: Add checksum to partition table
Refuse to boot if blake2s digest over the partition table does not match digest stored on flash
This commit is contained in:
parent
75dd726998
commit
f24c7ea515
11 changed files with 207 additions and 73 deletions
|
@ -43,6 +43,8 @@
|
|||
#define SIZE_STORAGE_AREA 0x20000UL // 128KiB
|
||||
#define N_STORAGE_AREA 4
|
||||
|
||||
#define PART_DIGEST_SIZE 16
|
||||
|
||||
/* Partition Table */
|
||||
/*- Table header */
|
||||
/* - 1 bytes Version */
|
||||
|
@ -88,7 +90,12 @@ struct partition_table {
|
|||
struct app_storage_area app_storage[N_STORAGE_AREA];
|
||||
} __attribute__((packed));
|
||||
|
||||
int part_table_read(struct partition_table *part_table);
|
||||
int part_table_write(struct partition_table *part_table);
|
||||
struct partition_table_storage {
|
||||
struct partition_table table;
|
||||
uint8_t check_digest[PART_DIGEST_SIZE];
|
||||
} __attribute__((packed));
|
||||
|
||||
int part_table_read(struct partition_table_storage *storage);
|
||||
int part_table_write(struct partition_table_storage *storage);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue