Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Patch einfügen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
Slevin
n00b
n00b


Joined: 23 Jan 2012
Posts: 29

PostPosted: Wed Mar 21, 2012 11:05 am    Post subject: Patch einfügen Reply with quote

Hallo,
ich hatte vor kurzem ein Problem mit der Deaktivierung der Verschlüsselung an meinem Bluetooth-Dongle. Da mir leider niemand helfen konnte, habe ich mich damit direkt an die BlueZ-Entwickler gewendet, welche mir eine Lösung geboten haben:
Quote:
If you want to decode the encrypted sniffed data then you have to configure your sniffing set-up appropriately. Normally this requires observing the pairing process so that the sniffer can also compute the link key (and therefore encryption key). If using Bluetooth v2.0 and earlier you may be able to enter the PIN code you are going to use in the sniffing tool prior to performing pairing. If using Bluetooth v2.1 and later you will need to configure one of the Bluetooth devices to enter "SSP debug mode".

For the latter (Bluetooth v2.1 and later) case, we have a patch that adds the ability to enable/disable SSP debug mode using the hciconfig tool - I'll push it out to the mailing list as soon as possible, as it appears it would be useful for others.

So nun habe ich diesen Patch erhalten. Ich als Windows-Anwender habe bisher unter einem "Patch" jedoch immer ein Programm verstanden, welches ich nur doppelklicken brauch und mir automatisch alle neuen/veränderten Komponenten installiert werden.
Der Patch den ich erhalte habe ist allerdings ein Quellcode:
Quote:
Enabling configuration of the Secure Simple Pairing Debug Mode
with hciconfig. Includes supporting changes to the HCI library
functions.

Code:
---
 lib/hci.c         |   28 ++++++++++++++++++++++++++++
 lib/hci.h         |    2 +-
 lib/hci_lib.h     |    2 ++
 tools/hciconfig.8 |    6 ++++++
 tools/hciconfig.c |   25 +++++++++++++++++++++++++
 5 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/lib/hci.c b/lib/hci.c
index 269c021..52f9b33 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -2735,6 +2735,34 @@ int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock,
        return 0;
 }

+int hci_write_simple_pairing_debug_mode(int dd, uint8_t mode, int to)
+{
+       write_simple_pairing_debug_mode_cp cp;
+       write_simple_pairing_debug_mode_rp rp;
+       struct hci_request rq;
+
+       memset(&cp, 0, sizeof(cp));
+       cp.mode = mode;
+
+       memset(&rq, 0, sizeof(rq));
+       rq.ogf    = OGF_TESTING_CMD;
+       rq.ocf    = OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE;
+       rq.cparam = &cp;
+       rq.clen   = WRITE_SIMPLE_PAIRING_DEBUG_MODE_CP_SIZE;
+       rq.rparam = &rp;
+       rq.rlen   = WRITE_SIMPLE_PAIRING_DEBUG_MODE_RP_SIZE;
+
+       if (hci_send_req(dd, &rq, to) < 0)
+               return -1;
+
+       if (rp.status) {
+               errno = EIO;
+               return -1;
+       }
+
+       return 0;
+}
+
 int hci_le_set_scan_enable(int dd, uint8_t enable, uint8_t filter_dup, int to)
 {
        struct hci_request rq;
diff --git a/lib/hci.h b/lib/hci.h
index 887a860..5fab92d 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -1428,7 +1428,7 @@ typedef struct {
 #define WRITE_REMOTE_AMP_ASSOC_RP_SIZE 2

 /* Testing commands */
-#define OGF_TESTING_CMD                0x3e
+#define OGF_TESTING_CMD                0x06

 #define OCF_READ_LOOPBACK_MODE                 0x0001

diff --git a/lib/hci_lib.h b/lib/hci_lib.h
index 725eb05..9555b5f 100644
--- a/lib/hci_lib.h
+++ b/lib/hci_lib.h
@@ -115,6 +115,8 @@ int hci_read_rssi(int dd, uint16_t handle, int8_t *rssi, int to);
 int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int to);
 int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint16_t *accuracy, int to);

