Bluetooth: SMP: Verify MITM requirements in security request

If slave is requesting MITM protection verify if LTK is authenticated
before enabling encryption.

Change-Id: I6642f88945b0ca0310880935edbcfa2a6764c8d8
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-08-17 19:12:50 +02:00 committed by Anas Nashif
commit 6486ae7943

View file

@ -1079,7 +1079,18 @@ static uint8_t smp_security_request(struct bt_conn *conn, struct bt_buf *buf)
}
auth = req->auth_req & BT_SMP_AUTH_MASK;
if (auth & (BT_SMP_AUTH_MITM | BT_SMP_AUTH_SC)) {
if (auth & BT_SMP_AUTH_SC) {
BT_WARN("Unsupported auth requirements: 0x%x, repairing", auth);
goto pair;
}
if ((auth & BT_SMP_AUTH_MITM) &&
keys->ltk.type != BT_KEYS_AUTHENTICATED) {
if (bt_smp_io_capa != BT_SMP_IO_NO_INPUT_OUTPUT) {
BT_INFO("New auth requirements: 0x%x, repairing", auth);
goto pair;
}
BT_WARN("Unsupported auth requirements: 0x%x, repairing", auth);
goto pair;
}