Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

MemorySecurityDb Class Reference

MemorySecurityDb Class Reference

Naive memory implementation for verification. More...

#include <MemorySecurityDb.h>

Inherits ble::pal::SecurityDb.

Public Types

typedef void * entry_handle_t
 Opaque type representing a handle to a database entry.

Public Member Functions

virtual const
SecurityDistributionFlags_t
get_distribution_flags (entry_handle_t entry_handle)
 Return immediately security flags associated to a db entry.
virtual void set_distribution_flags (entry_handle_t entry_handle, const SecurityDistributionFlags_t &flags)
 Set the distribution flags of the DB entry.
virtual void get_entry_local_keys (SecurityEntryKeysDbCb_t cb, entry_handle_t entry_handle, const ediv_t &ediv, const rand_t &rand)
 Retrieve stored LTK based on passed in EDIV and RAND values.
virtual void get_entry_local_keys (SecurityEntryKeysDbCb_t cb, entry_handle_t entry_handle)
 Retrieve stored LTK generated during secure connections pairing.
virtual void set_entry_local_ltk (entry_handle_t entry_handle, const ltk_t &ltk)
 Save new local LTK for a connection.
virtual void set_entry_local_ediv_rand (entry_handle_t entry_handle, const ediv_t &ediv, const rand_t &rand)
 Update EDIV and RAND used to identify the LTK.
virtual void get_entry_peer_csrk (SecurityEntryCsrkDbCb_t cb, entry_handle_t entry_handle)
 Return asynchronously the peer signing key through a callback so that signed packets can be verified.
virtual void get_entry_peer_keys (SecurityEntryKeysDbCb_t cb, entry_handle_t entry_handle)
 Return asynchronously the peer encryption key through a callback so that encryption can be enabled.
virtual void set_entry_peer_ltk (entry_handle_t entry_handle, const ltk_t &ltk)
 Save new LTK received from the peer.
virtual void set_entry_peer_ediv_rand (entry_handle_t entry_handle, const ediv_t &ediv, const rand_t &rand)
 Update EDIV and RAND used to identify the LTK sent by the peer.
virtual void set_entry_peer_irk (entry_handle_t entry_handle, const irk_t &irk)
 Update IRK for this connection.
virtual void set_entry_peer_bdaddr (entry_handle_t entry_handle, bool address_is_public, const address_t &peer_address)
 Update the identity address of the peer.
virtual void set_entry_peer_csrk (entry_handle_t entry_handle, const csrk_t &csrk)
 Update peer signing key.
virtual const csrk_t * get_local_csrk ()
 Return local signing key used for signing packets.
virtual void set_local_csrk (const csrk_t &csrk)
 Update local signing key.
virtual const public_key_coord_tget_public_key_x ()
 Return local public key.
virtual const public_key_coord_tget_public_key_y ()
 Return local public key.
virtual void set_public_key (const public_key_coord_t &public_key_x, const public_key_coord_t &public_key_y)
 Set local public key.
virtual entry_handle_t open_entry (BLEProtocol::AddressType_t peer_address_type, const address_t &peer_address)
 Open a database entry.
virtual void close_entry (entry_handle_t entry_handle)
 Close a connection entry.
virtual void remove_entry (const address_t peer_identity_address)
 Remove entry for this peer from NVM.
virtual void clear_entries ()
 Remove all entries from the security DB.
virtual void get_whitelist (WhitelistDbCb_t cb,::Gap::Whitelist_t *whitelist)
 Asynchronously return the whitelist stored in NVM through a callback.
virtual void generate_whitelist_from_bond_table (WhitelistDbCb_t cb,::Gap::Whitelist_t *whitelist)
 Asynchronously return a whitelist through a callback, generated from the bond table.
virtual void set_whitelist (const ::Gap::Whitelist_t &whitelist)
 Update the whitelist stored in NVM by replacing it with new one.
virtual void add_whitelist_entry (const address_t &address)
 Add a new entry to the whitelist in the NVM.
virtual void remove_whitelist_entry (const address_t &address)
 Remove whitelist entry from NVM.
virtual void clear_whitelist ()
 Remove all whitelist entries stored in the NVM.
virtual void restore ()
 Read values from storage.
virtual void sync ()
 Flush all values which might be stored in memory into NVM.
virtual void set_restore (bool reload)
 Toggle whether values should be preserved across resets.

Detailed Description

Naive memory implementation for verification.

Definition at line 26 of file MemorySecurityDb.h.


Member Typedef Documentation

typedef void* entry_handle_t [inherited]

Opaque type representing a handle to a database entry.

Definition at line 98 of file SecurityDb.h.


Member Function Documentation

virtual void add_whitelist_entry ( const address_t address ) [virtual]

Add a new entry to the whitelist in the NVM.

Parameters:
[in]addressnew whitelist entry

Implements SecurityDb.

