db restoring, legacy pairing disallowing, removed set SC support

pull/6188/head
paul-szczepanek-arm 2018-01-17 10:46:56 +00:00
parent 11874aac3b
commit 943206dd07
2 changed files with 22 additions and 23 deletions

View File

@ -338,10 +338,6 @@ public:
// Feature support // Feature support
// //
virtual ble_error_t set_secure_connections_support(
bool enabled, bool secure_connections_only = false
) = 0;
virtual ble_error_t get_secure_connections_support( virtual ble_error_t get_secure_connections_support(
bool &enabled, bool &secure_connections_only bool &enabled, bool &secure_connections_only
) = 0; ) = 0;

View File

@ -155,7 +155,7 @@ public:
csrk_t &csrk); csrk_t &csrk);
void remove_entry(SecurityEntry_t&); void remove_entry(SecurityEntry_t&);
void clear_entries(SecurityEntry_t&); void clear_entries();
void get_whitelist(WhitelistDbCb_t cb); void get_whitelist(WhitelistDbCb_t cb);
@ -164,6 +164,10 @@ public:
void remove_whitelist_entry(address_t); void remove_whitelist_entry(address_t);
void clear_whitelist(); void clear_whitelist();
void restore();
void sync();
void setRestore(bool reload);
private: private:
}; };
@ -178,7 +182,7 @@ public:
bool initMITM = true, bool initMITM = true,
SecurityIOCapabilities_t initIocaps = IO_CAPS_NONE, SecurityIOCapabilities_t initIocaps = IO_CAPS_NONE,
const Passkey_t initPasskey = NULL) { const Passkey_t initPasskey = NULL) {
loadState(); db.restore();
bondable = initBondable; bondable = initBondable;
mitm = initMITM; mitm = initMITM;
iocaps = initIocaps; iocaps = initIocaps;
@ -188,7 +192,7 @@ public:
} }
ble_error_t reset(void) { ble_error_t reset(void) {
saveState(); db.sync();
SecurityManager::reset(); SecurityManager::reset();
@ -196,19 +200,13 @@ public:
} }
void saveState() { void saveState() {
if (saveStateEnabled) {
/*save lists */
}
} }
void loadState() { void loadState() {
if (saveStateEnabled) {
/*load lists */
}
} }
ble_error_t preserveBondingStateOnReset(bool enabled) { ble_error_t preserveBondingStateOnReset(bool enabled) {
saveStateEnabled = enabled; db.setRestore(enabled);
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} }
@ -217,15 +215,18 @@ public:
// //
ble_error_t purgeAllBondingState(void) { ble_error_t purgeAllBondingState(void) {
return BLE_ERROR_NOT_IMPLEMENTED; db.clear_entries();
return BLE_ERROR_NONE;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Feature support // Feature support
// //
ble_error_t setSecureConnectionsSupport(bool enabled, bool secure_connections_only = false) {
return pal.set_secure_connections_support(enabled, secure_connections_only); ble_error_t allowLegacyPairing(bool allow = true) {
allowLegacyPairing = allow;
return BLE_ERROR_NONE;
} }
ble_error_t getSecureConnectionsSupport(bool *enabled, bool *secure_connections_only) { ble_error_t getSecureConnectionsSupport(bool *enabled, bool *secure_connections_only) {
@ -404,12 +405,14 @@ private:
SecurityDb db; SecurityDb db;
SecurityIOCapabilities_t iocaps; SecurityIOCapabilities_t iocaps;
PasskeyNum passkey; PasskeyNum passkey;
bool mitm;
bool bondable; bool mitm;
bool authorisationRequired; bool bondable;
bool keypressNotification; bool authorisationRequired;
bool oobProvidesMitmProtection; bool keypressNotification;
bool oobProvidesMitmProtection;
bool allowLegacyPairing;
authentication_t authentication; authentication_t authentication;
uint8_t minKeySize; uint8_t minKeySize;