Skip to content

Commit

Permalink
Merge pull request ARMmbed#24 from paul-szczepanek-arm/slave-request
Browse files Browse the repository at this point in the history
enable encryption for slave request added
  • Loading branch information
paul-szczepanek-arm authored Mar 23, 2018
2 parents d537bd9 + 6833c79 commit f6f3d24
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions features/FEATURE_BLE/source/generic/GenericSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,16 +853,23 @@ void GenericSecurityManager::on_slave_security_request(
return;
}

if (authentication.get_secure_connections()
&& _default_authentication.get_secure_connections()
&& !cb->secure_connections_paired) {
requestPairing(connection);
bool pairing_required = false;

if (authentication.get_secure_connections() && !cb->secure_connections_paired
&& _default_authentication.get_secure_connections()) {
pairing_required = true;
}

if (authentication.get_mitm()
&& !cb->ltk_mitm_protected) {
if (authentication.get_mitm() && !cb->ltk_mitm_protected) {
pairing_required = true;
cb->mitm_requested = true;
}

if (pairing_required) {
requestPairing(connection);
} else if (!cb->encryption_requested) {
/* this will refresh keys if encryption is already present */
enable_encryption(connection);
}
}

Expand Down

0 comments on commit f6f3d24

Please sign in to comment.