Skip to content

Commit

Permalink
Bluetooth: Host: Check encryption level for EATT channels
Browse files Browse the repository at this point in the history
Check the encription level before sending on EATT.

Signed-off-by: Alexandru Carbuneanu <alexandru.carbuneanu@nordicsemi.no>
  • Loading branch information
CarbuneanuAlexandru authored and carlescufi committed Apr 8, 2022
1 parent c910e4d commit f3444ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions subsys/bluetooth/host/att.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf,
return -EAGAIN;
}

/* Check the encryption level for EATT */
if (bt_conn_get_security(chan->att->conn) < BT_SECURITY_L2) {
/* Vol 3, Part G, Section 5.3.2 Channel Requirements states:
* The channel shall be encrypted.
*/
return -EINVAL;
}

/* bt_l2cap_chan_send does actually return the number of bytes
* that could be sent immediately.
*/
Expand Down

0 comments on commit f3444ce

Please sign in to comment.