pull certificate from flash page

This commit is contained in:
Conor Patrick
2019-10-27 07:51:02 -04:00
parent b7d74cc99f
commit b4f59ec355
5 changed files with 35 additions and 17 deletions

View File

@ -32,8 +32,8 @@
#define APPLICATION_START_ADDR (0x08000000 + ((APPLICATION_START_PAGE)*PAGE_SIZE))
// where attestation key is located
#define ATTESTATION_KEY_PAGE (PAGES - 15)
#define ATTESTATION_KEY_ADDR (0x08000000 + ATTESTATION_KEY_PAGE*PAGE_SIZE)
#define ATTESTATION_PAGE (PAGES - 15)
#define ATTESTATION_PAGE_ADDR (0x08000000 + ATTESTATION_PAGE*PAGE_SIZE)
// End of application code. Leave some extra room for future data storage.
// NOT included in application
@ -48,7 +48,6 @@
#define BOOT_VERSION_ADDR (0x08000000 + BOOT_VERSION_PAGE*FLASH_PAGE_SIZE + 8)
#define LAST_PAGE (APPLICATION_END_PAGE-1)
struct flash_memory_st{
uint8_t bootloader[APPLICATION_START_PAGE*2*1024];
uint8_t application[(APPLICATION_END_PAGE-APPLICATION_START_PAGE)*2*1024-8];
@ -65,5 +64,18 @@ typedef struct flash_memory_st flash_memory_st;
#include <assert.h>
static_assert(sizeof(flash_memory_st) == 256*1024, "Data structure doesn't match flash size");
#define ATTESTATION_FORMAT 0x5A01
struct flash_attestation_page{
uint8_t attestation_key[32];
uint16_t attestation_format;
uint16_t attestation_cert_size;
uint8_t attestation_cert[2048 - 32 - 2 - 2];
} __attribute__((packed));
typedef struct flash_attestation_page flash_attestation_page;
static_assert(sizeof(flash_attestation_page) == 2048, "Data structure doesn't match flash size");
#endif