Skip to content

Commit 288c069

Browse files
apusakaholtmann
authored andcommitted
Bluetooth: Enforce key size of 16 bytes on FIPS level
According to the spec Ver 5.2, Vol 3, Part C, Sec 5.2.2.8: Device in security mode 4 level 4 shall enforce: 128-bit equivalent strength for link and encryption keys required using FIPS approved algorithms (E0 not allowed, SAFER+ not allowed, and P-192 not allowed; encryption key not shortened) This patch rejects connection with key size below 16 for FIPS level services. Signed-off-by: Archie Pusaka <[email protected]> Reviewed-by: Alain Michaud <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 0d484db commit 288c069

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

net/bluetooth/l2cap_core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,8 +1515,14 @@ static bool l2cap_check_enc_key_size(struct hci_conn *hcon)
15151515
* that have no key size requirements. Ensure that the link is
15161516
* actually encrypted before enforcing a key size.
15171517
*/
1518+
int min_key_size = hcon->hdev->min_enc_key_size;
1519+
1520+
/* On FIPS security level, key size must be 16 bytes */
1521+
if (hcon->sec_level == BT_SECURITY_FIPS)
1522+
min_key_size = 16;
1523+
15181524
return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) ||
1519-
hcon->enc_key_size >= hcon->hdev->min_enc_key_size);
1525+
hcon->enc_key_size >= min_key_size);
15201526
}
15211527

15221528
static void l2cap_do_start(struct l2cap_chan *chan)

0 commit comments

Comments
 (0)