Skip to content

Commit a61d671

Browse files
committed
Bluetooth: Allow Microsoft extension to indicate curve validation
Some controllers don't support the Simple Pairing Options feature that can indicate the support for P-192 and P-256 public key validation. However they might support the Microsoft vendor extension that can indicate the validiation capability as well. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent ba29d03 commit a61d671

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ struct hci_dev {
584584
#if IS_ENABLED(CONFIG_BT_MSFTEXT)
585585
__u16 msft_opcode;
586586
void *msft_data;
587+
bool msft_curve_validity;
587588
#endif
588589

589590
#if IS_ENABLED(CONFIG_BT_AOSPEXT)

net/bluetooth/mgmt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3730,8 +3730,11 @@ static int read_controller_cap(struct sock *sk, struct hci_dev *hdev,
37303730

37313731
/* When the Read Simple Pairing Options command is supported, then
37323732
* the remote public key validation is supported.
3733+
*
3734+
* Alternatively, when Microsoft extensions are available, they can
3735+
* indicate support for public key validation as well.
37333736
*/
3734-
if (hdev->commands[41] & 0x08)
3737+
if ((hdev->commands[41] & 0x08) || msft_curve_validity(hdev))
37353738
flags |= 0x01; /* Remote public key validation (BR/EDR) */
37363739

37373740
flags |= 0x02; /* Remote public key validation (LE) */

net/bluetooth/msft.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ static bool read_supported_features(struct hci_dev *hdev,
142142
msft->evt_prefix_len = rp->evt_prefix_len;
143143
msft->features = __le64_to_cpu(rp->features);
144144

145+
if (msft->features & MSFT_FEATURE_MASK_CURVE_VALIDITY)
146+
hdev->msft_curve_validity = true;
147+
145148
kfree_skb(skb);
146149
return true;
147150

@@ -605,3 +608,8 @@ int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
605608

606609
return err;
607610
}
611+
612+
bool msft_curve_validity(struct hci_dev *hdev)
613+
{
614+
return hdev->msft_curve_validity;
615+
}

net/bluetooth/msft.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ int msft_remove_monitor(struct hci_dev *hdev, struct adv_monitor *monitor,
2222
u16 handle);
2323
void msft_req_add_set_filter_enable(struct hci_request *req, bool enable);
2424
int msft_set_filter_enable(struct hci_dev *hdev, bool enable);
25+
bool msft_curve_validity(struct hci_dev *hdev);
2526

2627
#else
2728

@@ -54,4 +55,9 @@ static inline int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
5455
return -EOPNOTSUPP;
5556
}
5657

58+
static inline bool msft_curve_validity(struct hci_dev *hdev)
59+
{
60+
return false;
61+
}
62+
5763
#endif

0 commit comments

Comments
 (0)