2021-05-19 20:22:10

by Gix, Brian

[permalink] [raw]
Subject: [PATCH BlueZ v3 0/6] OOB Authentication improvements

This patch set fixes some minor bugs, and adds explicit support for all
currently supported Provisioning authentication methods.

v2: Added prov-acceptor queuing, and fixed whitespace issues

v3: Fixed spelling errors and added patch to address memory leak

Brian Gix (6):
mesh: Fix delivery of PB-ACK to acceptors
mesh: Normalize endian of public/private ECC keys
tools/mesh: Add all supported OOB methods to cfgclient
test/mesh: Add support for testing more OOB auth
mesh: Add single threading to prov-acp ob messaging
mesh: Fix race condition memory leak

mesh/mesh-io-generic.c | 2 +
mesh/pb-adv.c | 1 -
mesh/prov-acceptor.c | 96 +++++++++++++++++++++++++++---------------
mesh/prov-initiator.c | 3 ++
mesh/provision.h | 1 +
test/agent.py | 23 ++++++++++
tools/mesh-cfgclient.c | 32 +++++++++++---
7 files changed, 118 insertions(+), 40 deletions(-)

--
2.25.4



2021-05-19 20:22:40

by Gix, Brian

[permalink] [raw]
Subject: [PATCH BlueZ v3 6/6] mesh: Fix race condition memory leak

This is a minor fix of a memory leak triggered on process exit if
proceess has been killed right after requesting an outbound
advertisement be sent. It is harmless, but will cause an occasional
static analysis failure.
---
mesh/mesh-io-generic.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/mesh/mesh-io-generic.c b/mesh/mesh-io-generic.c
index 4eb7f27ce..6c0b8f0fd 100644
--- a/mesh/mesh-io-generic.c
+++ b/mesh/mesh-io-generic.c
@@ -462,7 +462,9 @@ static bool dev_destroy(struct mesh_io *io)
bt_hci_unref(pvt->hci);
l_timeout_remove(pvt->tx_timeout);
l_queue_destroy(pvt->rx_regs, l_free);
+ l_queue_remove_if(pvt->tx_pkts, simple_match, pvt->tx);
l_queue_destroy(pvt->tx_pkts, l_free);
+ l_free(pvt->tx);
l_free(pvt);
io->pvt = NULL;

--
2.25.4


2021-05-19 20:23:59

by Gix, Brian

[permalink] [raw]
Subject: [PATCH BlueZ v3 3/6] tools/mesh: Add all supported OOB methods to cfgclient

To support the widest range of mesh devices, we need to support any
possible capability combinations that a remote device may request.
---
tools/mesh-cfgclient.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c
index 49069674f..a4a6f21ab 100644
--- a/tools/mesh-cfgclient.c
+++ b/tools/mesh-cfgclient.c
@@ -104,7 +104,17 @@ static struct model_info *cfgcli;
static struct l_queue *devices;

static bool prov_in_progress;
-static const char *caps[] = {"static-oob", "out-numeric", "in-numeric"};
+static const char * const caps[] = {"static-oob",
+ "push",
+ "twist",
+ "blink",
+ "beep",
+ "vibrate",
+ "public-oob",
+ "out-alpha",
+ "in-alpha",
+ "out-numeric",
+ "in-numeric"};

static bool have_config;

@@ -419,7 +429,7 @@ static void agent_input_done(oob_type_t type, void *buf, uint16_t len,
struct l_dbus_message *reply = NULL;
struct l_dbus_message_builder *builder;
uint32_t val_u32;
- uint8_t oob_data[16];
+ uint8_t oob_data[64];

switch (type) {
case NONE:
@@ -435,15 +445,15 @@ static void agent_input_done(oob_type_t type, void *buf, uint16_t len,
/* Fall Through */

case HEXADECIMAL:
- if (len > 16) {
+ if (len > sizeof(oob_data)) {
bt_shell_printf("Bad input length\n");
break;
}
- memset(oob_data, 0, 16);
+ memset(oob_data, 0, sizeof(oob_data));
memcpy(oob_data, buf, len);
reply = l_dbus_message_new_method_return(msg);
builder = l_dbus_message_builder_new(reply);
- append_byte_array(builder, oob_data, 16);
+ append_byte_array(builder, oob_data, len);
l_dbus_message_builder_finalize(builder);
l_dbus_message_builder_destroy(builder);
break;
@@ -580,6 +590,16 @@ static struct l_dbus_message *prompt_numeric_call(struct l_dbus *dbus,
return NULL;
}

+static struct l_dbus_message *prompt_public_call(struct l_dbus *dbus,
+ struct l_dbus_message *msg,
+ void *user_data)
+{
+ l_dbus_message_ref(msg);
+ agent_input_request(HEXADECIMAL, 64, "Enter 512 bit Public Key",
+ agent_input_done, msg);
+ return NULL;
+}
+
static struct l_dbus_message *prompt_static_call(struct l_dbus *dbus,
struct l_dbus_message *msg,
void *user_data)
@@ -618,6 +638,8 @@ static void setup_agent_iface(struct l_dbus_interface *iface)
"u", "s", "number", "type");
l_dbus_interface_method(iface, "PromptStatic", 0, prompt_static_call,
"ay", "s", "data", "type");
+ l_dbus_interface_method(iface, "PublicKey", 0, prompt_public_call,
+ "ay", "", "data");
}

static bool register_agent(void)
--
2.25.4