Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp391890pxf; Wed, 7 Apr 2021 02:01:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOCxhn3s0GspVLLiB5Un2tAVkTaeMTiTQkxKQ6ZIElXpPD5h/xFhT1025QthTD6kwc/Ni8 X-Received: by 2002:aa7:c9c8:: with SMTP id i8mr3029594edt.193.1617786111150; Wed, 07 Apr 2021 02:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617786111; cv=none; d=google.com; s=arc-20160816; b=vycWYRlJZhOyfLePVF+UhyV+pxoiZkqkIBtOE2kpHkqXkVRj7N00edTM2ryIl/b7Kh OLFD6rEFdbdFrCvENDyASbIA89rsxARW8kviR7nR6IKZP6NHGHqAvD5TV2gezSG4bGvz vCsTfHqJO+rmj6+5pkE6xGDz6UsrA3BeWxV7VetU/dtajfRM0vCJQJGNr0aVZZEeowlF vR6STsjXAnTbFd8H+9LpApW1B0QQccJ249+KtoLpv4tqluryNJJC9kRwTcFD6mbjIU6i QRU3VqPfiwsrAogaLY3pW8KKJAzSEIwSmtnQPYaOMHzdg30Ire2K0ZVw7t9bQ9k3SV8F 5Jtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=gm+6bi6v+mLYfJX1lMlECnMzFNfnsO2oahS5mVw3PJs=; b=moZM83kyj0Jfan65IZk4vhTNrSfjG/IKMpJHS3zaNSX2q6ByRkvMq5Fw/q7+e4wsfc rCRu8kUP59Pzlrx0XiyYaXzrsFP+lp8Nyl5zjoOUQzm/E//JF2qktuBRIkiCsuevKzHo nqch+YCQgreFusD67yyWgbhibEHkMn3syLBJ+I/otVyHgP7K8LU4Rc9j+WbCqeyToxnD KtWHoxCwHsIJjvvqBZQTvifjHqsLQO84JyGT0KRn9bJjlSG9nFwJ39D07KZA2X2q4ojL 5CTgG/BAgAA3xXEJ7H8F0CB0rleK9ymxXJ2UwxiXSExpYnKanMhGqB1G2NdkejAhfJkJ qV2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si17933732eji.285.2021.04.07.02.01.14; Wed, 07 Apr 2021 02:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239586AbhDFPnr (ORCPT + 99 others); Tue, 6 Apr 2021 11:43:47 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:44282 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239592AbhDFPnr (ORCPT ); Tue, 6 Apr 2021 11:43:47 -0400 Received: from localhost.localdomain (p4ff9f418.dip0.t-ipconnect.de [79.249.244.24]) by mail.holtmann.org (Postfix) with ESMTPSA id F1463CECA3 for ; Tue, 6 Apr 2021 17:51:20 +0200 (CEST) From: Marcel Holtmann To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: Allow Microsoft extension to indicate curve validation Date: Tue, 6 Apr 2021 17:43:33 +0200 Message-Id: <20210406154333.307275-1-marcel@holtmann.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 --- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/mgmt.c | 5 ++++- net/bluetooth/msft.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 58f7eada26fd..c73ac52af186 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -584,6 +584,7 @@ struct hci_dev { #if IS_ENABLED(CONFIG_BT_MSFTEXT) __u16 msft_opcode; void *msft_data; + bool msft_curve_validity; #endif #if IS_ENABLED(CONFIG_BT_AOSPEXT) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 59f8016c4866..288c1445c232 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -3730,8 +3730,11 @@ static int read_controller_cap(struct sock *sk, struct hci_dev *hdev, /* When the Read Simple Pairing Options command is supported, then * the remote public key validation is supported. + * + * Alternatively, when Microsoft extensions are available, they can + * indicate support for public key validation as well. */ - if (hdev->commands[41] & 0x08) + if ((hdev->commands[41] & 0x08) || hdev->msft_curve_validity) flags |= 0x01; /* Remote public key validation (BR/EDR) */ flags |= 0x02; /* Remote public key validation (LE) */ diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c index 47b104f318e9..b1970467a868 100644 --- a/net/bluetooth/msft.c +++ b/net/bluetooth/msft.c @@ -142,6 +142,9 @@ static bool read_supported_features(struct hci_dev *hdev, msft->evt_prefix_len = rp->evt_prefix_len; msft->features = __le64_to_cpu(rp->features); + if (msft->features & MSFT_FEATURE_MASK_CURVE_VALIDITY) + hdev->msft_curve_validity = true; + kfree_skb(skb); return true; -- 2.30.2