+int hci_write_simple_pairing_debug_mode(int dd, uint8_t mode, int to);
+
 int hci_le_set_scan_enable(int dev_id, uint8_t enable, uint8_t filter_dup, int to);
 int hci_le_set_scan_parameters(int dev_id, uint8_t type, uint16_t interval,
                                        uint16_t window, uint8_t own_type,
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


Mein Problem ist nun, dass ich nicht weiß was ich mit diesem Code anfangen soll. Vermutlich muss ich dies *irgendwo* hineinkopieren... aber wo?
Die genannten Dateien lib/hci.c, lib/hci.h, lib/hci_lib.h, tools/hciconfig.8 und tools/hciconfig.c habe ich beim Durchstöbern meines bluetooth-Ordners nicht finden können.
Ich hoffe, ihr könnt mir helfen.

Grüße,
Slevin
Back to top
View user's profile Send private message
franzf
Advocate
Advocate


Joined: 29 Mar 2005
Posts: 4565

PostPosted: Wed Mar 21, 2012 12:32 pm    Post subject: Reply with quote

http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?style=printable&part=3&chap=6#doc_chap6
Punkt 6.f ist es. Sollte erstmal genug zum Lesen und Ausprobieren sein :wink:

Ansonsten gibt's natürlich noch den direkten Weg über ein lokales Overlay, in das du dein bearbeitetes ebuild einfügst.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3921
Location: Hamburg

PostPosted: Wed Mar 21, 2012 1:51 pm    Post subject: Reply with quote

Genau, für meinen Intel Graphic Treiber z.B. sieht das bei mir so aus :
Code:
tfoerste@n22 ~ $ ls -l /etc/portage/patches/x11-drivers/xf86-video-intel-2.18.0/
total 36
-rw-r----- 1 tfoerste portage  1525 Mar 19 19:18 1c2932e.patch
-rw-rw---- 1 root     portage 16006 Mar  4 21:49 3c4f298.patch
-rw-rw---- 1 root     portage 14671 Mar 15 16:39 c5c61ef..0e2fbb6.patch
Back to top
View user's profile Send private message
Josef.95
Advocate
Advocate


Joined: 03 Sep 2007
Posts: 4520
Location: Germany

PostPosted: Wed Mar 21, 2012 4:02 pm    Post subject: Reply with quote

Siehe eventuell auch mal hier --> http://www.gentooforum.de/artikel/16303/wie-man-einen-patch-einspielt.html
Back to top
View user's profile Send private message
Slevin
n00b
n00b


Joined: 23 Jan 2012
Posts: 29

PostPosted: Thu Mar 22, 2012 3:37 pm    Post subject: Reply with quote

Danke für die Hilfe!
Der Patch ist nun installiert und die gewünschte Option "sspdebug" ist vorhanden.
Leider ergibt sich damit gleich das nächste Problem. Ich weiß nämlich nicht wie ich diesen Befehl verwenden muss. In der hciconfig ist lediglich folgendes dokumentiert:
Quote:
sspdebug <mode>
This command sets the Simple Pairing debug mode to mode. Debug mode allows Bluetooth air sniffers to decode data when encryption is used. As such enabling debug mode represents a security risk.

Nun habe ich es mit
Code:
hciconfig hci0 sspdebug

und
Code:
hciconfig hci0 sspdebug enable

versucht, leider ohne Erfolg. Es kam zwar keine Fehlermeldung in beiden Fällen, aber mein Air Sniffer konnte die Daten weiterhin nicht dekodieren.
Da dieser Patch ganz neu ist, finde ich auch leider im Netz nichts dazu. Vielleicht habt ihr eine Idee zur korrekten Syntax?
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Thu Mar 22, 2012 11:54 pm    Post subject: Reply with quote

Dem Patch nach ist "mode" eine Integerzahl.
Back to top
View user's profile Send private message
Slevin
n00b
n00b


Joined: 23 Jan 2012
Posts: 29

PostPosted: Fri Mar 23, 2012 10:57 am    Post subject: Reply with quote

Ja, tatäschlich.
1 = enabled
0 = disabled
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum