From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v4 0/6] Bluetooth: Add support for HDT and EKS
Date: Thu, 5 Nov 2026 12:12:11 -0500 [thread overview]
Message-ID: <20261105171217.2053745-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds support for the LE High Data Throughput (HDT) PHY and the
Encryption Key Schedule (EKS) introduced in Bluetooth Core 7.0:
- HDT PHY selection for ACL, CIS and BIS, the v2/v3 HCI commands and
events that carry the HDT rates, and the LE Set HDT Default
Parameters command.
- ISO sockets take an extended, versioned QoS (struct bt_iso_qos_ext)
through the existing BT_ISO_QOS option, carrying the HDT rates per
direction; the legacy struct bt_iso_qos keeps working.
- LE Enable Encryption v2 with the MIC length, Encryption Change v3
and Key Refresh Complete v2.
- L2CAP and BT_SECURITY gain a MIC length requirement; connections
whose MIC is too short are refused with the MIC Length Too Short
result.
- EKS opportunistic encryption, enabled with a new MGMT system
configuration parameter.
This series depends on:
"Bluetooth: Fix not updating of hdev->commands[] after reset"
Changes in v4:
- LE Set CIG Parameters v2 is limited to the CIS that fit in the 255
octets of command parameters, and a CIS that would exceed that is
refused when it is bound to the CIG.
- setsockopt(BT_ISO_QOS) on a socket that already has a connection,
such as with deferred setup or a PA sync, checks the QoS type there,
since connect() or listen() won't.
- SMP marks the encryption started after DHKey Check as pending, as it
does after Random, so it isn't started a second time.
- A Key Refresh Complete reporting opportunistic encryption, such as
one changing the MIC length, keeps the link opportunistic, and
disconnects a link with a key from pairing since that would be a
downgrade. A key from pairing replacing the opportunistic one is
handled as Encryption Change is for an unencrypted link.
- Restore the lockdep_assert_held() before smp_pairing_in_progress(),
which context analysis needs to know conn->hdev->lock is held.
Changes in v3:
- Opportunistic encryption sets HCI_CONN_ENCRYPT and HCI_CONN_AES_CCM
along with a new HCI_CONN_OPP_ENCRYPT flag, and the L2CAP key size
check is skipped for it since it has no key from pairing. Pairing
over such a link now completes: its Key Refresh Complete clears the
flag. A failure, or a command that can't be sent, leaves the link
unencrypted instead of disconnecting, and HCI_CONN_ENCRYPT_PEND is
no longer used for it so it doesn't block SMP. The MIC length is
taken right before the command is sent.
- Changing TLV 0x0024 while the controller is up updates the
Opportunistic Encryption host feature bit.
- SMP checks the result of hci_le_enable_encrypt().
- Set CIG Parameters v2 returns the failure of a response that doesn't
match the command, and fails the unbound CIS of the CIG it was sent
for.
- CIS Established v3 and Create BIG Complete v2 are only unmasked with
CIS and BIS support.
- BT_PHY rejects HDT6 and HDT7.5 rates the controller doesn't support
in that direction, and only reports supported ones.
- struct bt_iso_qos_ext replaces its rfu bytes with a 16-bit version
and a 16-bit type telling whether the unicast or broadcast member is
in use, so each can later grow on its own; the union is the last
member for that. BT_ISO_QOS_ANY, used for struct bt_iso_qos, leaves
the type to connect() or listen(), which fail with -EINVAL on a
mismatch. Connections set up by the controller get the version and
type, and BT_ISO_HDT_RATE_* name the rates bits.
- The extended ISO QoS is copied field by field, so padding is zeroed,
and the v1 CIS Established event clears the HDT rates.
Changes in v2:
- Remove the values from drafts of the specification and use the ones
from Core 7.0: L2CAP MIC Length Too Short is 0x000C for LE Credit
Based and 0x0010 for Enhanced Credit Based, and LE feature page 0
bit 59 is no longer checked.
- A 64-bit MIC is only used when both sides prefer it, so downgrading
on re-encryption is no longer an error.
- The key size of Encryption Change v3 is ignored for LE as the spec
requires; hci_change_encrypt() no longer takes it.
- Rename struct bt_iso_qos_v2 to struct bt_iso_qos_ext with a version
field; the length passed to BT_ISO_QOS selects legacy or extended.
Convert field by field, which fixes an out-of-bounds copy and an
info leak through the legacy struct.
- HDT rates are little endian and kept per direction.
- HDT PHY selection is gated on hdt_capable(); mixed LE and HDT PHY
masks are accepted; phy_opts is initialized.
- Create BIG Complete v1/v2 share one bounds-checked handler; Set CIG
Parameters v2 response is validated like v1; Create CIS waits for
CIS Established v3.
- Drop the unused LE Set Data Length v2 command and the unhandled
Data Length Change v2 event mask bit.
- EKS: copy the LTK under RCU and encrypt after unlocking, zero-pad
the key for v1 and copy key_size bytes for v2, free the command
when queueing fails, and handle the Command Status of LE Enable
Encryption v2.
- L2CAP: keep the requested MIC length separate from the negotiated
one, take the negotiated one from Encryption Change v3 and Key
Refresh Complete v2, propagate the channel MIC length on every LE
security path and reject values above 0x02.
- RFCOMM BT_SECURITY accepts the 2-byte struct and zeroes the struct
returned by getsockopt.
- One hci_le_set_hdt_params_sync() is shared by init and MGMT, and the
defaults are resent when changed while the controller is up.
- Opportunistic encryption requires eks_capable() and its TLV
(0x0024) is validated as u8. Encryption Change v3 for it still only
clears ENCRYPT_PEND: the key size is 0, so setting ENCRYPT would make
the key size check refuse every L2CAP channel.
Luiz Augusto von Dentz (6):
Bluetooth: Add initial support for HDT PHY
Bluetooth: ISO: Add extended QoS with the HDT rates
Bluetooth: Add initial support for EKS
Bluetooth: L2CAP: Add MIC length validation for HDT PHY
Bluetooth: Add HCI_OP_LE_SET_HDT_DEFAULT_PARAMS support
Bluetooth: Add EKS Opportunistic Encryption support
include/net/bluetooth/bluetooth.h | 102 +++++
include/net/bluetooth/hci.h | 216 +++++++++-
include/net/bluetooth/hci_core.h | 66 +++-
include/net/bluetooth/hci_sync.h | 12 +-
include/net/bluetooth/l2cap.h | 7 +
include/net/bluetooth/mgmt.h | 1 +
net/bluetooth/hci_conn.c | 273 +++++++------
net/bluetooth/hci_core.c | 4 +
net/bluetooth/hci_event.c | 627 +++++++++++++++++++++++++----
net/bluetooth/hci_sync.c | 634 +++++++++++++++++++++++++++++-
net/bluetooth/iso.c | 255 +++++++++++-
net/bluetooth/l2cap_core.c | 50 ++-
net/bluetooth/l2cap_sock.c | 23 +-
net/bluetooth/mgmt.c | 6 +
net/bluetooth/mgmt_config.c | 56 +++
net/bluetooth/rfcomm/sock.c | 13 +-
net/bluetooth/smp.c | 85 +++-
net/bluetooth/smp.h | 2 +
18 files changed, 2191 insertions(+), 241 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-05 17:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 17:12 Luiz Augusto von Dentz [this message]
2026-11-05 17:12 ` [PATCH v4 1/6] Bluetooth: Add initial support for HDT PHY Luiz Augusto von Dentz
2026-11-05 17:12 ` [PATCH v4 2/6] Bluetooth: ISO: Add extended QoS with the HDT rates Luiz Augusto von Dentz
2026-11-05 17:12 ` [PATCH v4 3/6] Bluetooth: Add initial support for EKS Luiz Augusto von Dentz
2026-11-05 17:12 ` [PATCH v4 4/6] Bluetooth: L2CAP: Add MIC length validation for HDT PHY Luiz Augusto von Dentz
2026-11-05 17:12 ` [PATCH v4 5/6] Bluetooth: Add HCI_OP_LE_SET_HDT_DEFAULT_PARAMS support Luiz Augusto von Dentz
2026-11-05 17:12 ` [PATCH v4 6/6] Bluetooth: Add EKS Opportunistic Encryption support Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261105171217.2053745-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox