Bluetooth: debugfs option to unset MITM flag

The BT qualification test SM/MAS/PKE/BV-01-C needs us to turn off
the MITM flag when pairing, and at the same time also set the io
capability to something other than no input no output.

Currently the MITM flag is only unset when the io capability is set
to no input no output, therefore the test cannot be executed.

This patch introduces a debugfs option to force MITM flag to be
turned off.

Signed-off-by: Archie Pusaka <apusaka@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Archie Pusaka
2020-04-07 12:26:27 +08:00
committed by Marcel Holtmann
parent d2a3f5f463
commit c2aa30db74
3 changed files with 57 additions and 5 deletions

View File

@@ -2393,12 +2393,17 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
authreq |= SMP_AUTH_CT2;
}
/* Require MITM if IO Capability allows or the security level
* requires it.
/* Don't attempt to set MITM if setting is overridden by debugfs
* Needed to pass certification test SM/MAS/PKE/BV-01-C
*/
if (hcon->io_capability != HCI_IO_NO_INPUT_OUTPUT ||
hcon->pending_sec_level > BT_SECURITY_MEDIUM)
authreq |= SMP_AUTH_MITM;
if (!hci_dev_test_flag(hcon->hdev, HCI_FORCE_NO_MITM)) {
/* Require MITM if IO Capability allows or the security level
* requires it.
*/
if (hcon->io_capability != HCI_IO_NO_INPUT_OUTPUT ||
hcon->pending_sec_level > BT_SECURITY_MEDIUM)
authreq |= SMP_AUTH_MITM;
}
if (hcon->role == HCI_ROLE_MASTER) {
struct smp_cmd_pairing cp;