Loading...
Searching...
No Matches

Definitions for CTAP flash memory helper functions. More...

Detailed Description

Definitions for CTAP flash memory helper functions.

Author
Nils Ollrogge nils..nosp@m.ollr.nosp@m.ogge@.nosp@m.fu-b.nosp@m.erlin.nosp@m..de

Definition in file ctap_mem.h.

#include <stdint.h>
#include "fido2/ctap/ctap.h"
#include "periph/flashpage.h"
+ Include dependency graph for ctap_mem.h:

Go to the source code of this file.

Macros

#define CONFIG_FIDO2_CTAP_NUM_FLASHPAGES   4
 Default amount of flashpages to use.
 
#define CTAP_FLASH_ALIGN_PAD(x)
 Calculate padding needed to align struct size for saving to flash.
 
#define CTAP_FLASH_RK_SZ
 Resident key size with alignment padding.
 
#define CTAP_FLASH_STATE_SZ
 State struct size with alignment padding.
 
#define CTAP_FLASH_MAX_NUM_RKS
 Max amount of resident keys that can be stored on device.
 
#define CTAP_FLASH_MIN_SECTOR_SZ   _MAX(CTAP_FLASH_STATE_SZ, CTAP_FLASH_RK_SZ)
 Minimum flash sector size needed to hold CTAP related data.
 
#define CTAP_FLASH_PAGES_PER_SECTOR   ((CTAP_FLASH_MIN_SECTOR_SZ / FLASHPAGE_SIZE) + 1)
 Pages per sector needed.
 
#define CTAP_FLASH_RK_OFF   0x1
 Offset of flashpage for storing resident keys.
 

Functions

int fido2_ctap_mem_init (void)
 Initialize memory helper.
 
int fido2_ctap_mem_read (void *buf, uint32_t page, uint32_t offset, uint32_t len)
 Read from flash memory.
 
int fido2_ctap_mem_erase_flash (void)
 Erase all flashpages containing CTAP data.
 
int fido2_ctap_mem_read_state_from_flash (ctap_state_t *state)
 Read authenticator state from flash.
 
int fido2_ctap_mem_write_state_to_flash (ctap_state_t *state)
 Write authenticator state to flash.
 
int fido2_ctap_mem_read_rk_from_flash (ctap_resident_key_t *key, uint8_t *rp_id_hash, uint32_t *addr)
 Find resident credential for rp_id_hash in flash.
 
int fido2_ctap_mem_write_rk_to_flash (ctap_resident_key_t *rk)
 Write resident credential to flash.
 
#define _MAX(a, b)   ((a) > (b) ? (a) : (b))
 MAX function for internal use.