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 <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-10-15 14:07:19 +02:00 committed by Anas Nashif
commit 3def4202ae
2 changed files with 1 additions and 9 deletions

View file

@ -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) {

View file

@ -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