Bluetooth: Add check fo connection encrypt flag in ATT

This checks if connection encrypt flag is set if attribute requires
encryption and in case the connection is already encrypted return
success.

Change-Id: I8af4e9786b63a21f478b3aa9f6df448d7f5760c5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2015-06-03 13:41:58 +03:00 committed by Anas Nashif
commit 0000a2d790

View file

@ -571,8 +571,7 @@ static uint8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
return BT_ATT_ERR_AUTHENTICATION;
}
if (mask & BT_GATT_PERM_ENCRYPT_MASK) {
/* TODO: Check conn encryption */
if ((mask & BT_GATT_PERM_ENCRYPT_MASK) && !conn->encrypt) {
return BT_ATT_ERR_INSUFFICIENT_ENCRYPTION;
}