[PATCH 06/18] adapter: Handle missing randomizer in btd_adapter_add_remote_oob_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Randomizer is optional. Handling missing randomizer in
btd_adapter_add_remote_oob_data is easy and will simplify caller code.

---
 plugins/dbusoob.c |    7 -------
 src/adapter.c     |    7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
index a66c21d..ce9e5d4 100644
--- a/plugins/dbusoob.c
+++ b/plugins/dbusoob.c
@@ -233,13 +233,6 @@ static gboolean store_data(struct btd_adapter *adapter, struct oob_data *data)
 	adapter_get_address(adapter, &local);
 
 	if (data->hash) {
-		uint8_t empty_randomizer[16];
-
-		if (!data->randomizer) {
-			memset(empty_randomizer, 0, sizeof(empty_randomizer));
-			data->randomizer = empty_randomizer;
-		}
-
 		if (btd_adapter_add_remote_oob_data(adapter, &bdaddr,
 					data->hash, data->randomizer) < 0)
 			return FALSE;
diff --git a/src/adapter.c b/src/adapter.c
index d34e966..a00522a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3574,6 +3574,13 @@ int btd_adapter_read_local_oob_data(struct btd_adapter *adapter)
 int btd_adapter_add_remote_oob_data(struct btd_adapter *adapter,
 			bdaddr_t *bdaddr, uint8_t *hash, uint8_t *randomizer)
 {
+	uint8_t empty_randomizer[16];
+
+	if (!randomizer) {
+		memset(empty_randomizer, 0, sizeof(empty_randomizer));
+		randomizer = empty_randomizer;
+	}
+
 	return mgmt_add_remote_oob_data(adapter->dev_id, bdaddr, hash,
 								randomizer);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux