1 00:00:02,820 --> 00:00:07,940 Hello all and welcome to the last and most exciting day at the Wireless Village. 2 00:00:08,160 --> 00:00:13,600 My name is Zero and on behalf of the Wireless Village team I'm very happy to introduce Adrian Chad. 3 00:00:13,600 --> 00:00:25,640 Adrian came up to us during our training class at B-Sides in Las Vegas and said, oh, hi guys, I worked on the Atheros HAL code and it's my fault that it's all open source now. 4 00:00:26,260 --> 00:00:28,060 He's a B-S-D developer. 5 00:00:28,060 --> 00:00:30,120 We're not going to hold that against him for right now. 6 00:00:30,240 --> 00:00:37,000 So without further ado, I'm going to introduce the man who said, if I wanted to, I could win your CTF, but I don't want to. 7 00:00:38,280 --> 00:00:39,360 It's true. 8 00:00:40,440 --> 00:00:41,600 Hi, I'm Adrian. 9 00:00:43,180 --> 00:00:52,680 I, as a brief introduction, I worked at Atheros about the time they got bought by Qualcomm so I got to experience both the happy side of it and the not so happy side of it. 10 00:00:53,900 --> 00:01:00,340 So before we begin, I'm one of the dirty bastards who signed the NDA to get access to all the shiny toys. 11 00:01:00,600 --> 00:01:03,800 So everything that I'm about to tell you, you can actually figure out for yourself. 12 00:01:03,800 --> 00:01:09,720 I'm not going to tell you anything that you shouldn't be able to figure out by reading the available source code and all of their patent filings. 13 00:01:10,120 --> 00:01:18,120 And if you really want to dig into it, there's a bunch of IEEE presentations from the silicon people talking about the interesting crap they do in silicon. 14 00:01:19,280 --> 00:01:24,460 And I really hate writing slides and I really hate drawing diagrams. 15 00:01:24,960 --> 00:01:27,040 And all the diagrams I have are under NDA. 16 00:01:27,040 --> 00:01:34,340 So I suggest if you're actually interested in a picture representation of how the chip looks, do some Google searches of your own. 17 00:01:34,340 --> 00:01:39,220 I went and did some Google searches and there's some stuff out there, but they're in leaked data sheets. 18 00:01:39,220 --> 00:01:43,020 And for obvious reasons, I'm not going to post linked data sheets on a recorded talk. 19 00:01:44,800 --> 00:01:46,220 But it's all out there. 20 00:01:46,220 --> 00:01:57,440 So the Atheros hardware, the first thing that people think is going on inside it is that there's a CPU doing all the cool shit. 21 00:01:57,480 --> 00:02:09,040 And back in the day of the Prism and Prism 2 chips, there actually is a DSP in them that's actually doing a large part of the Mac and Fire related activity for the DSSS and the CCK encoding and decoding. 22 00:02:09,040 --> 00:02:13,160 However, there is no CPU in the core of the Atheros chips. 23 00:02:13,240 --> 00:02:24,520 By design, they put everything into silicon and anything that would run in a CPU, they punt to the host operating system driver, which gives us all the shiny toys that we have. 24 00:02:24,640 --> 00:02:37,720 So the bits that are interesting is the Mac, which implements all the 802.11 data level bits, like generating frames, doing RTS, CTS, contention, back off, all the timer related stuff. 25 00:02:37,720 --> 00:02:43,560 And you can see this is a great big DMA engine with thousands of little timers implementing 802.11. 26 00:02:43,720 --> 00:02:47,000 There's the fire that does all of the actual physical layer encoding. 27 00:02:47,000 --> 00:02:50,040 So that's doing CCK, OFDM, encoding and decoding. 28 00:02:50,040 --> 00:02:55,060 It has multiple radio, sorry, multiple spatial streams for 11N stuff. 29 00:02:56,140 --> 00:02:59,060 And there's the radio that does all the actual RF bits. 30 00:02:59,080 --> 00:03:05,740 And so the fire takes in and out like a 20, 40 or 80 megahertz wide baseband signal. 31 00:03:06,040 --> 00:03:10,760 And the radio is the thing that steps it up and down to 2 and 5 gig. 32 00:03:10,780 --> 00:03:14,020 The real time clock is clocking and also power control. 33 00:03:14,020 --> 00:03:20,020 So that's the bit of the chip that's bringing everything, bringing power on and off and handling clock generation. 34 00:03:20,840 --> 00:03:31,900 And then there's the host interface, which is the PCI, PCIe, the SDIO, inside the little tiny SOCs that you can get all those TP link and D link access points. 35 00:03:31,900 --> 00:03:35,940 They'll have a single chip with a Wi‑Fi chip on board. 36 00:03:36,160 --> 00:03:45,540 And the chip internal to the SOC is actually connected via a standardized industry protocol called AHB, which means something that I don't remember. 37 00:03:46,720 --> 00:03:50,080 So the MAC consists of some bits that do DMA. 38 00:03:50,700 --> 00:03:58,120 So in ETHEROS terms, the PCU handles the received DMA and the DCU handles TXDMA. 39 00:03:58,480 --> 00:04:02,300 The Q control unit handles implementing all the 802.11 crap. 40 00:04:02,300 --> 00:04:05,140 So if you want to fiddle with timing, I'll explain that in a minute. 41 00:04:05,140 --> 00:04:09,560 The QCU is the thing that you program to modify how 802.11 behavior works. 42 00:04:09,560 --> 00:04:14,480 And the DCU is the bit that just takes packets in and DMAs them into the TX50 and sends them out. 43 00:04:15,960 --> 00:04:19,900 All of the stuff that's time sensitive gets handled by the MAC. 44 00:04:19,900 --> 00:04:23,480 So AC generation, for example, can be done in hardware. 45 00:04:24,500 --> 00:04:28,320 There are timers to program how long it will wait for an AC on the received side. 46 00:04:28,320 --> 00:04:31,240 And you can disable sending AC if you really want to. 47 00:04:31,400 --> 00:04:33,560 And you can disable expecting an AC as well. 48 00:04:33,560 --> 00:04:39,180 RTS and CTS, AMPDU for 802.11 block AC, all of that crap is time sensitive. 49 00:04:39,180 --> 00:04:41,160 There's no point doing it in CPU. 50 00:04:41,400 --> 00:04:49,040 If you're a CPU's interrupt handler, it takes too long, then you'd miss your AC window and crap would be silly. 51 00:04:49,040 --> 00:04:52,620 So all of the time sensitive bits are done in hardware and nothing more. 52 00:04:53,060 --> 00:04:56,420 The PHY handles all of the bits that actually do 802.11 data. 53 00:04:57,060 --> 00:04:59,060 So it handles stuff that goes over the air. 54 00:04:59,060 --> 00:05:03,320 So it does the clear channel detection to figure out when it can transmit. 55 00:05:03,320 --> 00:05:08,560 It does signal detection and signal sizing, antenna selection, all the encoding and decoding. 56 00:05:09,000 --> 00:05:11,020 It handles all the MIMO stuff. 57 00:05:12,060 --> 00:05:16,500 The important thing here is there's one massive PHY in the 11N chips. 58 00:05:16,500 --> 00:05:21,120 And for each physical radio, there's one set of FFTs and IFFTs going on. 59 00:05:21,120 --> 00:05:30,540 And then it funnels all of that crap into one ginormous PHY that's doing all of the signal correlation and processing in silicon inside the PHY. 60 00:05:30,840 --> 00:05:32,480 And it's kind of scary to look at. 61 00:05:32,800 --> 00:05:39,480 The radio handles all the RF synthesis and there's some back chat between the PHY and the radio that I can't talk about. 62 00:05:39,480 --> 00:05:42,220 But most of that's to do with automatic gain control and signal sizing. 63 00:05:42,220 --> 00:05:58,560 So every time that you receive a packet, the first thing the receiver needs to do is figure out how to size the packet to size the signal so that it fills the dynamic range of the ADC but it doesn't saturate it to the point of distorting and screw up receiving it. 64 00:05:58,560 --> 00:06:06,820 So there's a lot of fine and coarse grain automatic gain control going on per packet and per antenna as well on the earlier chips. 65 00:06:07,320 --> 00:06:10,080 There's some filtering going on, and I'll talk about that later. 66 00:06:10,420 --> 00:06:15,760 In the earlier chips, if you've ever popped off the metal shield, there will be two chips. 67 00:06:15,760 --> 00:06:20,780 And the first one is like the AR5212, which implements everything except the radio. 68 00:06:20,780 --> 00:06:23,680 And then they put the radio in an external part. 69 00:06:23,680 --> 00:06:28,220 So you have a 2 gig part and a 5 gig part and then a 2 and a 5 gig part. 70 00:06:28,620 --> 00:06:34,640 And the really early stuff actually generated 2 gig first and then upscaled 2 gig to 5 gig in a separate part. 71 00:06:34,640 --> 00:06:36,300 And all of that's gone away now. 72 00:06:36,300 --> 00:06:52,660 So with improvements with figuring out how to do analog crap inside the same chip, they have one die that has either one or more bits of silicon inside the packaging that does all of the stuff, including base band resistance and RF. 73 00:06:53,980 --> 00:06:59,500 So anything that's 11N after the AR9160 is all one chip. 74 00:07:00,560 --> 00:07:02,880 And that leads to quite a lot better sensitivity. 75 00:07:02,880 --> 00:07:08,520 So just as a side note, the chips get more sensitive on the receive side the further up the chain you go. 76 00:07:08,520 --> 00:07:12,820 So I do my wireless sniffing with AR9280 and AR9380. 77 00:07:12,820 --> 00:07:15,440 They have ridiculously sensitive receive sides. 78 00:07:16,220 --> 00:07:24,120 And the only thing that the radio communicator updates, you can program the radio directly, but you only do that to configure the synth. 79 00:07:24,120 --> 00:07:25,960 You don't actually touch it after that. 80 00:07:26,720 --> 00:07:30,080 And the RTC handles all the crap dealing with clock generation. 81 00:07:30,080 --> 00:07:33,360 What the hell just happened there? 82 00:07:35,220 --> 00:07:36,600 Tech support. 83 00:07:37,660 --> 00:07:38,460 Swipe. 84 00:07:40,500 --> 00:07:46,700 So the RTC handles only clock generation. 85 00:07:46,700 --> 00:07:52,620 So that handles if it's in 5 meg, 10 meg, keep going, yeah. 86 00:07:52,620 --> 00:07:57,100 You know, the chips can do 5 meg, 10 meg, 20 meg, 40 meg channels. 87 00:07:57,100 --> 00:08:02,040 And so one of the parts of figuring out how to do that is they actually clock the chip at a different rate. 88 00:08:03,120 --> 00:08:09,540 And that can happen dynamically as well when you're doing 20 meg to 40 meg dynamic packet stuff in 11n. 89 00:08:10,280 --> 00:08:13,600 So the only thing that you can program when you put the chip to sleep is the RTC. 90 00:08:13,600 --> 00:08:16,400 And the only thing you can tell the RTC to do is wake up the chip. 91 00:08:16,920 --> 00:08:27,000 And so when you're actually a laptop doing power save and you want to put the chip to sleep and have the chip wake up when the access point says there's something for it, this is the thing you're fiddling with. 92 00:08:27,440 --> 00:08:29,760 And the host interface glues all that crap together. 93 00:08:29,760 --> 00:08:34,080 So it's probably not interesting for most of the stuff that people are doing with these things. 94 00:08:34,080 --> 00:08:43,720 But a lot of the bugs that pop up is because there's issues with the PCIe power save on the chip and the laptop getting out of whack and causing the device to go away. 95 00:08:44,580 --> 00:08:46,120 So the Mac in detail. 96 00:08:46,960 --> 00:08:52,920 No one uses anything before the AR5212 these days. 97 00:08:52,920 --> 00:08:54,940 And so I'm not going to worry about the early stuff. 98 00:08:54,940 --> 00:08:58,500 But the new stuff has 10 transmit queues and one receive queue. 99 00:08:58,500 --> 00:09:01,100 And the new and newer stuff has two receive queues. 100 00:09:02,320 --> 00:09:04,880 They're implemented in a priority scheme. 101 00:09:04,880 --> 00:09:13,480 So the lowest transmit queue has the lowest priority and gets preempted by successively higher queues. 102 00:09:13,480 --> 00:09:20,280 Q9 is always for multicast traffic that happens after beaconing and Q10 is always the beacon queue and you can't change that. 103 00:09:20,920 --> 00:09:22,780 And as I said before, they're split into two halves. 104 00:09:22,780 --> 00:09:26,540 There's the control unit and the queue control unit and the data control unit. 105 00:09:26,620 --> 00:09:30,160 The QCU handles all the stuff that has to do with timing and 802.11. 106 00:09:30,160 --> 00:09:50,860 So if you're doing things like wanting to have long transmit bursts, you program the QCU and that handles starting, like, gating the DMA to start, doing the 802.11 stuff to say I want to start transmitting, programming the nav in the air to reserve the air time so you can actually do an 802.11 QOS transmit burst. 107 00:09:50,860 --> 00:09:52,380 That's all done by the QCU. 108 00:09:52,380 --> 00:09:55,290 And the QCU is just gated and doing the DMA. 109 00:09:56,170 --> 00:09:58,390 And the receive side is pretty simple. 110 00:09:58,750 --> 00:10:09,090 You program in where you want the DMA descriptors to and it just happily DMAs received packets in ‑‑ the thing I haven't mentioned here that I should is that there's a filter for filtering out packets. 111 00:10:09,090 --> 00:10:12,830 This is one of the first things that gets interesting for what you guys are doing with this stuff. 112 00:10:12,830 --> 00:10:20,990 Because the filter bits let you do interesting things like give me only stuff for my associated station, but you can also just say give me everything. 113 00:10:20,990 --> 00:10:24,750 Which is actually kind of useful, especially with what you guys are doing. 114 00:10:24,750 --> 00:10:35,850 You can also say give me everything including management traffic, which means you see RTS and CTS and ACK frames, which you wouldn't normally see because that sort of stuff is not data related. 115 00:10:35,850 --> 00:10:47,410 But if you're doing, like, driver development like me or spoofing crap like you guys, you may want to actually see RTS, CTS, you may want to generate ACK frames, see ACK frames come in. 116 00:10:47,910 --> 00:10:51,510 On the later chips, they have a high priority queue and a low priority queue. 117 00:10:51,510 --> 00:10:53,450 Not very interesting for most people. 118 00:10:53,450 --> 00:11:04,230 The reason the high priority queue exists is so that low latency frames like power save data frames can preempt, like, having a large backlog of, you know, bulk received data frames coming in another queue. 119 00:11:04,230 --> 00:11:06,990 So unless you're writing a station driver, it's probably not that important. 120 00:11:07,610 --> 00:11:10,270 So the fire is where things get a little bit more interesting. 121 00:11:10,770 --> 00:11:15,350 Because it's all done in hardware, and once the chip ships, they can't change it. 122 00:11:15,470 --> 00:11:21,370 There's, like, a thousand registers in the damn thing, and some of them per radio. 123 00:11:21,370 --> 00:11:26,730 So you end up being able to tune pretty much every piece of behavior of the fire. 124 00:11:26,730 --> 00:11:43,210 And as they figure out that there's more weird shit going on in the real world, they'll add more registers to give you the ability to twiddle things so that when they deliver the chip and they find that stuff in the real world starts acting nasty, they can actually modify the fire behavior by shipping a driver update. 125 00:11:43,990 --> 00:11:51,630 So the interesting things for people wanting to screw with Wi‑Fi is being able to do things like override signal levels. 126 00:11:51,630 --> 00:11:56,030 So when people are doing long distance links, they're always going to hear weak signals. 127 00:11:56,030 --> 00:12:02,230 They may want to have fine grained control over making the AGC sensitive to far away low level packets. 128 00:12:02,230 --> 00:12:11,110 But if you're in an environment like this, you may only want to receive packets that are close by and not spend time trying to figure out if the packet is far away. 129 00:12:11,210 --> 00:12:20,030 So you can program that and the chip will actually implement gain control based on stepping sizes and timing. 130 00:12:21,070 --> 00:12:23,170 CCA is something I keep being asked how you disable. 131 00:12:23,170 --> 00:12:25,150 So you can just transmit whenever the hell you want. 132 00:12:25,270 --> 00:12:26,150 There's a register. 133 00:12:26,370 --> 00:12:30,470 If you read the driver, you'll figure out which register you programmed to have it disable clear channel. 134 00:12:30,470 --> 00:12:32,210 But I'm not going to tell you how to do it. 135 00:12:32,790 --> 00:12:40,390 But you can actually set the CCA threshold for exactly what level it should be considering the air that's busy. 136 00:12:40,390 --> 00:12:42,010 And that has actually changed over time. 137 00:12:42,010 --> 00:12:43,690 So it is configurable. 138 00:12:44,650 --> 00:12:47,710 You can do per packet transmit power. 139 00:12:47,710 --> 00:12:50,850 So you can actually set the card to transmit at a high power. 140 00:12:50,850 --> 00:12:54,610 But for things that are close by, you can actually lower the transmit power per packet. 141 00:12:54,610 --> 00:12:57,730 So you can do things like confuse people doing Wi‑Fi positioning. 142 00:12:57,730 --> 00:13:03,610 Because they're typically doing, if you're doing it using open source tools, they'll be doing it using signal strength. 143 00:13:03,610 --> 00:13:07,870 And if someone's screwing with their transmit power, all of that stuff breaks down. 144 00:13:08,610 --> 00:13:15,190 The interesting things if you're looking to twiddle with a lot of this stuff is looking at the calibration and the noise immunity code. 145 00:13:15,190 --> 00:13:21,890 If you read the patents on those and the code, you'll actually get a pretty good description of how the Atheros FI works. 146 00:13:21,890 --> 00:13:28,550 Because all the pre‑core patents cover the FI design in quite good detail. 147 00:13:28,550 --> 00:13:31,150 So I recommend anyone that's interested to read that. 148 00:13:31,310 --> 00:13:33,830 And the RF synth is the final bit here. 149 00:13:33,830 --> 00:13:36,090 It does, well, the RF bits. 150 00:13:36,430 --> 00:13:42,490 The stuff pre‑Merlin or pre‑AR9280, you don't get to pick which frequencies you tune to. 151 00:13:42,490 --> 00:13:46,650 You only get to tune to what are pretty much the 802.11 channel offsets. 152 00:13:46,650 --> 00:13:53,590 The latest stuff, so AR9280 and later, let you tune to very, very small fractional increments. 153 00:13:53,770 --> 00:14:01,850 The thing to keep in mind is, and I'll cover this soon, is just because you can tune to those frequencies doesn't mean that you can actually use them. 154 00:14:02,410 --> 00:14:07,170 It also has a configurable width filter for both receive and transmit. 155 00:14:07,170 --> 00:14:10,550 So on the receive side, so it filters out crap from adjacent channels. 156 00:14:10,550 --> 00:14:17,530 And on the transmit side, it actually prevents the transmitter from spewing crap outside the configured channel width. 157 00:14:18,010 --> 00:14:22,830 And when you're trying to do half and quarter rate stuff for really long distance links, this stuff is actually pretty important. 158 00:14:23,650 --> 00:14:25,390 So now we get to the why. 159 00:14:25,470 --> 00:14:27,550 Why do people like these things? 160 00:14:27,550 --> 00:14:30,650 And in short, everything inside is exposed. 161 00:14:30,730 --> 00:14:40,030 And because they needed to make it so that they could ship software driver updates to modify behavior, the chip pretty much lets you get away with bloody murder. 162 00:14:40,410 --> 00:14:46,050 So the only thing that happens is the stuff that offloading would be a pain in the ass. 163 00:14:46,050 --> 00:14:52,790 So you pretty much get the raw 802.11 frames going in and out of the device. 164 00:14:52,790 --> 00:14:57,190 There's no DSP, there's no CPU in the non-mobile products. 165 00:14:57,310 --> 00:15:00,190 So everything has to be done locally. 166 00:15:01,250 --> 00:15:05,130 So on the transmit side, you do give it a raw 802.11 frame. 167 00:15:05,130 --> 00:15:12,790 Everything from the source MAC address onwards gets dumped into memory and that will just appear on the air. 168 00:15:12,790 --> 00:15:15,530 The chip doesn't care what you put into it. 169 00:15:15,970 --> 00:15:19,310 The only thing you have to worry about is the magic alignment constraints. 170 00:15:19,310 --> 00:15:24,430 But you could pick a random MAC address to transmit from and it will dutifully send that. 171 00:15:24,590 --> 00:15:31,990 So this is why these things are good for injection because they're not enforcing any kind of source address verification inside the chip. 172 00:15:32,070 --> 00:15:34,610 So if you screw up, then you're screwed. 173 00:15:34,610 --> 00:15:37,730 But if you want to specifically spoof other things, you can. 174 00:15:37,730 --> 00:15:40,630 And people have used this for all kinds of interesting things. 175 00:15:41,570 --> 00:15:47,990 One common thing that people don't do when they want to be a naughty device is they won't disable ACK generation. 176 00:15:47,990 --> 00:15:58,610 So if I want to go out and see if there are anything nasty out there, I can actually send probe requests to station MAC addresses and the hardware will ACK it for you. 177 00:15:58,610 --> 00:16:03,970 And you won't know because you're just simply a driver and the driver doesn't handle ACKs. 178 00:16:03,970 --> 00:16:06,010 You can turn off ACKing in the chip. 179 00:16:06,010 --> 00:16:13,390 So if someone tries sending you a packet, even if the driver tosses it later, you still don't want to necessarily ACK the packet and tell someone you're there. 180 00:16:14,890 --> 00:16:19,430 You can also disable FCS checks so you don't have to opt to the receive side thing. 181 00:16:19,430 --> 00:16:20,370 It's no big deal. 182 00:16:21,270 --> 00:16:24,370 And you get to do things like per packet transmit control. 183 00:16:25,650 --> 00:16:26,470 Interesting. 184 00:16:26,470 --> 00:16:27,050 Okay. 185 00:16:27,070 --> 00:16:29,530 On the receive side, you get everything. 186 00:16:29,670 --> 00:16:33,950 So it's all based on what you get with what you configure in the filter. 187 00:16:33,950 --> 00:16:38,430 But if you turn on the promiscuous and the mismanagement bits in the driver, you get every frame. 188 00:16:38,430 --> 00:16:43,510 And if you disable FCS checks, it will give you every frame including all the errors in the frame. 189 00:16:43,510 --> 00:16:54,670 And there have been research papers that actually look at what kinds of bit errors occur in packets and they all use a Theros stuff because it's the only chips you get that let you do this kind of tricky shit. 190 00:16:55,670 --> 00:16:58,590 So what other things can the chips do that are interesting? 191 00:16:59,030 --> 00:17:04,430 So I'm going to gloss over them because I only have like 30 minutes to talk about this stuff. 192 00:17:05,350 --> 00:17:10,790 And there are a lot of other stuff that I if you want to find out, come and see me. 193 00:17:10,790 --> 00:17:14,590 But the chips have to be both a station chip and an access point chip. 194 00:17:14,830 --> 00:17:20,910 And later chips want to be a station chip and an access point chip and do ad hoc for P2P Wi-Fi stuff. 195 00:17:21,130 --> 00:17:28,690 So in order for all of that crap to exist, there has to be support in the chip for things like tracking multiple TSF counters. 196 00:17:28,690 --> 00:17:37,970 So if you're trying to do ad hoc and station, you need to have one TSF counter synced to the access point and a second one running your ad hoc network. 197 00:17:38,050 --> 00:17:49,970 The more interesting stuff for people doing naughty things is things like the AN9280 spectrum analysis mode where you can actually get the chip to give you per OFDM bin power readings. 198 00:17:50,030 --> 00:18:02,130 So a lot of the enterprise products will actually have a nick in there specifically to pull out the spectrum data from the current channel so they can make decisions about how dirty the channel is. 199 00:18:02,130 --> 00:18:09,210 If you're doing it based on RSSI only, you're only getting an idea of how much Wi-Fi traffic there is on a particular channel. 200 00:18:09,210 --> 00:18:22,950 But if you use the spectrum node, you can see things like microwaves and cordless phones and other kinds of noise generation devices that the chip will treat as noise but won't give you a receive packet for anything. 201 00:18:22,950 --> 00:18:27,990 So I use this for a lot of debugging and it's good to see things like microwaves in action. 202 00:18:28,570 --> 00:18:40,310 And the later chips actually have Wi-Fi positioning hacks so you can do fine grain packet time stamping and actually do time delay between transmitting a packet and getting the act back so you can actually estimate distance down to a few feet. 203 00:18:41,090 --> 00:18:44,970 And that's the kind of crap that powers your enterprise APs tracking you walking around. 204 00:18:45,130 --> 00:18:46,410 It's all in these things. 205 00:18:47,550 --> 00:18:54,170 Now the things that you're not supposed to do, and I'm not going to tell you how, they're required for regulatory compliance. 206 00:18:54,310 --> 00:18:55,350 So you're all pretty spoiled. 207 00:18:55,350 --> 00:18:59,990 You buy a laptop and it works and you don't necessarily see the crap that goes on behind the scenes. 208 00:18:59,990 --> 00:19:07,130 And what goes on behind the scenes is submitting it to the FCC and getting the thing verified that it's actually behaving correctly or correctly. 209 00:19:07,530 --> 00:19:15,050 So one of the things that happens is you need to be able to verify that your chip is transmitting on a particular center frequency and not drifting over time. 210 00:19:15,410 --> 00:19:18,150 Otherwise it's not going to interoperate well with other devices. 211 00:19:18,390 --> 00:19:23,970 So you can actually put the chip into a just blurs crap out mode and just blurs out a tone. 212 00:19:24,530 --> 00:19:27,190 Now if you did this in the real world, the Wi-Fi in your area shuts down. 213 00:19:27,190 --> 00:19:28,650 It's actually kind of pretty to watch. 214 00:19:28,650 --> 00:19:34,670 The minute you transmit a carrier tone at maximum frequency, you don't care about distortion, no one else's Wi-Fi works. 215 00:19:35,230 --> 00:19:36,390 Don't do it. 216 00:19:37,070 --> 00:19:38,110 I'm just telling you don't do it. 217 00:19:38,110 --> 00:19:40,010 What you do is your own problem, but don't do it. 218 00:19:40,010 --> 00:19:43,970 You need to know how to do these if you're submitting your equipment for FCC testing. 219 00:19:44,170 --> 00:19:53,810 And I'm pretty sure most of the crap that we buy where they just take a Theros nick and shove it into an existing design like a board and make it work, that's not actually being FCC tested. 220 00:19:53,810 --> 00:20:00,990 Getting something FCC tested isn't getting an FCC tested nick, it's actually getting the enclosure and the antenna tested as part of a product. 221 00:20:00,990 --> 00:20:03,850 So they end up having to implement this stuff and then prove it. 222 00:20:03,930 --> 00:20:11,530 The other interesting thing is you actually get to put the nick into debug modes where you get to inject and receive raw ADC data. 223 00:20:11,530 --> 00:20:17,990 It's useful for doing calibration, but it's not useful for doing any other kind of spoofing, at least not from what I've been doing. 224 00:20:18,090 --> 00:20:27,070 And so most of the time you're feeding the chip a sine wave and you're trying to calibrate the chip to make sure that what the DAC gets back is an accurate sine wave. 225 00:20:27,210 --> 00:20:34,830 And so we put the chip in the debug mode, feed it a constant sine wave, pull out 4K of sample data at a time and make sure the chip is doing its thing. 226 00:20:37,130 --> 00:20:42,010 Now I'm going to cover a couple of things that people keep asking me about doing and why it's a good idea and why it's not a good idea. 227 00:20:42,010 --> 00:20:46,330 And the most common question I get asked is how the fuck do I break regulatory requirements? 228 00:20:46,750 --> 00:20:57,370 You know, I have this chip, it can do a lot more power, it's the regulatory requirements and the chip calibration limits me to transmitting to quite a few dB less than what the chip is apparently capable of doing. 229 00:20:57,650 --> 00:20:59,070 Why is this a problem? 230 00:20:59,270 --> 00:21:03,450 The main reason is you don't have the equipment. 231 00:21:04,070 --> 00:21:07,910 Who here has an actual 6 gig spectrum analyzer and power meter? 232 00:21:08,430 --> 00:21:09,170 Anyone? 233 00:21:10,890 --> 00:21:11,830 Right. 234 00:21:11,830 --> 00:21:16,770 That's a minimum 30 grand entry fee to actually screwing with transmit power. 235 00:21:16,830 --> 00:21:21,630 Because if you don't have that, you don't know if your device is actually distorting when it transmits. 236 00:21:21,710 --> 00:21:25,950 So the first thing is that you got to have the right equipment to actually measure this. 237 00:21:25,970 --> 00:21:30,230 The main reason is that people think about is the regulatory requirements. 238 00:21:30,290 --> 00:21:46,950 The two parts are there's a maximum amount of power you can inject into a channel and because Wi-Fi looks like that funny, like, spectrum, that has like a defined mask when you look at it on a spectrum analyzer, you need to make sure you don't transmit power into an adjacent channel that's higher than a certain level. 239 00:21:46,970 --> 00:21:56,330 And the specs, the 802.11 and the regulatory specs typically say what the maximum amount of power you can inject in adjacent channels before your device is out of compliance. 240 00:21:57,150 --> 00:22:00,930 The other thing is that RF is really weird. 241 00:22:01,270 --> 00:22:03,930 And at 5 gig, RF is extremely weird. 242 00:22:03,930 --> 00:22:13,490 And one of the weird things is that trying to find components that will stay linear over 1 gigahertz worth of 5 gig bandwidth is exceedingly hard to do. 243 00:22:13,490 --> 00:22:18,050 And trying to design an RF circuit that's linear over that requirement is exceedingly hard to do. 244 00:22:18,050 --> 00:22:30,750 So trying to make sure that your design has both 2 gig and 5 gig amplifiers that remain linear over the course of that entire bandwidth is actually hard. 245 00:22:30,750 --> 00:22:36,010 And what tends to happen when you look at the output distortion is it's not straight. 246 00:22:36,010 --> 00:22:38,590 It does this or it does this or it's wavy. 247 00:22:38,590 --> 00:22:50,150 And so as part of the card calibration, they'll actually pick the maximum transmit power that you can do per channel based on what the actual card when you test it gives you distortion wise. 248 00:22:50,150 --> 00:22:58,290 They'll say anything more than this much power at this frequency drives the transmitters into nonlinear, some kind of nonlinear behavior that have to drop the transmit power. 249 00:22:59,030 --> 00:23:07,870 The third thing is that transmitting on 3 antennas like half a watt is actually pretty power hungry. 250 00:23:07,930 --> 00:23:15,870 And most of the stuff that you're plugging into isn't designed for lots of periodic bursts of a couple of amps worth of power. 251 00:23:15,870 --> 00:23:23,270 And so the power that your slot can provide you is typically less than what you're using to transmit. 252 00:23:23,330 --> 00:23:30,290 And the power requirements change based on the channel and what kind of thing you're transmitting. 253 00:23:30,290 --> 00:23:33,730 And this is all the crap that gets looked at in the lab. 254 00:23:34,290 --> 00:23:40,870 So the power consumption varies quite a lot and decoupling caps only work so well. 255 00:23:41,790 --> 00:23:46,570 And so when figuring out can I overclock, the answer is maybe. 256 00:23:47,030 --> 00:23:52,650 Even inside regulatory, even if your card is doing 2 or 3 dB less than the regulatory requirements say, sure. 257 00:23:52,650 --> 00:23:54,910 That doesn't mean that the card can actually do it. 258 00:23:54,910 --> 00:23:58,570 So I highly recommend that you get some, loan some equipment. 259 00:23:58,750 --> 00:24:10,850 And the other thing is all of the high powered NICs I've seen, they'll actually have a 5 volt input on them specifically coming from some external source that's not the USB or the PCIe slot. 260 00:24:10,930 --> 00:24:15,010 And so you know you have a real high powered NIC if it actually has some external source. 261 00:24:15,010 --> 00:24:20,290 You plug it into a mini PCIe slot, the card says it can do half a watt, it's probably distorting. 262 00:24:21,790 --> 00:24:31,790 The next thing people ask me to do is can I make it tune to like 6 gig or 4.8 gig or like can I pick a tuning that isn't the channels to tune on. 263 00:24:31,790 --> 00:24:33,450 And the short answer is sure. 264 00:24:33,730 --> 00:24:37,490 The long answer is we only calibrated the NICs for specific channels. 265 00:24:37,490 --> 00:24:39,510 For all the reasons I just talked about. 266 00:24:39,870 --> 00:25:02,990 And yeah, you can pick arbitrary frequencies to tune the chips to, but not only has it not been tested and you may damage things, the RF synth, RF is weird and as you change the RF synth, it's doing digital, like there's a PLL and it's doing digital upscaling and it may generate noise spurs all over the place based on the current setting of the RF synth and what the devices are and which bits you've turned on or off. 267 00:25:02,990 --> 00:25:15,650 So they actually test this stuff in the lab to say okay, this particular synthesis setting for this particular Wi-Fi channel meets the requirements of low spurs and low distortion and it's actually accurate. 268 00:25:15,690 --> 00:25:25,870 And you could tune it to arbitrary frequencies, but unless you test it, what you may actually be doing is damaging things, you may be actually generating more noise and the thing may actually be drifting more than you'd like. 269 00:25:25,870 --> 00:25:31,610 So if you get a fiddle with this for fun, get a spectrum analyzer and actually test this stuff. 270 00:25:33,230 --> 00:25:39,590 The next thing that people ask me is how do I make my NIC work with the microwaves on or how do I have it do a long distance link? 271 00:25:39,730 --> 00:25:49,010 And all I'm going to tell you here is read the noise immunity code because it actually twiddles all of the hardware inside the thing for tuning signal sensitivity. 272 00:25:49,330 --> 00:25:59,530 And so the NIC gets a handful of microseconds during the preamble to lock on to the Wi-Fi signal and figure out the right signal size. 273 00:25:59,930 --> 00:26:09,670 If you're trying to do things like receive long distance traffic and local traffic which is quite high, the NIC doesn't have a lot of time to figure out what the right gain settings are. 274 00:26:09,670 --> 00:26:29,730 So when I'm doing this stuff, and I know that I have a mix of long and far traffic, I'll have a NIC doing long only traffic and I'll have a NIC doing local only traffic so that I have a higher percentage of being able to see far away packets before the preamble stops and the packet starts and reception sucks. 275 00:26:30,590 --> 00:26:36,310 So if you're experimenting with noisy environments and long distance weak signals, look at the ANI code and read the patent. 276 00:26:37,190 --> 00:26:40,990 And I think this is the last thing on the playing around bits. 277 00:26:40,990 --> 00:26:45,330 So a couple of years ago when I was working there, we actually got the spectrum analysis stuff open source. 278 00:26:45,330 --> 00:26:47,630 So it's in BSD and it's in Linux. 279 00:26:47,630 --> 00:26:49,570 There are open source tools for pulling the stuff out. 280 00:26:49,570 --> 00:26:57,110 So all those pretty waterfall things you get from like the ubiquity access points, we put them into waterfall mode and you get a channel thing. 281 00:26:57,110 --> 00:27:01,730 All it's doing is it's putting the NIC into spectrum mode and scanning over all the channels. 282 00:27:02,250 --> 00:27:15,750 And so if you want to actually do it on a Theros NIC without needing to have any other equipment, you can get a pretty good coarse grain idea of what channels are busy, what channels are worth looking at, what's Wi-Fi and what's not Wi-Fi. 283 00:27:17,390 --> 00:27:19,630 And as I said, it's all open source. 284 00:27:19,630 --> 00:27:23,870 The thing to keep in mind is the same block doing FFT is used for RX and spectral mode. 285 00:27:23,870 --> 00:27:27,850 So you can't receive packets at the same time you're actually doing FFT investigations. 286 00:27:27,850 --> 00:27:33,570 When you trigger an FFT, sorry, when you trigger a spectrum sample, it doesn't do receive for that period. 287 00:27:33,570 --> 00:27:34,790 So I'll use two NICs. 288 00:27:34,790 --> 00:27:43,610 And a lot of the enterprise hardware will actually put a second NIC in there, cheaper NIC, specifically to do spectrum analysis in order to pick the right channel to work on. 289 00:27:43,810 --> 00:27:49,010 And I don't think any of the open source access point products currently do this, but all the source code is there. 290 00:27:49,010 --> 00:27:50,930 If you want to play, then have a play. 291 00:27:52,210 --> 00:27:56,170 Now, I see a lot of people walking around with a Theros NICs hanging out of their laptops. 292 00:27:57,110 --> 00:28:01,310 And so I figured I'd talk a bit briefly about what's actually going on under the hood in these things. 293 00:28:01,550 --> 00:28:11,090 So all the HTC parts have a little 10 silica CPU that's sort of MIPSy and a normal bonafide, honest to God, a Theros Wi-Fi chip in it. 294 00:28:11,090 --> 00:28:15,430 So all the crap I just talked about, you can do with the USB NICs. 295 00:28:15,430 --> 00:28:18,730 So yes, you can do spectrum analysis with the HTC NICs. 296 00:28:18,730 --> 00:28:20,390 Yes, you can vary transmit power. 297 00:28:20,390 --> 00:28:23,690 Yes, you can do all the fiddling with it. 298 00:28:24,850 --> 00:28:31,350 The early, the first USB stuff had an actual separate CPU and PCIe NIC, the AR9280. 299 00:28:31,510 --> 00:28:39,330 And the one that I think everyone has is the single band, single antenna AR9271, which is slightly cut down, but it still does all the same stuff. 300 00:28:39,330 --> 00:28:50,210 You can still do spectrum analysis, radar, not radar detection without 5 gig, all the same debug modes, all the same signal level stuff. 301 00:28:50,210 --> 00:29:16,810 So the driver in Linux mostly treats the USB widget as a dumb DMA pipe and it knows a little bit about station stuff so it can do frame retransmission in the NIC for doing TX aggregation and rate control, but we're trying to strip that out because the number one reason why you can't run more than 8 stations on one of those NICs in access point mode is because there's a limited amount of RAM on the NIC. 302 00:29:16,930 --> 00:29:26,150 But again, the CPU can act as a dumb DMA pipe and the plan is to do that and then we can have as many stations as the driver allows you. 303 00:29:26,370 --> 00:29:28,270 And that's actually open source now. 304 00:29:28,270 --> 00:29:29,450 The firmware is open source. 305 00:29:29,450 --> 00:29:36,570 So if people are interested in doing things like running custom code inside the firmware on the USB NIC, you can actually do that. 306 00:29:36,570 --> 00:29:39,670 It uses the open source, tens of GCC tools. 307 00:29:40,550 --> 00:29:42,470 I'll put the GitHub repo up here soon. 308 00:29:42,470 --> 00:29:44,970 You can build it, you can install it, you can fiddle with it. 309 00:29:45,930 --> 00:29:51,390 If people have questions about what kind of weird crap they want to do with their NICs, please let me know. 310 00:29:51,790 --> 00:30:01,210 I was going to do like a walk through the hell and show you guys how the thing holds together and what to look at, but unfortunately there have been some significant technical issues in getting things to work. 311 00:30:01,850 --> 00:30:07,230 So I'll finish by putting up where the source code is. 312 00:30:08,110 --> 00:30:09,490 And everyone takes photos. 313 00:30:09,630 --> 00:30:15,210 So Qualcomm and Theros actually put up a GitHub repo a couple of years ago that they're putting all of their projects inside. 314 00:30:15,210 --> 00:30:22,150 And everything except the cell phone software firmware and the 11AC firmware is currently up there. 315 00:30:22,350 --> 00:30:26,570 Including firmware for their pre-11N USB NICs. 316 00:30:26,570 --> 00:30:28,830 I think it was a 5523, yeah. 317 00:30:29,050 --> 00:30:30,790 None of us have actually used it. 318 00:30:30,790 --> 00:30:33,590 Like, the hardware's out there and there's a driver for it. 319 00:30:33,690 --> 00:30:34,650 The firmware's out there. 320 00:30:34,650 --> 00:30:38,190 It's a normal Theros device with a little MIPS CPU in there. 321 00:30:38,190 --> 00:30:39,450 So it's all documented. 322 00:30:39,690 --> 00:30:43,210 The only thing that they haven't opened up is Bluetooth, mobile, and 11AC. 323 00:30:43,990 --> 00:30:48,550 And the common question I then get at this point is, what the hell are we going to do about 11AC? 324 00:30:48,610 --> 00:30:49,870 Well, I don't work there. 325 00:30:49,890 --> 00:30:53,070 So I decided to sign the NDA to get source code access. 326 00:30:53,070 --> 00:30:56,210 So I have source code access, but it's not public. 327 00:30:56,210 --> 00:31:06,890 The source code isn't public, but if you sign the NDA, you can get access to the firmware source and it looks like a Theros chip with a little CPU inside, as everything else does. 328 00:31:08,190 --> 00:31:22,010 The aim behind a bunch of us that are looking at this and admittedly I haven't done very much, but I plan on stepping this up around September is instead of there being, what we don't want to see is a lot of little individual companies publishing their own firmware blobs and suddenly it's like, 329 00:31:22,010 --> 00:31:32,070 I have to use company A for station mode and company B for access point mode and company C for mesh mode and there's a dozen different firmware blobs and a dozen different versions of the Linux driver to support things. 330 00:31:32,070 --> 00:31:41,790 Our plan is to have one tree that we all share internally inside the little NDA enabled group and ship one binary firmware image so that we're not duplicating effort. 331 00:31:42,950 --> 00:31:45,690 The 11AC hardware is actually pretty cool. 332 00:31:45,690 --> 00:32:03,870 So if people here are interested in doing 11AC product developments, the hardware will do meshing if you want to spend some time doing it, the hardware will do all the other stuff that you guys are used to, please contact me and I'll bump you over to the open source group and you can sign in and have a chat with them. 333 00:32:04,550 --> 00:32:07,690 So the NDA program, I get a lot of cool hardware. 334 00:32:07,910 --> 00:32:10,670 Mostly because I import free BSD for fun. 335 00:32:11,770 --> 00:32:22,490 There's an open source NDA program where you get access to their internal reference drivers and if you're really nice and not jerk faces, they'll give you data sheet access and you can talk to the developers. 336 00:32:22,490 --> 00:32:27,230 But they're all pretty busy people, so I don't recommend shouting them too many questions. 337 00:32:27,410 --> 00:32:38,070 If you can talk to the other people like me who have NDA access, we're quite happy to solve problems that would normally take time away from the hardware developers. 338 00:32:38,710 --> 00:32:42,270 If you're really, really nice, then they'll actually give you reference design boards. 339 00:32:44,210 --> 00:32:50,430 So they actually want to see, there's a group inside of QCA that actually wants to see more open source stuff. 340 00:32:50,430 --> 00:32:57,430 They have a pretty heavy OpenWRT group inside of there, bringing their stuff up with OpenWRT and pushing things upstream. 341 00:32:57,990 --> 00:33:08,330 So if anyone here is actually looking at doing new product development and thinking of a thorough stuff, the place to start is by talking to these peeps, getting them to, getting a good relation with them. 342 00:33:08,330 --> 00:33:15,630 They're down in San Jose, near the San Jose airport, so it's worthwhile having lunch with them and actually talking about the sort of stuff that you're doing and they're doing. 343 00:33:15,630 --> 00:33:17,870 And then lawyers are actually kind of cool. 344 00:33:18,250 --> 00:33:24,230 All the lawyers inside of Atheros that I worked with and still do here and there, they're the ones that got us access to all of this. 345 00:33:24,390 --> 00:33:28,450 They're the ones that approved all of this firmware access and source code access. 346 00:33:28,450 --> 00:33:31,830 So they're pretty clued in about open source and working with the community. 347 00:33:32,950 --> 00:33:35,210 So if you'd like to join, let me know. 348 00:33:35,210 --> 00:33:37,070 You can find me on the internet, it's not that hard. 349 00:33:37,070 --> 00:33:42,910 And we'll set stuff up inside of QCA for you to talk to them about stuff. 350 00:33:43,710 --> 00:33:56,530 I am trying to get together a group of people to actually do open source Wi-Fi development stuff in the Bay Area because there seems to be a lot of interest, but lots of little disparate groups, you know, groping around in the dark and not necessarily knowing what's going on. 351 00:33:56,530 --> 00:34:10,010 So if anyone is interested in coming to the Bay Area sometime later on this year and actually meeting some of the people involved in this and collaborating on learning how the hardware works and what you can do with it and the open source drivers and Linux and other operating systems, 352 00:34:10,010 --> 00:34:10,970 let me know. 353 00:34:10,970 --> 00:34:14,050 And if there's enough interest, I'll finish putting it together. 354 00:34:15,710 --> 00:34:16,730 Any questions? 355 00:34:19,870 --> 00:34:22,090 It's either a good sign or a bad sign. 356 00:34:26,200 --> 00:34:27,820 We ran out of time. 357 00:34:30,460 --> 00:34:31,060 Cool. 358 00:34:31,060 --> 00:34:36,240 Well, you know, the hardware is open and it's a long cry from how it looked 15 years ago. 359 00:34:36,240 --> 00:34:36,920 Yes? 360 00:34:40,680 --> 00:34:41,240 Okay 361 00:34:45,390 --> 00:34:45,950 . 362 00:34:47,490 --> 00:34:53,690 So the reason why, if you're doing 802.11 stuff, this is good for doing data stuff because it's this big. 363 00:34:53,710 --> 00:35:01,630 And anyone who's tried doing actual 802.11 MIMO 11N decoding in SDR, your entry level is an actual FPGA board. 364 00:35:01,630 --> 00:35:12,390 And like the FPGA boards that we use, there are like two of these sized FPGA boards running the Wi-Fi bit set quite a lot slower because they're FPGAs. 365 00:35:12,390 --> 00:35:22,290 So if you're trying to do like 20, 40, 80MHz 11AC stuff using an SDR, you're probably not going to be doing it at full speed, not with current hardware. 366 00:35:22,990 --> 00:35:31,410 The thing to keep in mind is, you know, if you want to be doing a 20MHz channel, your SDR has to be sampling at at least 40 and maybe more. 367 00:35:31,490 --> 00:35:35,410 And so, you know, 11AC starts at 40 and goes up to 80. 368 00:35:35,570 --> 00:35:42,730 And when you're doing 160MHz, suddenly you're going to have to have like 320MHz wide stuff. 369 00:35:43,530 --> 00:35:44,690 And that's a lot of data. 370 00:35:44,690 --> 00:35:53,030 And then you have I and Q and you split that off and you get two streams of data and then you have IQ per radio chain and that spirals off into hell, right? 371 00:35:53,030 --> 00:35:57,610 So for doing 802.11 sniffing, these chips are pretty good. 372 00:35:57,610 --> 00:36:03,770 If you're doing general signal analysis, these chips are not designed for doing general signal analysis. 373 00:36:04,550 --> 00:36:06,930 But they're like $2 on eBay. 374 00:36:06,930 --> 00:36:09,350 So, yeah. 375 00:36:09,610 --> 00:36:11,570 Any other questions? 376 00:36:12,710 --> 00:36:13,550 Cool. 377 00:36:13,550 --> 00:36:14,590 Well, thanks.