mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
2da6fa3947
commit
e39bb4b92c
|
@ -1089,9 +1089,11 @@ ble_error_t GenericGattClient::write(
|
||||||
ble::link_encryption_t encryption(ble::link_encryption_t::NOT_ENCRYPTED);
|
ble::link_encryption_t encryption(ble::link_encryption_t::NOT_ENCRYPTED);
|
||||||
SecurityManager &sm = createBLEInstance()->getSecurityManager();
|
SecurityManager &sm = createBLEInstance()->getSecurityManager();
|
||||||
ble_error_t status = sm.getLinkEncryption(connection_handle, &encryption);
|
ble_error_t status = sm.getLinkEncryption(connection_handle, &encryption);
|
||||||
if (status == BLE_ERROR_NONE
|
if (status == BLE_ERROR_NONE &&
|
||||||
|| encryption == ble::link_encryption_t::ENCRYPTED
|
(encryption == link_encryption_t::ENCRYPTED ||
|
||||||
|| encryption == ble::link_encryption_t::ENCRYPTED_WITH_MITM) {
|
encryption == link_encryption_t::ENCRYPTED_WITH_MITM ||
|
||||||
|
encryption == link_encryption_t::ENCRYPTED_WITH_SC_AND_MITM)
|
||||||
|
) {
|
||||||
cmd = GattClient::GATT_OP_WRITE_CMD;
|
cmd = GattClient::GATT_OP_WRITE_CMD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue