Commit 3124b843 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: Allow 3D profile to use security mode 4 level 0

The PSM 0x0021 is dedicated to the 3D profile and has permission to
use security mode 4 level 0 for L2CAP connectionless unicast data
transfers.

When establishing a L2CAP connectionless channel on PSM 0x0021, it
will no longer force Secure Simple Pairing.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 6a974b50
...@@ -237,6 +237,7 @@ struct l2cap_conn_rsp { ...@@ -237,6 +237,7 @@ struct l2cap_conn_rsp {
/* protocol/service multiplexer (PSM) */ /* protocol/service multiplexer (PSM) */
#define L2CAP_PSM_SDP 0x0001 #define L2CAP_PSM_SDP 0x0001
#define L2CAP_PSM_RFCOMM 0x0003 #define L2CAP_PSM_RFCOMM 0x0003
#define L2CAP_PSM_3DSP 0x0021
/* channel indentifier */ /* channel indentifier */
#define L2CAP_CID_SIGNALING 0x0001 #define L2CAP_CID_SIGNALING 0x0001
......
...@@ -688,6 +688,16 @@ static inline u8 l2cap_get_auth_type(struct l2cap_chan *chan) ...@@ -688,6 +688,16 @@ static inline u8 l2cap_get_auth_type(struct l2cap_chan *chan)
return HCI_AT_NO_BONDING; return HCI_AT_NO_BONDING;
} }
break; break;
case L2CAP_CHAN_CONN_LESS:
if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_3DSP)) {
if (chan->sec_level == BT_SECURITY_LOW)
chan->sec_level = BT_SECURITY_SDP;
}
if (chan->sec_level == BT_SECURITY_HIGH)
return HCI_AT_NO_BONDING_MITM;
else
return HCI_AT_NO_BONDING;
break;
case L2CAP_CHAN_CONN_ORIENTED: case L2CAP_CHAN_CONN_ORIENTED:
if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_SDP)) { if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_SDP)) {
if (chan->sec_level == BT_SECURITY_LOW) if (chan->sec_level == BT_SECURITY_LOW)
......
...@@ -101,6 +101,10 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) ...@@ -101,6 +101,10 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
goto done; goto done;
switch (chan->chan_type) { switch (chan->chan_type) {
case L2CAP_CHAN_CONN_LESS:
if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_3DSP)
chan->sec_level = BT_SECURITY_SDP;
break;
case L2CAP_CHAN_CONN_ORIENTED: case L2CAP_CHAN_CONN_ORIENTED:
if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP || if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
__le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM) __le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment