[PATCH v3 3/3] Add SSP debug mode configuration to hciconfig

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

 



This patch adds the "sspdebug" command to the hciconfig tool.
This command can be used to configure Secure Simple Pairing debug mode
on a specified Bluetooth controller.

Example for enabling SSP debug mode:
    hciconfig -a hciX sspdebug 1

Example for disabling SSP debug mode:
    hciconfig -a hciX sspdebug 0
---
 tools/hciconfig.8 |    6 ++++++
 tools/hciconfig.c |   25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/tools/hciconfig.8 b/tools/hciconfig.8
index 35956c4..88282f1 100644
--- a/tools/hciconfig.8
+++ b/tools/hciconfig.8
@@ -197,6 +197,12 @@ With no
 prints out the current Simple Pairing mode. Otherwise, sets Simple Pairing mode to
 .IR mode .
 .TP
+.BI sspdebug " <mode>"
+This command sets the Simple Pairing debug mode to
+.IR mode .
+Debug mode allows Bluetooth air sniffers to decode data when encryption is
+used.  As such enabling debug mode represents a security risk.
+.TP
 \fBaclmtu\fP \fImtu\fP:\fIpkt\fP
 Sets ACL MTU to
 to
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index f1458b9..72bd85f 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -1653,6 +1653,30 @@ static void cmd_ssp_mode(int ctl, int hdev, char *opt)
        }
 }

+
+static void cmd_ssp_debug(int ctl, int hdev, char *opt)
+{
+       int dd;
+       uint8_t mode;
+
+       if (!opt)
+               return;
+
+       dd = hci_open_dev(hdev);
+       if (dd < 0) {
+               fprintf(stderr, "Can't open device hci%d: %s (%d)\n",
+                                               hdev, strerror(errno), errno);
+               exit(1);
+       }
+
+       mode = atoi(opt);
+       if (hci_write_simple_pairing_debug_mode(dd, mode, 2000) < 0) {
+               fprintf(stderr, "Can't set Simple Pairing Debug mode on hci%d: %s (%d)\n",
+                               hdev, strerror(errno), errno);
+               exit(1);
+       }
+}
+
 static void print_rev_ericsson(int dd)
 {
        struct hci_request rq;
@@ -1920,6 +1944,7 @@ static struct {
        { "pageto",     cmd_page_to,    "[to]",         "Get/Set page timeout" },
        { "afhmode",    cmd_afh_mode,   "[mode]",       "Get/Set AFH mode" },
        { "sspmode",    cmd_ssp_mode,   "[mode]",       "Get/Set Simple Pairing Mode" },
+       { "sspdebug",   cmd_ssp_debug,  "<mode>",       "Set Simple Pairing Debug Mode" },
        { "aclmtu",     cmd_aclmtu,     "<mtu:pkt>",    "Set ACL MTU and number of packets" },
        { "scomtu",     cmd_scomtu,     "<mtu:pkt>",    "Set SCO MTU and number of packets" },
        { "putkey",     cmd_putkey,     "<bdaddr>",     "Store link key on the device" },
--
1.7.0.4





________________________________
Subject to local law, communications with Accenture and its affiliates including telephone calls and emails (including content), may be monitored by our systems for the purposes of security and the assessment of internal compliance with Accenture policy.
______________________________________________________________________________________

www.accenture.com

--
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