SEcube
SEcube Open Source Library - Device
se3_keys.h
Go to the documentation of this file.
1 
7 #pragma once
8 #include "se3_flash.h"
9 
22 typedef struct se3_flash_key_ {
23  uint32_t id;
24  uint32_t validity;
25  uint16_t data_size;
26  uint16_t name_size;
27  uint8_t* data;
28  uint8_t* name;
30 
32 enum {
33  SE3_FLASH_KEY_OFF_ID = 0,
34  SE3_FLASH_KEY_OFF_VALIDITY = 4,
35  SE3_FLASH_KEY_OFF_DATA_LEN = 8,
36  SE3_FLASH_KEY_OFF_NAME_LEN = 10,
37  SE3_FLASH_KEY_OFF_NAME_AND_DATA = 12,
38 
39  SE3_FLASH_KEY_SIZE_HEADER = SE3_FLASH_KEY_OFF_NAME_AND_DATA
40 };
41 
49 bool se3_key_find(uint32_t id, se3_flash_it* it);
50 
59 
71 bool se3_key_new(se3_flash_it* it, se3_flash_key* key);
72 
81 
90 
98 void se3_key_read_data(se3_flash_it* it, uint16_t data_size, uint8_t* data);
99 
111 
112 
113 #define SE3_TYPE_KEY 100
114 
115 
bool se3_key_equal(se3_flash_it *it, se3_flash_key *key)
Check if key is equal.
Definition: se3_keys.c:68
void se3_key_read_data(se3_flash_it *it, uint16_t data_size, uint8_t *data)
Read data from key node.
Definition: se3_keys.c:94
Flash node iterator structure.
Definition: se3_flash.h:34
bool se3_key_remove(se3_flash_it *it)
Remove a key.
Definition: se3_keys.c:31
Flash management.
Flash key structure.
Definition: se3_keys.h:22
bool se3_key_find(uint32_t id, se3_flash_it *it)
Find a key.
Definition: se3_keys.c:17
bool se3_key_write(se3_flash_it *it, se3_flash_key *key)
Write key data.
Definition: se3_keys.c:99
bool se3_key_new(se3_flash_it *it, se3_flash_key *key)
Add a new key.
Definition: se3_keys.c:40
struct se3_flash_key_ se3_flash_key
Flash key structure.
void se3_key_read(se3_flash_it *it, se3_flash_key *key)
Read a key.
Definition: se3_keys.c:53