From: Vinicius Costa Gomes Date: Fri, 2 Sep 2011 17:51:20 +0000 (-0300) Subject: Bluetooth: Require authentication if MITM protection is requested X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e9bf2bf03e14627fac8520468231ea11dfa37610;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git Bluetooth: Require authentication if MITM protection is requested The HIGH security level requires a 16 digit pin code for non-SSP bondings. Sometimes this requirement is not acceptable and we still want protection againts MITM attacks (which is something that the MEDIUM security level doesn't provide), for that we should allow another way to request authentication without using the HIGH security level. Signed-off-by: Vinicius Costa Gomes Signed-off-by: Gustavo F. Padovan --- diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index e54d0822260..fd6eea0941b 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -1103,9 +1103,10 @@ static int hci_outgoing_auth_needed(struct hci_dev *hdev, return 0; /* Only request authentication for SSP connections or non-SSP - * devices with sec_level HIGH */ + * devices with sec_level HIGH or if MITM protection is requested */ if (!(hdev->ssp_mode > 0 && conn->ssp_mode > 0) && - conn->pending_sec_level != BT_SECURITY_HIGH) + conn->pending_sec_level != BT_SECURITY_HIGH && + !(conn->auth_type & 0x01)) return 0; return 1;