All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Always request for user confirmation for Just Works
@ 2020-03-28  0:09 Sonny Sasaka
  0 siblings, 0 replies; 4+ messages in thread
From: Sonny Sasaka @ 2020-03-28  0:09 UTC (permalink / raw
  To: BlueZ

To improve security, always give the user-space daemon a chance to
accept or reject a Just Works pairing (LE). The daemon may decide to
auto-accept based on the user's intent.

Signed-off-by: Sonny Sasaka <sonnysasaka@chromium.org>
---
 net/bluetooth/smp.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 1476a91ce935..d0b695ee49f6 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -855,6 +855,7 @@ static int tk_request(struct l2cap_conn *conn, u8
remote_oob, u8 auth,
  struct smp_chan *smp = chan->data;
  u32 passkey = 0;
  int ret = 0;
+ int err;

  /* Initialize key for JUST WORKS */
  memset(smp->tk, 0, sizeof(smp->tk));
@@ -883,9 +884,16 @@ static int tk_request(struct l2cap_conn *conn, u8
remote_oob, u8 auth,
     hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT)
  smp->method = JUST_WORKS;

- /* If Just Works, Continue with Zero TK */
+ /* If Just Works, Continue with Zero TK and ask user-space for
+ * confirmation */
  if (smp->method == JUST_WORKS) {
- set_bit(SMP_FLAG_TK_VALID, &smp->flags);
+ err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
+ hcon->type,
+ hcon->dst_type,
+ passkey, 1);
+ if (err)
+ return SMP_UNSPECIFIED;
+ set_bit(SMP_FLAG_WAIT_USER, &smp->flags);
  return 0;
  }

-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Bluetooth: Always request for user confirmation for Just Works
@ 2020-03-28  0:34 Sonny Sasaka
  2020-03-30 22:24 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Sonny Sasaka @ 2020-03-28  0:34 UTC (permalink / raw
  To: linux-bluetooth; +Cc: Sonny Sasaka, Sonny Sasaka

From: Sonny Sasaka <sonnysasaka@gmail.com>

To improve security, always give the user-space daemon a chance to
accept or reject a Just Works pairing (LE). The daemon may decide to
auto-accept based on the user's intent.

Signed-off-by: Sonny Sasaka <sonnysasaka@chromium.org>
---
 net/bluetooth/smp.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 1476a91ce935..d0b695ee49f6 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -855,6 +855,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
 	struct smp_chan *smp = chan->data;
 	u32 passkey = 0;
 	int ret = 0;
+	int err;
 
 	/* Initialize key for JUST WORKS */
 	memset(smp->tk, 0, sizeof(smp->tk));
@@ -883,9 +884,16 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
 	    hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT)
 		smp->method = JUST_WORKS;
 
-	/* If Just Works, Continue with Zero TK */
+	/* If Just Works, Continue with Zero TK and ask user-space for
+	 * confirmation */
 	if (smp->method == JUST_WORKS) {
-		set_bit(SMP_FLAG_TK_VALID, &smp->flags);
+		err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
+						hcon->type,
+						hcon->dst_type,
+						passkey, 1);
+		if (err)
+			return SMP_UNSPECIFIED;
+		set_bit(SMP_FLAG_WAIT_USER, &smp->flags);
 		return 0;
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: Always request for user confirmation for Just Works
  2020-03-28  0:34 [PATCH] Bluetooth: Always request for user confirmation for Just Works Sonny Sasaka
@ 2020-03-30 22:24 ` Marcel Holtmann
  2020-03-30 23:14   ` Sonny Sasaka
  0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2020-03-30 22:24 UTC (permalink / raw
  To: Sonny Sasaka; +Cc: Bluetooth Kernel Mailing List, Sonny Sasaka

Hi Sonny,

> To improve security, always give the user-space daemon a chance to
> accept or reject a Just Works pairing (LE). The daemon may decide to
> auto-accept based on the user's intent.
> 
> Signed-off-by: Sonny Sasaka <sonnysasaka@chromium.org>
> ---
> net/bluetooth/smp.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: Always request for user confirmation for Just Works
  2020-03-30 22:24 ` Marcel Holtmann
@ 2020-03-30 23:14   ` Sonny Sasaka
  0 siblings, 0 replies; 4+ messages in thread
From: Sonny Sasaka @ 2020-03-30 23:14 UTC (permalink / raw
  To: Marcel Holtmann; +Cc: Bluetooth Kernel Mailing List, Sonny Sasaka

Thanks, Marcel.

On Mon, Mar 30, 2020 at 3:24 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Sonny,
>
> > To improve security, always give the user-space daemon a chance to
> > accept or reject a Just Works pairing (LE). The daemon may decide to
> > auto-accept based on the user's intent.
> >
> > Signed-off-by: Sonny Sasaka <sonnysasaka@chromium.org>
> > ---
> > net/bluetooth/smp.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
>
> patch has been applied to bluetooth-next tree.
>
> Regards
>
> Marcel
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-30 23:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-28  0:34 [PATCH] Bluetooth: Always request for user confirmation for Just Works Sonny Sasaka
2020-03-30 22:24 ` Marcel Holtmann
2020-03-30 23:14   ` Sonny Sasaka
  -- strict thread matches above, loose matches on Subject: below --
2020-03-28  0:09 Sonny Sasaka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.