@@ -54,7 +54,7 @@ const uint16_t DB_VERSION = 1;
54
54
)
55
55
56
56
#define DB_SIZE_STORES \
57
- (FileSecurityDb::MAX_ENTRIES * DB_SIZE_STORE)
57
+ (BLE_SECURITY_DATABASE_MAX_ENTRIES * DB_SIZE_STORE)
58
58
59
59
#define DB_OFFSET_VERSION (0 )
60
60
#define DB_OFFSET_RESTORE (DB_OFFSET_VERSION + sizeof (DB_VERSION))
@@ -265,6 +265,22 @@ void FileSecurityDb::set_entry_peer_sign_counter(
265
265
}
266
266
}
267
267
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
+
268
284
/* saving and loading from nvm */
269
285
270
286
void FileSecurityDb::restore () {
@@ -299,6 +315,7 @@ void FileSecurityDb::sync(entry_handle_t db_handle) {
299
315
300
316
db_write (&entry->peer_sign_counter , entry->file_offset + DB_STORE_OFFSET_PEER_SIGNING_COUNT);
301
317
db_write (&entry->flags , entry->file_offset + DB_STORE_OFFSET_FLAGS);
318
+ db_write (&_local_sign_counter, DB_OFFSET_LOCAL_SIGN_COUNT);
302
319
}
303
320
304
321
void FileSecurityDb::set_restore (bool reload) {
@@ -308,11 +325,11 @@ void FileSecurityDb::set_restore(bool reload) {
308
325
/* helper functions */
309
326
310
327
uint8_t FileSecurityDb::get_entry_count () {
311
- return MAX_ENTRIES ;
328
+ return BLE_SECURITY_DATABASE_MAX_ENTRIES ;
312
329
}
313
330
314
331
SecurityDistributionFlags_t* FileSecurityDb::get_entry_handle_by_index (uint8_t index) {
315
- if (index < MAX_ENTRIES ) {
332
+ if (index < BLE_SECURITY_DATABASE_MAX_ENTRIES ) {
316
333
return &_entries[index].flags ;
317
334
} else {
318
335
return NULL ;
0 commit comments