From 3def4202ae715fb5d63b10ed7b756b97f1fb4bd8 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 15 Oct 2015 14:07:19 +0200 Subject: [PATCH] Bluetooth: SMP: Ignore unsupported AuthReq in Security Request If Security Request with unsupported flags is received just ignore them instead of repairing. This is already done for Pairing Request but was missing in Security Request. Since we are still on 4.0 just remove any new bits definitions and update BT_SMP_AUTH_MASK accordingly. This fix constant repairing (instead of just enabling encryption) with peripherals that support LE Secure Connections. Change-Id: Ic053590755e97eadbcadbea788670c050f895d32 Signed-off-by: Szymon Janc --- net/bluetooth/smp.c | 6 ------ net/bluetooth/smp.h | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index ed1de6640be..f98a04cf80c 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -515,7 +515,6 @@ static int smp_init(struct bt_smp *smp) static uint8_t get_auth(uint8_t auth) { auth &= BT_SMP_AUTH_MASK; - auth &= ~(BT_SMP_AUTH_SC | BT_SMP_AUTH_KEYPRESS); if (bt_smp_io_capa == BT_SMP_IO_NO_INPUT_OUTPUT) { auth &= ~(BT_SMP_AUTH_MITM); @@ -1324,11 +1323,6 @@ 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_SC) { - BT_WARN("Unsupported auth requirements: 0x%x, repairing\n", - auth); - goto pair; - } if ((auth & BT_SMP_AUTH_MITM) && keys->type != BT_KEYS_AUTHENTICATED) { if (bt_smp_io_capa != BT_SMP_IO_NO_INPUT_OUTPUT) { diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h index 3419c758f60..4816a9aa57e 100644 --- a/net/bluetooth/smp.h +++ b/net/bluetooth/smp.h @@ -60,10 +60,8 @@ struct bt_smp_hdr { #define BT_SMP_AUTH_NONE 0x00 #define BT_SMP_AUTH_BONDING 0x01 #define BT_SMP_AUTH_MITM 0x04 -#define BT_SMP_AUTH_SC 0x08 -#define BT_SMP_AUTH_KEYPRESS 0x10 -#define BT_SMP_AUTH_MASK 0x1f +#define BT_SMP_AUTH_MASK 0x07 #define BT_SMP_CMD_PAIRING_REQ 0x01 #define BT_SMP_CMD_PAIRING_RSP 0x02