Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Controller: Missing LL_ENC_RSP after HCI LTK Negative Reply #19917

Closed
rugeGerritsen opened this issue Oct 18, 2019 · 6 comments · Fixed by #19986 or #20378
Closed

Bluetooth: Controller: Missing LL_ENC_RSP after HCI LTK Negative Reply #19917

rugeGerritsen opened this issue Oct 18, 2019 · 6 comments · Fixed by #19986 or #20378
Assignees
Labels
area: Bluetooth bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: medium Medium impact/importance bug
Milestone

Comments

@rugeGerritsen
Copy link
Collaborator

rugeGerritsen commented Oct 18, 2019

Describe the bug
In the Encryption Start Procedure, for the case when the host does not provide an LTK, the controller is supposed to send an LL_ENC_RSP before sending LL_REJECT_IND or LL_REJECT_EXT_IND.

To Reproduce

  1. Modify hci_core.c, le_ltk_request() to always call le_ltk_neg_reply():
//	if (bt_smp_request_ltk(conn, evt->rand, evt->ediv, ltk)) {
//		le_ltk_reply(handle, ltk);
//	} else {
		le_ltk_neg_reply(handle);
//	}
  1. Build the peripheral_hr sample
  2. Connect and try bonding, expect it to fail.
  3. Observe the sniffer log.

Expected behavior
Send LL_ENC_RSP before LL_REJECT_IND. See the MSC in Bluetooth Core Specification v5.1, Vol 6, Part D, Section 6.7, or Part B Section 5.1.3.1.
image

If encryption is not supported by the Link Layer of the slave, the Link Layer of
the slave shall send an LL_REJECT_IND or LL_REJECT_EXT_IND PDU with
the ErrorCode set to Unsupported Remote Feature / Unsupported LMP
Feature (0x1A).


The Link Layer of the slave shall then send an LL_ENC_RSP PDU. The Link
Layer of the slave shall then notify the Host with the Rand and EDIV fields.

Impact
Possible showstopper. Peer devices may cache that the controller does not support encryption, thereby leaving the link unencrypted.

Screenshots or console output
image

Environment (please complete the following information):
f79fbac

The issue is present in both the legacy and split controller. The issue is also present in Zephyr v.2.0.0

@rugeGerritsen rugeGerritsen added the bug The issue is a bug, or the PR is fixing a bug label Oct 18, 2019
@rugeGerritsen
Copy link
Collaborator Author

@cvinayak, FYI

@carlescufi
Copy link
Member

@rugeGerritsen Please specify which controller you are using, legacy or split

@rugeGerritsen
Copy link
Collaborator Author

Updated the bug description to state that this bug is present in 2.0.0, both the legacy and split controller

@cvinayak
Copy link
Contributor

@rugeGerritsen Please try with CONFIG_BT_CTLR_FAST_ENC=y

@carlescufi carlescufi added the priority: medium Medium impact/importance bug label Oct 18, 2019
@carlescufi
Copy link
Member

Thanks @rugeGerritsen, this is indeed a bug. It will only be fixed in the split controller.

@rugeGerritsen
Copy link
Collaborator Author

@rugeGerritsen Please try with CONFIG_BT_CTLR_FAST_ENC=y

The bug is not present when CONFIG_BT_CTLR_FAST_ENC=y. This is only enabled in the hci_uart example

@carlescufi carlescufi added this to the v2.1.0 milestone Oct 18, 2019
cvinayak added a commit to cvinayak/zephyr that referenced this issue Nov 6, 2019
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes zephyrproject-rtos#19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
cvinayak added a commit to cvinayak/zephyr that referenced this issue Nov 6, 2019
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes zephyrproject-rtos#19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
carlescufi pushed a commit that referenced this issue Nov 8, 2019
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes #19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nashif pushed a commit that referenced this issue Nov 19, 2019
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes #19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
cvinayak added a commit to cvinayak/zephyr that referenced this issue Sep 23, 2020
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes zephyrproject-rtos#19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nashif pushed a commit that referenced this issue Nov 17, 2020
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes #19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: medium Medium impact/importance bug
Projects
None yet
3 participants