Definition at line 347 of file MemorySecurityDb.h.

virtual void clear_entries (  ) [virtual]

Remove all entries from the security DB.

Implements SecurityDb.

Definition at line 314 of file MemorySecurityDb.h.

virtual void clear_whitelist (  ) [virtual]

Remove all whitelist entries stored in the NVM.

Implements SecurityDb.

Definition at line 351 of file MemorySecurityDb.h.

virtual void close_entry ( entry_handle_t  db_entry ) [virtual]

Close a connection entry.

Parameters:
[in]db_entrythis handle will be freed up from the security db.

Implements SecurityDb.

Definition at line 293 of file MemorySecurityDb.h.

virtual void generate_whitelist_from_bond_table ( WhitelistDbCb_t  cb,
::Gap::Whitelist_t whitelist 
) [virtual]

Asynchronously return a whitelist through a callback, generated from the bond table.

Parameters:
[in]cbcallback that will receive the whitelist
[in]whitelistpreallocated whitelist that will be filled in

Implements SecurityDb.

Definition at line 327 of file MemorySecurityDb.h.

virtual const SecurityDistributionFlags_t* get_distribution_flags ( entry_handle_t  db_entry ) [virtual]

Return immediately security flags associated to a db entry.

Parameters:
[in]db_entryEntry of the database queried.
Returns:
pointer to the flags or NULL if the entry do not have any associated flags.

Implements SecurityDb.

Definition at line 54 of file MemorySecurityDb.h.

virtual void get_entry_local_keys ( SecurityEntryKeysDbCb_t  cb,
entry_handle_t  db_entry 
) [virtual]

Retrieve stored LTK generated during secure connections pairing.

Parameters:
[in]cbcallback that will receive the LTK struct
[in]db_entryhandle of the entry being queried.

Implements SecurityDb.

Definition at line 103 of file MemorySecurityDb.h.

virtual void get_entry_local_keys ( SecurityEntryKeysDbCb_t  cb,
entry_handle_t  db_entry,
const ediv_t ediv,
const rand_t &  rand 
) [virtual]

Retrieve stored LTK based on passed in EDIV and RAND values.

Parameters:
[in]cbcallback that will receive the LTK struct
[in]db_entryhandle of the entry being queried.
[in]edivone of the values used to identify the LTK
[in]randone of the values used to identify the LTK

Implements SecurityDb.

Definition at line 84 of file MemorySecurityDb.h.

virtual void get_entry_peer_csrk ( SecurityEntryCsrkDbCb_t  cb,
entry_handle_t  db_entry 
) [virtual]

Return asynchronously the peer signing key through a callback so that signed packets can be verified.

Parameters:
[in]cbcallback which will receive the key
[in]db_entryhandle of the entry being queried.

Implements SecurityDb.

Definition at line 149 of file MemorySecurityDb.h.

virtual void get_entry_peer_keys ( SecurityEntryKeysDbCb_t  cb,
entry_handle_t  db_entry 
) [virtual]

Return asynchronously the peer encryption key through a callback so that encryption can be enabled.

Parameters:
[in]cbcallback which will receive the key
[in]db_entryhandle of the entry being queried.

Implements SecurityDb.

Definition at line 161 of file MemorySecurityDb.h.

virtual const csrk_t* get_local_csrk (  ) [virtual]

Return local signing key used for signing packets.

Returns:
pointer to local CSRK

Implements SecurityDb.

Definition at line 235 of file MemorySecurityDb.h.

virtual const public_key_coord_t& get_public_key_x (  ) [virtual]

Return local public key.

Returns:
ref to x component of public key

Implements SecurityDb.

Definition at line 245 of file MemorySecurityDb.h.

virtual const public_key_coord_t& get_public_key_y (  ) [virtual]

Return local public key.

Returns:
ref to y component of public key

Implements SecurityDb.

Definition at line 249 of file MemorySecurityDb.h.

virtual void get_whitelist ( WhitelistDbCb_t  cb,
::Gap::Whitelist_t whitelist 
) [virtual]

Asynchronously return the whitelist stored in NVM through a callback.

Function takes ownership of the memory. The whitelist and the ownership will be returned in the callback.

Parameters:
[in]cbcallback that will receive the whitelist
[in]whitelistpreallocated whitelist that will be filled in

Implements SecurityDb.

Definition at line 322 of file MemorySecurityDb.h.

virtual entry_handle_t open_entry ( BLEProtocol::AddressType_t  peer_address_type,
const address_t peer_address 
) [virtual]

Open a database entry.

While this entry is opened; it can be queried and updated with the help of the database setter and getter functions.

Parameters:
[in]peer_address_typetype of address
[in]peer_addressthis address will be used to locate an existing entry.
Returns:
A handle to the entry.

Implements SecurityDb.

Definition at line 263 of file MemorySecurityDb.h.

virtual void remove_entry ( const address_t  peer_identity_address ) [virtual]

