17#ifndef MBED_SECURESTORE_H
18#define MBED_SECURESTORE_H
20#if !defined(MBEDTLS_CONFIG_FILE)
23#include MBEDTLS_CONFIG_FILE
26#include "device_key/DeviceKey.h"
28#define SECURESTORE_ENABLED 1
31#if !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CIPHER_MODE_CTR) || !defined(MBEDTLS_CMAC_C) || !DEVICEKEY_ENABLED
32#undef SECURESTORE_ENABLED
33#define SECURESTORE_ENABLED 0
36#if SECURESTORE_ENABLED || defined(DOXYGEN_ONLY)
41#include "rtos/Mutex.h"
122 virtual int set(
const char *key,
const void *buffer,
size_t size, uint32_t create_flags);
145 virtual int get(
const char *key,
void *buffer,
size_t buffer_size,
size_t *actual_size = NULL,
202 virtual int set_start(set_handle_t *handle,
const char *key,
size_t final_data_size, uint32_t create_flags);
219 virtual int set_add_data(set_handle_t handle,
const void *value_data,
size_t data_size);
276#if !defined(DOXYGEN_ONLY)
279 struct inc_set_handle_t;
282 bool _is_initialized;
283 KVStore *_underlying_kv, *_rbp_kv;
285 inc_set_handle_t *_ih;
286 uint8_t *_scratch_buf;
300 int do_get(
const char *key,
void *buffer,
size_t buffer_size,
size_t *actual_size = NULL,
virtual int get_info(const char *key, info_t *info)
Get information of a given key.
virtual int iterator_open(iterator_t *it, const char *prefix=NULL)
Start an iteration over KVStore keys.
virtual int remove(const char *key)
Remove a KVStore item, given key.
virtual int iterator_next(iterator_t it, char *key, size_t key_size)
Get next key in iteration.
SecureStore(KVStore *underlying_kv, KVStore *rbp_kv=0)
Class constructor.
virtual int set_finalize(set_handle_t handle)
Finalize an incremental KVStore set sequence.
virtual int set(const char *key, const void *buffer, size_t size, uint32_t create_flags)
Set one KVStore item, given key and value.
virtual int iterator_close(iterator_t it)
Close iteration.
virtual int set_start(set_handle_t *handle, const char *key, size_t final_data_size, uint32_t create_flags)
Start an incremental KVStore set sequence.
virtual int deinit()
Deinitialize SecureStore class, free handles and memory allocations.
virtual int reset()
Reset KVStore contents (clear all keys) Warning: This function is not thread safe.
virtual int get(const char *key, void *buffer, size_t buffer_size, size_t *actual_size=NULL, size_t offset=0)
Get one KVStore item, given key.
virtual ~SecureStore()
Class destructor.
virtual int set_add_data(set_handle_t handle, const void *value_data, size_t data_size)
Add data to incremental KVStore set sequence.
virtual int init()
Initialize SecureStore class.
The Mutex class is used to synchronize the execution of threads.
Configuration options (set of defines)
Entropy context structure.