@@ -54,7 +54,7 @@ const uint16_t DB_VERSION = 1;
5454 )
5555
5656#define DB_SIZE_STORES \
57- (FileSecurityDb::MAX_ENTRIES * DB_SIZE_STORE)
57+ (BLE_SECURITY_DATABASE_MAX_ENTRIES * DB_SIZE_STORE)
5858
5959#define DB_OFFSET_VERSION (0 )
6060#define DB_OFFSET_RESTORE (DB_OFFSET_VERSION + sizeof (DB_VERSION))
@@ -265,6 +265,22 @@ void FileSecurityDb::set_entry_peer_sign_counter(
265265 }
266266}
267267
268+ void FileSecurityDb::set_local_csrk (
269+ const csrk_t &csrk
270+ ) {
271+ this ->SecurityDb ::set_local_csrk (csrk);
272+ db_write (&_local_csrk, DB_OFFSET_LOCAL_CSRK);
273+ }
274+
275+ void FileSecurityDb::set_local_identity (
276+ const irk_t &irk,
277+ const address_t &identity_address,
278+ bool public_address
279+ ) {
280+ this ->SecurityDb ::set_local_identity (irk, identity_address, public_address);
281+ db_write (&_local_identity, DB_OFFSET_LOCAL_IDENTITY);
282+ }
283+
268284/* saving and loading from nvm */
269285
270286void FileSecurityDb::restore () {
@@ -299,6 +315,7 @@ void FileSecurityDb::sync(entry_handle_t db_handle) {
299315
300316 db_write (&entry->peer_sign_counter , entry->file_offset + DB_STORE_OFFSET_PEER_SIGNING_COUNT);
301317 db_write (&entry->flags , entry->file_offset + DB_STORE_OFFSET_FLAGS);
318+ db_write (&_local_sign_counter, DB_OFFSET_LOCAL_SIGN_COUNT);
302319}
303320
304321void FileSecurityDb::set_restore (bool reload) {
@@ -308,11 +325,11 @@ void FileSecurityDb::set_restore(bool reload) {
308325/* helper functions */
309326
310327uint8_t FileSecurityDb::get_entry_count () {
311- return MAX_ENTRIES ;
328+ return BLE_SECURITY_DATABASE_MAX_ENTRIES ;
312329}
313330
314331SecurityDistributionFlags_t* FileSecurityDb::get_entry_handle_by_index (uint8_t index) {
315- if (index < MAX_ENTRIES ) {
332+ if (index < BLE_SECURITY_DATABASE_MAX_ENTRIES ) {
316333 return &_entries[index].flags ;
317334 } else {
318335 return NULL ;
0 commit comments