2014-05-19 10:53:41

by Andrzej Kaczmarek

[permalink] [raw]
Subject: [PATCH 1/2] emulator/bthost: Add support to set auth_req for bthost

This patch makes possible to set Authentication_Requirements to be used
in io_capa_request_reply when replying for io_capa_request_evt.
---
emulator/bthost.c | 8 +++++++-
emulator/bthost.h | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/emulator/bthost.c b/emulator/bthost.c
index 1e3123a..298edcf 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -206,6 +206,7 @@ struct bthost {
uint8_t pin[16];
uint8_t pin_len;
uint8_t io_capability;
+ uint8_t auth_req;
bool reject_user_confirm;
void *smp_data;
bool conn_init;
@@ -997,7 +998,7 @@ static void evt_io_cap_request(struct bthost *bthost, const void *data,
memcpy(cp.bdaddr, ev->bdaddr, 6);
cp.capability = bthost->io_capability;
cp.oob_data = 0x00;
- cp.authentication = 0x00;
+ cp.authentication = bthost->auth_req;

send_command(bthost, BT_HCI_CMD_IO_CAPABILITY_REQUEST_REPLY,
&cp, sizeof(cp));
@@ -2146,6 +2147,11 @@ void bthost_set_io_capability(struct bthost *bthost, uint8_t io_capability)
bthost->io_capability = io_capability;
}

+void bthost_set_auth_req(struct bthost *bthost, uint8_t auth_req)
+{
+ bthost->auth_req = auth_req;
+}
+
void bthost_set_reject_user_confirm(struct bthost *bthost, bool reject)
{
bthost->reject_user_confirm = reject;
diff --git a/emulator/bthost.h b/emulator/bthost.h
index 4933b33..b00bcd6 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -87,6 +87,7 @@ void bthost_add_l2cap_server(struct bthost *bthost, uint16_t psm,
void bthost_set_pin_code(struct bthost *bthost, const uint8_t *pin,
uint8_t pin_len);
void bthost_set_io_capability(struct bthost *bthost, uint8_t io_capability);
+void bthost_set_auth_req(struct bthost *bthost, uint8_t auth_req);
void bthost_set_reject_user_confirm(struct bthost *bthost, bool reject);

typedef void (*bthost_rfcomm_connect_cb) (uint16_t handle, uint16_t cid,
--
1.9.3



2014-05-19 11:15:12

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/2] emulator/bthost: Add support to set auth_req for bthost

Hi Andrzej,

On Mon, May 19, 2014, Andrzej Kaczmarek wrote:
> This patch makes possible to set Authentication_Requirements to be used
> in io_capa_request_reply when replying for io_capa_request_evt.
> ---
> emulator/bthost.c | 8 +++++++-
> emulator/bthost.h | 1 +
> 2 files changed, 8 insertions(+), 1 deletion(-)

Both patches have been applied. Thanks.

Johan

2014-05-19 10:53:42

by Andrzej Kaczmarek

[permalink] [raw]
Subject: [PATCH 2/2] tools/mgmt-tester: Fix "Pair Device - SSP Confirm Reject 1"

With changes introduced in kernel by 6fd6b915 we no longer require MITM
when being pairing initiator (i.e. we indicate it to remote but do not
force it when remote does not require it) thus kernel will auto-accept
pairing when remote also does not require MITM. As a result it's not
possible for tester to reject user confirmation since there's no
request from kernel.

This patch sets acceptor authentication requirements to include MITM
so we'll have user confirmation request and tester can reject it.
---
tools/mgmt-tester.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index a8b14e4..4cc7ba4 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -392,6 +392,7 @@ struct generic_data {
bool client_enable_ssp;
uint8_t io_cap;
uint8_t client_io_cap;
+ uint8_t client_auth_req;
bool reject_ssp;
bool client_reject_ssp;
};
@@ -2423,6 +2424,7 @@ static const struct generic_data pair_device_ssp_reject_1 = {
.expect_hci_func = client_bdaddr_param_func,
.io_cap = 0x01, /* DisplayYesNo */
.client_io_cap = 0x01, /* DisplayYesNo */
+ .client_auth_req = 0x01, /* No Bonding - MITM */
.reject_ssp = true,
};

@@ -3128,6 +3130,9 @@ static void test_setup(const void *test_data)
if (test->client_io_cap)
bthost_set_io_capability(bthost, test->client_io_cap);

+ if (test->client_auth_req)
+ bthost_set_auth_req(bthost, test->client_auth_req);
+
if (test->client_reject_ssp)
bthost_set_reject_user_confirm(bthost, true);

--
1.9.3