Bluetooth: Fix requesting high security level

If high security is required but keys are unauthenticated start
pairing instead of encrypting with too weak keys.

Change-Id: I35e5f0c1ab86660479288908152d61823ffb102e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-08-17 18:27:48 +02:00 committed by Anas Nashif
commit b73d408b72

View file

@ -497,11 +497,17 @@ int bt_conn_security(struct bt_conn *conn, bt_security_t sec)
keys = bt_keys_find(BT_KEYS_LTK, &conn->dst);
if (keys) {
if (sec > BT_SECURITY_MEDIUM &&
keys->ltk.type != BT_KEYS_AUTHENTICATED) {
goto pair;
}
return bt_conn_le_start_encryption(conn, keys->ltk.rand,
keys->ltk.ediv,
keys->ltk.val);
}
pair:
return bt_smp_send_pairing_req(conn);
}