Monthly Archives: March 2007

Bus tracing under Windows.

I’ve used USB Sniffer v1.8 to sniff USB bus transactions under Windows. It works, although generates very verbose output (and I have to copy the .log files to a unix box, where grep/sed/awk can actually make them useful. Yes, I know about cygwin, no, command line editing under windows still sucks).

I was told to give a free version of Bus Hound a try, especially for looking at IDE transactions. (BusHound supports alot more then just usb bus, and I was told that it’s quite good, which is a win, since I am thinking about foregoing using USB to IDE adapter, as using USB introduces extra data in bus traces, by wrapping around CDBs.)

P.S. Reading ATA/ATAPI 7 and MMC 6 specs gave me headaches. So I stopped.

Elliptic Cryptography textbook

Looked some more at AACS specs. Realized that I don’t know jack about elliptic cryptography. Asked Yuly Billig what he recommends as a gentle introduction to elliptic cryptography for dummies with limited algebra skills.

He recommended “A Course in Number Theory and Cryptography” by N. Koblitz, QA 241.K672. Carleton library has two copies, so next time I am on campus, I shall sign one out. I guess we’ll find out how much of a dummy with limited algebra skills I am.

It’s all about copious spare time.

Peter Watts’ Books are licensed under CC

Peter Watts, a Canadian Marine Biologist responsible for Vampire Domesticantion lectures (Which you should spend 40 minutes and listen to, and definitely read the little corporate slogans at the corner of each slide) licensed a bunch of his books under CC license, and made them available for download.

Thank you, Peter! I was looking on Amazon, and at 50 to 90 dollars a copy (per softcover), it was not feasible for me to buy them.

If you liked these, consider buying Behemoth: A-Max and Behemoth: Seppuku. They are also good.

Oh, and regarding slogans: in F.E.A.R, on certain levels there were posters that said “Remember, it’s Quantity, Quality, Safety in that order!”

“Quicksilver: 5 things that make it awesome!” from Oak Innovations

I spotted these over at Oak Innovations blog.

My favorites of the 5? Running an action with a timed delay, or at a specific time. The second was learning how to chain commands together.

