mirror of https://github.com/ARMmbed/mbed-os.git
reseting the security db
parent
c2bbc94b44
commit
bcca75973e
|
@ -126,6 +126,8 @@ public:
|
|||
|
||||
virtual void set_restore(bool reload);
|
||||
|
||||
virtual void reset();
|
||||
|
||||
private:
|
||||
virtual uint8_t get_entry_count();
|
||||
|
||||
|
|
|
@ -148,6 +148,16 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* saving and loading from nvm */
|
||||
|
||||
virtual void reset() {
|
||||
SecurityDb::reset();
|
||||
for (size_t i = 0; i < MAX_ENTRIES; ++i) {
|
||||
_entries[i] = entry_t();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
virtual uint8_t get_entry_count() {
|
||||
return MAX_ENTRIES;
|
||||
|
|
|
@ -656,6 +656,15 @@ public:
|
|||
*/
|
||||
virtual void set_restore(bool reload) { };
|
||||
|
||||
/**
|
||||
* Reset the databse by removing all information
|
||||
*/
|
||||
virtual void reset() {
|
||||
_local_identity = SecurityEntryIdentity_t();
|
||||
_local_csrk = csrk_t();
|
||||
_local_sign_counter = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Get an entry for a new connection not present in the db yet. This will find a free entry
|
||||
|
|
|
@ -304,6 +304,11 @@ void FileSecurityDb::set_restore(bool reload) {
|
|||
db_write(&reload, DB_OFFSET_RESTORE);
|
||||
}
|
||||
|
||||
void FileSecurityDb::reset() {
|
||||
SecurityDb::reset();
|
||||
erase_db_file(_db_file);
|
||||
}
|
||||
|
||||
/* helper functions */
|
||||
|
||||
uint8_t FileSecurityDb::get_entry_count() {
|
||||
|
|
|
@ -116,7 +116,9 @@ ble_error_t GenericSecurityManager::init(
|
|||
}
|
||||
|
||||
ble_error_t GenericSecurityManager::reset(void) {
|
||||
MBED_ASSERT(_db);
|
||||
_pal.reset();
|
||||
_db->reset();
|
||||
SecurityManager::reset();
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
|
|
Loading…
Reference in New Issue