BLE - GenericGattClient: Exploit ENCRYPTED_WITH_SC_AND_MITM encryption.

IF link is encrypted, authenticated or authenticated with lesc then signed write must be transformed into regular write commands.
pull/6932/head
Vincent Coubard 2018-05-01 11:38:30 +01:00
parent 2da6fa3947
commit e39bb4b92c
1 changed files with 5 additions and 3 deletions

View File

@ -1089,9 +1089,11 @@ ble_error_t GenericGattClient::write(
ble::link_encryption_t encryption(ble::link_encryption_t::NOT_ENCRYPTED);
SecurityManager &sm = createBLEInstance()->getSecurityManager();
ble_error_t status = sm.getLinkEncryption(connection_handle, &encryption);
if (status == BLE_ERROR_NONE
|| encryption == ble::link_encryption_t::ENCRYPTED
|| encryption == ble::link_encryption_t::ENCRYPTED_WITH_MITM) {
if (status == BLE_ERROR_NONE &&
(encryption == link_encryption_t::ENCRYPTED ||
encryption == link_encryption_t::ENCRYPTED_WITH_MITM ||
encryption == link_encryption_t::ENCRYPTED_WITH_SC_AND_MITM)
) {
cmd = GattClient::GATT_OP_WRITE_CMD;
}
}