All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Bluetooth: Fix OOB data present value for BR/EDR Secure Connections
@ 2015-01-31  7:10 Marcel Holtmann
  0 siblings, 0 replies; only message in thread
From: Marcel Holtmann @ 2015-01-31  7:10 UTC (permalink / raw)
  To: linux-bluetooth

When BR/EDR Secure Connections has been enabled, the OOB data present
value can take 2 additional values. The host has to clearly provide
details about if P-192 OOB data, P-256 OOB data or a combination of
P-192 and P-256 OOB data is present.

In case BR/EDR Secure Connections is not enabled or not supported,
then check that P-192 OOB data is actually present and return the
correct value based on that.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_event.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 055625b7368f..7333f5ce444d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3881,8 +3881,25 @@ static u8 bredr_oob_data_present(struct hci_conn *conn)
 	     !memcmp(data->hash256, ZERO_KEY, 16)))
 		return 0x00;
 
-	if (conn->out || test_bit(HCI_CONN_REMOTE_OOB, &conn->flags))
+	if (conn->out || test_bit(HCI_CONN_REMOTE_OOB, &conn->flags)) {
+		/* When Secure Connections has been enabled, then just
+		 * return the present value stored with the OOB data. It
+		 * will contain the right information about which data
+		 * is present.
+		 */
+		if (bredr_sc_enabled(hdev)
+			return data->present;
+
+		/* When Secure Connections is not enabled or actually
+		 * not supported by the hardare, then check that if
+		 * P-192 data values are present.
+		 */
+		if (!memcmp(data->rand256, ZERO_KEY, 16) ||
+		    !memcmp(data->hash256, ZERO_KEY, 16))
+			return 0x00;
+
 		return 0x01;
+	}
 
 	return 0x00;
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-31  7:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-31  7:10 [PATCH 2/2] Bluetooth: Fix OOB data present value for BR/EDR Secure Connections Marcel Holtmann

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.