Bluetooth: l2cap: Check encryption key size on incoming connection
Subsystems (2)
PATCH v2 1/1 Bluetooth: l2cap: Check encryption key size on incoming connection
This is required for passing GAP/SEC/SEM/BI-04-C PTS test case:
Security Mode 4 Level 4, Responder - Invalid Encryption Key Size
- 128 bit
This tests the security key with size from 1 to 15 bytes while the Security Mode 4 Level 4 requests 16 bytes key size.
Currently PTS fails with the following logs:
- expected:Connection Response:
Code: [3 (0x03)] Code
Identifier: (lt)WildCard: Exists(gt)
Length: [8 (0x0008)]
Destination CID: (lt)WildCard: Exists(gt)
Source CID: [64 (0x0040)]
Result: [3 (0x0003)] Connection refused - Security block
Status: (lt)WildCard: Exists(gt),
but received:Connection Response:
Code: [3 (0x03)] Code
Identifier: [1 (0x01)]
Length: [8 (0x0008)]
Destination CID: [64 (0x0040)]
Source CID: [64 (0x0040)]
Result: [0 (0x0000)] Connection Successful
Status: [0 (0x0000)] No further information availableAnd HCI logs:
< HCI Command: Read Encrypti.. (0x05|0x0008) plen 2
Handle: 14 Address: 00:1B:DC:F2:24:10 (Vencer Co., Ltd.)
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 7
Read Encryption Key Size (0x05|0x0008) ncmd 1
Status: Success (0x00)
Handle: 14 Address: 00:1B:DC:F2:24:10 (Vencer Co., Ltd.)
Key size: 7Quoted 1 line
ACL Data RX: Handle 14 flags
0x02dlen 12
L2CAP: Connection Request (0x02) ident 1 len 4
PSM: 4097 (0x1001)
Source CID: 64
< ACL Data TX: Handle 14 flags 0x00 dlen 16
L2CAP: Connection Response (0x03) ident 1 len 8
Destination CID: 64
Source CID: 64
Result: Connection successful (0x0000)
Status: No further information available (0x0000)---v1->v2: Incorporate check into ACL security check test
net/bluetooth/l2cap_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +2 -1
@@ -3991,7 +3991,8 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,/* Check if the ACL is secure enough (if not SDP) */ if (psm !=cpu_to_le16 (L2CAP_PSM_SDP ) && - !hci_conn_check_link_mode (conn->hcon)) { + (!hci_conn_check_link_mode (conn->hcon) || + !l2cap_check_enc_key_size (conn->hcon))) { conn->disc_reason =HCI_ERROR_AUTH_FAILURE ; result =L2CAP_CR_SEC_BLOCK ; goto response;
Signature · 1 line
2.43.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=951461
---Test result---
Test Summary:
CheckPatch PENDING 0.39 seconds GitLint PENDING 0.21 seconds SubjectPrefix PASS 16.01 seconds BuildKernel PASS 24.82 seconds CheckAllWarning PASS 49.78 seconds CheckSparse PASS 30.48 seconds BuildKernel32 PASS 25.75 seconds TestRunnerSetup PASS 475.60 seconds TestRunner_l2cap-tester PASS 23.29 seconds TestRunner_iso-tester PASS 30.81 seconds TestRunner_bnep-tester PASS 4.74 seconds TestRunner_mgmt-tester FAIL 122.30 seconds TestRunner_rfcomm-tester PASS 7.74 seconds TestRunner_sco-tester PASS 12.57 seconds TestRunner_ioctl-tester PASS 8.34 seconds TestRunner_mesh-tester PASS 5.95 seconds TestRunner_smp-tester PASS 26.73 seconds TestRunner_userchan-tester PASS 5.52 seconds IncrementalBuild PENDING 0.53 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
LL Privacy - Set Flags 1 (Add to RL) Failed 0.134 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Wed, 9 Apr 2025 10:53:06 +0200 you wrote:
This is required for passing GAP/SEC/SEM/BI-04-C PTS test case:
Security Mode 4 Level 4, Responder - Invalid Encryption Key Size
- 128 bitThis tests the security key with size from 1 to 15 bytes while the Security Mode 4 Level 4 requests 16 bytes key size.
[...]
Here is the summary with links:
- [v2] Bluetooth: l2cap: Check encryption key size on incoming connection
https://git.kernel.org/bluetooth/bluetooth-next/c/50c1241e6a8a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html