Here’s the list:

  • Do something in the future
  • Quick Triggers
  • Chain commands together
  • Run terminal commands
  • Master working with text files
  • If you are a Quicksilver user, fanatic, or just curious.. it’s worth a read!

    Watching HD content (Part I)

    Introduction

    One of my fields of interest is video making. I’ve been eyeing the HD stuff with a bit of curiosity, and pretty much convinced myself to step up to HD production. When I learned that Microsoft released an add-on to Xbox 360, consisting of an HD-DVD drive in an external USB-accessible enclosure, after some penny pinching, I took the plunge and bought it.

    HD-DVD (and Blu-Ray) drives are part of the security layer designed by Advanced Access Control System (AACS), a new generation in viewer rights restriction, that successed Content Srambling System (CSS), implemented on DVDs. AACS is non-exclusively licensed by AACS Licensing Authority, and restricts what a buyer (in essence a long term renter of a right to watch) of a HD video disk can do.

    Specifically, AACS mandates that a viewer should not be allowed to watch HD output from software player if there is an unencrypted path between the player and the video output device. In essence, if your video card doesn’t support High Defenition Content Protection (HDCP), and if your monitor is not connected to your video card over DVI or HDCP, but over analog or component outputs, your viewing experience will be “degraded”.

    “Degradation” in plain terms means that if you have HDCP path to your monitor/TV, you will view content in it’s 1080p (1920×1080 resolution, deinterlaced) glory. If you have DVI outputs, well, you get 1080i (1920×1080, interlaced, but it’s OK, because output is 60Hz, and most decent HD TVs and monitors will do proper deinterlacing, in essence outputing 1080p). If you have component or analog out, you might be lucky, and video studio will let you watch the same video in a “pleb” 960×540 resolution. It is still better then 640×480 (or 720×480 – remember that TV pixels are not square, but are at 4:3 ratio, so depending on what your scaler does, resolution might differ) resolution of a Standard Defenition (SD) video signal, but you paid for 1080p, right? This is up to the studio, however, and very few are liberal enough to allow you even that. So most often you get to view the trailers and extra filler on disk in 540×900, but are not authorized to watch the main feature at all. These rights are both bitmasks on the video streams, and additional rights data in the encrypted XML data files on the disks.

    I can think of a couple HD-DVD disks that were released totally unencrypted with no AACS bits. Problem is that there are talks about enforcing ROM Mark by the players. ROM Mark is a special sector that pressed disks have, and burned do not. Idea is that if the disk has ROM mark, it was pressed, and thus must have AACS. If the disk doesn’t have ROM mark, it was burned, and thus it must have unencrypted, uncopyrighted content (again, extra bits in the video stream that player checks for) obtained from, say, consumer video recorder. “Nature’s Colors” and “Running Scared” (EU release) are reportedly unencrypted. Depending on how stupid the implementation of the check is, these titles might stop working.

    Ultimately, AACS consortium had a problem. How do you keep “pirates” from “stealing” your HD video, when your “customers” and “pirates” are one and the same? I mean, in the end, someone has to watch the stuff, right? Otherwise, why would anyone buy the videos? Hmmm. A problem indeed.

    I have to give HD-DVD manufactureres a credit, however. Remember region protection? The annoying thing, that made you rip and burn the DVDs you bought in Machu Pichu, that told you about the history of the ruins, just so you could watch it? The thing that forced folks from UK wait 6 month to a year before “Lord of the Rings” DVDs would come out in UK? Well, in HD-DVDs it’s gone (Although there are rumors of it coming back in a year or so, but in current iteration nothing supports it). So I bought a bunch of Studio Canal HD-DVD titles from Amazon.fr, that are not offered in North America. They play fine. In Blu-Ray world, things are more complicated. There are three regions that break down thusly: USA + Japan, Europe and those thieving Chinese and Russians. So Blu-Ray player sactually don’t let one watch US version of “SpiderMan III” in Europe (And as far as I know, neither HD-DVD nor Blu-Ray made it to Russia or China yet, so there are only Region A and Region B, as far as Blu-Ray is concerned).

    To keep those thieving “consumers” from “stealing” HD content, and god forbid end up with unprotected version of it, AACS created a rather complicated scheme.

    The Scheme

    This is my understanding of AACS, which is very high level, and probably very wrong. No warranties for the next few paragraphs.

    Warning! Acronym overload coming right up.

    At the lowest level, every element on the disk is encrypted with a Title Key (TK). Element can be the movie itself, trailers, various data files on the video disk, etc. Title Keys are unique to a particular movie, at least to a particular pressing of a disk (So EU version of “Bourne Supremacy” would have different TKs then US version of “Bourne Supremacy”, and then Japanese version of “Bourne Supremacy”.) Title Keys are stored on the disk itself, encrypted with a Volume Unique Key (VUK).

    Muselix64’s hack, that made all the news in early January, consisted of a way to decrypt the video elements by taking the user supplied VUK, and using it to extract the TKs, and do decryption.

    Now, VUK is generated by the software player. In order to generate the VUK, player has to use the Volume Identificator (VID), stored on the disk, and the Media Key, that is again unique per title, and hash the two together.

    Sounds simple, right? But in order to obtain the Volume ID, some magic is involved. Volume ID is 16 bytes, and first 8 bytes can actually be extracted by reading the Burst Cutting Area (BCA) from the disk. No special tricks, really. The remaining 8 bytes can be obtained by reading the copyright data section on disk. Here things get harder.

    Media Key is generated by using the Media Key Block (MKB) that is also stored on the disk, with a Device Key unique to the decrypting device (in case of a stand-alone player) or decrypting software (in case of a Home Theater PC).

    But before the drive will let you read the data, it will want you to authenticate yourself to it using a key signed by AACS LA.

    So here is part section 4.3 of the AACS spec 0.91 on how the drive and the software talk to each-other:


    By the drive authentication, the drive and the PC host verify each counterpart is an AACS compliant device that has valid certificate signed by the AACS LA and can sign and verify digital signatures specified in this document. In addition, the drive and the PC host verify each counterpart is not revoked by checking the Host Revocation List (HRL) and the Drive Revocation List (DRL), respectively. To do this, the drive shall store the most recent HRL it has encountered and the PC host shall store the most recent DRL it has encountered. When the drive authentication is successful, the drive and the PC host have a shared Bus Key (BK), and can proceed to the further steps. Figure 4-6 shows the protocol flow for drive authentication and key sharing used in AACS.

    AACS Common Specification, version 0.91. Pages 44 onwards document the intricacies of a drive talking to the system, where neither trusts each-other, and both trust things signed by AACS LA key.

    So each device or software player has a different Device Key, but they all generate the same Media Key when combined with the Media Key Block.

    So we generate a Media Key Block, then we convince the drive that we are for real, get the Volume ID, generate the Media Key, combine the two together, generate the VUK, use VUK to obtain the TKs, and then we decode each element as required, and get to see the Jack Black and Naomi Watts in all high resolution glory.

    I swear, only mathematician can be excited by something this complicated. And we haven’t even looked at subset difference, key revocation, and other complicated things, designed to keep movie studios in control.

    Content revocation? *blink*.

    Yes, if you bought a copy of “Serenity” on HD-DVD (or Blu-Ray), and 4 years from now it is deemed that girls wearing dresses in martial arts scenes (Summer Glau is hawt!) are against the law, AACS LA would be able update the list of keys on the drive and Device Keys, to prevent you from being able to decrypt, and thus watch, content on “Serenity” HD-DVD. Since drive updates it’s list of revocations each time you insert new media into it, they will need to release a bunch of HD-DVDs with updated lists, and wait till you get one, and put it in a drive. Since Device Keys are supposed to cycle every 18 months or so, in about 18 months you will not be able to play back the new disks, since your software player won’t have the Device Keys for them (at this point old disks will still play fine). You will download a “free” software update for your PowerDVD, and it will remove the keys to play back “Serenity”. Easy, right?

    Now you understand why I called you a “renter” in the beginning of this post.

    At this point it’s almost 4 am, and I got to head to work in less then 5 hours. In next session I will talk about Xbox 360 HD-DVD add-on, and maybe get to cover some neat things you can do by sending CDBs to various devices. Or maybe something completely ifferent.

    Cisco Hardware emulator

    dynamips is an emulator of various Cisco platforms, that is licensed under GNU GPL, and runs under Windows, Linux, Solaris, MacOS, etc.

    Dynamips started off as a MIPS emulator for Cisco 7200, and gradually ended up capable of emulating Cisco 7200 family, Cisco 3600 family, 2600 family (with some exceptions), and Cisco 3725 and 3745. Since it is a hardware emulator, it is bug for bug compatible with the real iron, and IOS on it would have the same bugs as on the physical hardware. Since it supports hypervisor mode, it is possible to run more then one router emulation on a single system, all connected through virtual network. Latest release candidates support packet capture on the virtual interfaces between the routers.

    Performance of the emulator is not that great (1 or 2K packers per second, compared to 100s of kpps that actual hardware supports), but it is useful in testing configurations, preparing for Cisco certifications, debugging IOS, etc. I found it while reading up on IOS security, but there are people in both Cisco TAC and preparing/passing CCIE exams, that indicated in 7200emu formus that they use dynamips.

    Current PC with a Gig or two of RAM can support a dozen or so router instances.

    Based on the information from the developer, we should not expect switch emulation support in the forseeable future, since switches use custom ASICs, so while the main CPUs (MIPS or PPC) that the switches use, are supported, it is very tricky to emulate the power on self-tests of the ASICs (sending packets over loopback, etc), that switches attempt before declaring themselves functional. However 7200 is a bitchin’ platform for pretty much anything, capable of running latest and greatest IOS.

    Blog of the author, where newest release candidates of the software are announced. Best place to check to see what bugs got fixed, and what line cards got supported in the latest release.

    Forums/Discussion Board for c7200emu, that is moderated by the software’s author.

    c7200emu – dynamips project page, detailing more or less up to date list of supported platforms.

    Dynagen a dynamips configuration front-end, that allows one easily configure and manage dynamips instances. Currently considered a must have companion to dynamips.

    dynamips TODO list, that allowes you to see what the developer is thinking about improving.

    P.S. If you lack elf.h, try libelf. In order to build it, you might need GNU sed

    Proof that any self-adjoint matrix is diagonalizable.

    (Sorry. If you don’t know what this is, please ignore it. It’s not important. Really.)

    Setup: If A is self-adjoint, and W is an A-invariant subspace ⇒ W⊥ is A-invariant.

    Want: ∀ x∈W⊥, Ax ∈ W⊥〈Ax,w〉 = 0 ∀ w ∈ W ⇐ Orthonormal

    Given:〈Ax,w) =〈x,Aw〉 ⇐ Self-Adjoint

    Aw∈W ⇐ W is A-invariant

    then〈x∈W⊥, Aw∈W〉= 0

    Since any self-adjoint matrix is ortho-diagonalizable, if A is self-adjoint, then ∃ an orthonormal basis B∈ℂn made out of eigenvectors such that [A]B

    Want: k=n (that is, an orthonormal basis made out of eigenvectors).

    Proof by contradiction: Suppose k less then n

    Given:

    W=span(v1, v2, .. vk), A-invariant (this is trivial, but see Appendix A)

    then W⊥ is A-invariant, then A is restricted to subspace W⊥

    AW⊥: W⊥ → W⊥

    Then ∃ v∈W⊥, an eigenvector of AW⊥.

    But since AW⊥v = Av, v is an eignevector to of A perpendicular to W.

    We assumed that S is maximal, but we ended up with a contradiction, since the set {v1, v2, .. ,vk, v/ ||v||} is an orthogonal set of eigenvectors.

    So k must be equal to n. As a result, A is orthodiagonalizable.

    Conclusion

    HTML is really not suited for doing math.

    Appendix A

    If λ1≠λ2,〈v1,v2〉must be 0

    Here is how: Av1=λ1v1, Av2=λ2v2

    Given that: λ1〈v1,v2〉 = 〈λ1v1,v2〉= 〈Av1,v2〉= 〈v1,Av2〉= 〈v1,λ2v2〉=λ2〈v1,v2〉⇒ λ1〈v1,v2〉= λ2〈v1,v2〉

    Since λ1≠λ2, 〈v1,v2〉=0

    .

    QED