Remove entry for this peer from NVM.

Parameters:
[in]peer_identity_addresspeer address that no longer needs NVM storage.

Implements SecurityDb.

Definition at line 301 of file MemorySecurityDb.h.

virtual void remove_whitelist_entry ( const address_t address ) [virtual]

Remove whitelist entry from NVM.

Parameters:
[in]addressentry to be removed

Implements SecurityDb.

Definition at line 349 of file MemorySecurityDb.h.

virtual void restore (  ) [virtual]

Read values from storage.

Implements SecurityDb.

Definition at line 355 of file MemorySecurityDb.h.

virtual void set_distribution_flags ( entry_handle_t  entry_handle,
const SecurityDistributionFlags_t flags 
) [virtual]

Set the distribution flags of the DB entry.

Implements SecurityDb.

Definition at line 68 of file MemorySecurityDb.h.

virtual void set_entry_local_ediv_rand ( entry_handle_t  db_entry,
const ediv_t ediv,
const rand_t &  rand 
) [virtual]

Update EDIV and RAND used to identify the LTK.

Parameters:
[in]db_entryhandle of the entry being updated.
[in]edivnew EDIV value
[in]randnew RAND value

Implements SecurityDb.

Definition at line 133 of file MemorySecurityDb.h.

virtual void set_entry_local_ltk ( entry_handle_t  db_entry,
const ltk_t &  ltk 
) [virtual]

Save new local LTK for a connection.

Parameters:
[in]db_entryhandle of the entry being updated.
[in]ltkthe new LTK, if the device is slave, this is the LTK that will be used when link is encrypted

Implements SecurityDb.

Definition at line 122 of file MemorySecurityDb.h.

virtual void set_entry_peer_bdaddr ( entry_handle_t  db_entry,
bool  address_is_public,
const address_t peer_address 
) [virtual]

Update the identity address of the peer.

Parameters:
[in]db_entryhandle of the entry being updated.
[in]address_is_publicis the identity address public or private
[in]peer_addressthe new address

Implements SecurityDb.

Definition at line 210 of file MemorySecurityDb.h.

virtual void set_entry_peer_csrk ( entry_handle_t  db_entry,
const csrk_t &  csrk 
) [virtual]

Update peer signing key.

Parameters:
[in]db_entryhandle of the entry being updated.
[in]csrknew CSRK value

Implements SecurityDb.

Definition at line 222 of file MemorySecurityDb.h.

virtual void set_entry_peer_ediv_rand ( entry_handle_t  db_entry,
const ediv_t ediv,
const rand_t &  rand 
) [virtual]

Update EDIV and RAND used to identify the LTK sent by the peer.

Parameters:
[in]db_entryhandle of the entry being updated.
[in]edivnew EDIV value
[in]randnew RAND value

Implements SecurityDb.

Definition at line 186 of file MemorySecurityDb.h.

virtual void set_entry_peer_irk ( entry_handle_t  db_entry,
const irk_t irk 
) [virtual]

Update IRK for this connection.

Parameters:
[in]db_entryhandle of the entry being updated.
[in]irknew IRK value

Implements SecurityDb.

Definition at line 199 of file MemorySecurityDb.h.

virtual void set_entry_peer_ltk ( entry_handle_t  db_entry,
const ltk_t &  ltk 
) [virtual]

Save new LTK received from the peer.

Parameters:
[in]db_entryhandle of the entry being updated.
[in]ltkthe new LTK, if the peer device is slave, this is the LTK that will be used when link is encrypted

Implements SecurityDb.

Definition at line 175 of file MemorySecurityDb.h.

virtual void set_local_csrk ( const csrk_t &  csrk ) [virtual]

Update local signing key.

Parameters:
[in]csrknew CSRK value

Implements SecurityDb.

Definition at line 239 of file MemorySecurityDb.h.

virtual void set_public_key ( const public_key_coord_t public_key_x,
const public_key_coord_t public_key_y 
) [virtual]

Set local public key.

Parameters:
[in]public_key_xnew public key value of the x coordinate
[in]public_key_ynew public key value of the y coordinate

Implements SecurityDb.

Definition at line 253 of file MemorySecurityDb.h.

virtual void set_restore ( bool  reload ) [virtual]

Toggle whether values should be preserved across resets.

Parameters:
[in]reloadif true values will be preserved across resets.

Implements SecurityDb.

Definition at line 359 of file MemorySecurityDb.h.

virtual void set_whitelist ( const ::Gap::Whitelist_t whitelist ) [virtual]

Update the whitelist stored in NVM by replacing it with new one.

Parameters:
[in]whitelist

Implements SecurityDb.

Definition at line 345 of file MemorySecurityDb.h.

virtual void sync (  ) [virtual]

Flush all values which might be stored in memory into NVM.

Implements SecurityDb.

Definition at line 357 of file MemorySecurityDb.h.