mirror of https://github.com/ARMmbed/mbed-os.git
signing only for the slave, unless keys requested to be sent by master
parent
8d966dbe8c
commit
511135f31c
|
@ -140,14 +140,10 @@ ble_error_t GenericSecurityManager::requestPairing(connection_handle_t connectio
|
||||||
* use when roles are changed */
|
* use when roles are changed */
|
||||||
if (_master_sends_keys) {
|
if (_master_sends_keys) {
|
||||||
initiator_distribution = _default_key_distribution;
|
initiator_distribution = _default_key_distribution;
|
||||||
}
|
|
||||||
|
|
||||||
/* override default if requested */
|
/* override default if requested */
|
||||||
if (cb->signing_override_default) {
|
if (cb->signing_override_default) {
|
||||||
initiator_distribution.set_signing(cb->signing_requested);
|
initiator_distribution.set_signing(cb->signing_requested);
|
||||||
} else {
|
}
|
||||||
/* because _master_sends_keys might be false so we need to set this */
|
|
||||||
initiator_distribution.set_signing(_default_key_distribution.get_signing());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyDistribution responder_distribution(_default_key_distribution);
|
KeyDistribution responder_distribution(_default_key_distribution);
|
||||||
|
@ -312,14 +308,10 @@ ble_error_t GenericSecurityManager::enableSigning(
|
||||||
return BLE_ERROR_INVALID_PARAM;
|
return BLE_ERROR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
cb->signing_requested = enabled;
|
|
||||||
cb->signing_override_default = true;
|
cb->signing_override_default = true;
|
||||||
|
|
||||||
if (cb->encrypted) {
|
if (enabled && !cb->signing_requested && !_default_key_distribution.get_signing()) {
|
||||||
return BLE_ERROR_INVALID_STATE;
|
cb->signing_requested = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (cb->signing_requested) {
|
|
||||||
if (cb->csrk_stored) {
|
if (cb->csrk_stored) {
|
||||||
/* used the stored ones when available */
|
/* used the stored ones when available */
|
||||||
_db.get_entry_peer_csrk(
|
_db.get_entry_peer_csrk(
|
||||||
|
@ -335,6 +327,8 @@ ble_error_t GenericSecurityManager::enableSigning(
|
||||||
return slave_security_request(connection);
|
return slave_security_request(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
cb->signing_requested = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
|
|
Loading…
Reference in New Issue