Merge pull request #24 from paul-szczepanek-arm/slave-request

enable encryption for slave request added
pull/6932/head
Paul Szczepanek 2018-03-23 10:07:46 +00:00 committed by GitHub
commit f6f3d24652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 6 deletions

View File

@ -853,16 +853,23 @@ void GenericSecurityManager::on_slave_security_request(
return; return;
} }
if (authentication.get_secure_connections() bool pairing_required = false;
&& _default_authentication.get_secure_connections()
&& !cb->secure_connections_paired) { if (authentication.get_secure_connections() && !cb->secure_connections_paired
requestPairing(connection); && _default_authentication.get_secure_connections()) {
pairing_required = true;
} }
if (authentication.get_mitm() if (authentication.get_mitm() && !cb->ltk_mitm_protected) {
&& !cb->ltk_mitm_protected) { pairing_required = true;
cb->mitm_requested = true; cb->mitm_requested = true;
}
if (pairing_required) {
requestPairing(connection); requestPairing(connection);
} else if (!cb->encryption_requested) {
/* this will refresh keys if encryption is already present */
enable_encryption(connection);
} }
} }