SIG-Qualification: Problems with setting TSPC_L2CAP_4_3
Subsystems (2)
Hi Frédéric, hi Luiz,
if I check TSPC_L2CAP_4_3 (as recommended in [1]), this enables PTS test L2CAP/LE/CFC/BV-15-C ("Security - Insufficient Encryption Key Size - Responder"), which is currently not documented in l2cap-pts.rst.
This test checks whether the size of the encryption key is greater or equal to a specified length, there are already several similar tests for GATT (but not for L2CAP yet). The test case expects, that the L2CAP connection request is answered with L2CAP_CR_LE_BAD_KEY_SIZE, which is currently not used anywhere in the kernel.
For GATT, it seems that the length of the encryption key is solely checked in user space (bluetoothd), while for L2CAP, such check would be required within the kernel.
Would it be possible, to add such a check for L2CAP in the kernel? Is the length of the encryption key available there?
regards,
Christian
P.S I'll be unavailable until end of next week.
[1] https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/qualification/l2cap-pics.rst#n320
Luiz Augusto von Dentz
maintainerHi Christian,
Quoted 13 lines · Christian Eggers
Hi Frédéric, hi Luiz,
if I check
TSPC_L2CAP_4_3(as recommended in [1]), this enables PTS test L2CAP/LE/CFC/BV-15-C ("Security - Insufficient Encryption Key Size - Responder"), which is currently not documented inl2cap-pts.rst.This test checks whether the size of the encryption key is greater or equal to a specified length, there are already several similar tests for GATT (but not for L2CAP yet). The test case expects, that the L2CAP connection request is answered with
L2CAP_CR_LE_BAD_KEY_SIZE, which is currently not used anywhere in the kernel.
Quoted 6 lines
For GATT, it seems that the length of the encryption key is solely checked in user space (bluetoothd), while for L2CAP, such check would be required within the kernel.
Would it be possible, to add such a check for L2CAP in the kernel? Is the length of the encryption key available there?
I guess we should probably use l2cap_check_enc_key_size and then use BT_SECURITY_FIPS (mode 4) security if the key size used by PTS is > HCI_MIN_ENC_KEY_SIZE(7), if it is lower, any security setting will suffice.
Let's create a github issue first. I assume we will need to do something similar for ECRED connection request as well since it might have a similar problem. Anyway you can try with the following to see if that works with the channel you are testing with:
net/bluetooth/l2cap_core.c +7 -0
@@ -4916,6 +4916,13 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, goto response_unlock; } +/* Check if Key Size is sufficient for the security level */ +if (!l2cap_check_enc_key_size (conn->hcon, pchan)) { + result =L2CAP_CR_LE_BAD_KEY_SIZE ; + chan =NULL ; + goto response_unlock; + } +/* Check for valid dynamic CID range */ if (scid <L2CAP_CID_DYN_START || scid >L2CAP_CID_LE_DYN_END ) { result =L2CAP_CR_LE_INVALID_SCID ;
Quoted 10 lines
regards,
Christian
P.SI'll be unavailable until end of next week.[1] https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/qualification/l2cap-pics.rst#n320
Signature · 1 line
Luiz Augusto von Dentz