slides.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="generator" content="pandoc">
  6. <meta name="author" content="Robin Dietrich &amp; Marius Schwarz">
  7. <title>CPA Angriff auf Speck</title>
  8. <meta name="apple-mobile-web-app-capable" content="yes">
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
  11. <link rel="stylesheet" href="./reveal.js/dist/reset.css">
  12. <link rel="stylesheet" href="./reveal.js/dist/reveal.css">
  13. <style>
  14. code{white-space: pre-wrap;}
  15. span.smallcaps{font-variant: small-caps;}
  16. span.underline{text-decoration: underline;}
  17. div.column{display: inline-block; vertical-align: top; width: 50%;}
  18. div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
  19. ul.task-list{list-style: none;}
  20. pre > code.sourceCode { white-space: pre; position: relative; }
  21. pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
  22. pre > code.sourceCode > span:empty { height: 1.2em; }
  23. .sourceCode { overflow: visible; }
  24. code.sourceCode > span { color: inherit; text-decoration: inherit; }
  25. div.sourceCode { margin: 1em 0; }
  26. pre.sourceCode { margin: 0; }
  27. @media screen {
  28. div.sourceCode { overflow: auto; }
  29. }
  30. @media print {
  31. pre > code.sourceCode { white-space: pre-wrap; }
  32. pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
  33. }
  34. pre.numberSource code
  35. { counter-reset: source-line 0; }
  36. pre.numberSource code > span
  37. { position: relative; left: -4em; counter-increment: source-line; }
  38. pre.numberSource code > span > a:first-child::before
  39. { content: counter(source-line);
  40. position: relative; left: -1em; text-align: right; vertical-align: baseline;
  41. border: none; display: inline-block;
  42. -webkit-touch-callout: none; -webkit-user-select: none;
  43. -khtml-user-select: none; -moz-user-select: none;
  44. -ms-user-select: none; user-select: none;
  45. padding: 0 4px; width: 4em;
  46. color: #aaaaaa;
  47. }
  48. pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
  49. div.sourceCode
  50. { }
  51. @media screen {
  52. pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
  53. }
  54. code span.al { color: #ff0000; font-weight: bold; } /* Alert */
  55. code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
  56. code span.at { color: #7d9029; } /* Attribute */
  57. code span.bn { color: #40a070; } /* BaseN */
  58. code span.bu { } /* BuiltIn */
  59. code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
  60. code span.ch { color: #4070a0; } /* Char */
  61. code span.cn { color: #880000; } /* Constant */
  62. code span.co { color: #60a0b0; font-style: italic; } /* Comment */
  63. code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
  64. code span.do { color: #ba2121; font-style: italic; } /* Documentation */
  65. code span.dt { color: #902000; } /* DataType */
  66. code span.dv { color: #40a070; } /* DecVal */
  67. code span.er { color: #ff0000; font-weight: bold; } /* Error */
  68. code span.ex { } /* Extension */
  69. code span.fl { color: #40a070; } /* Float */
  70. code span.fu { color: #06287e; } /* Function */
  71. code span.im { } /* Import */
  72. code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
  73. code span.kw { color: #007020; font-weight: bold; } /* Keyword */
  74. code span.op { color: #666666; } /* Operator */
  75. code span.ot { color: #007020; } /* Other */
  76. code span.pp { color: #bc7a00; } /* Preprocessor */
  77. code span.sc { color: #4070a0; } /* SpecialChar */
  78. code span.ss { color: #bb6688; } /* SpecialString */
  79. code span.st { color: #4070a0; } /* String */
  80. code span.va { color: #19177c; } /* Variable */
  81. code span.vs { color: #4070a0; } /* VerbatimString */
  82. code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
  83. .display.math{display: block; text-align: center; margin: 0.5rem auto;}
  84. </style>
  85. <link rel="stylesheet" href="./reveal.js/dist/theme/night.css" id="theme">
  86. <link rel="stylesheet" href="./css/custom.css"/>
  87. </head>
  88. <body>
  89. <div class="reveal">
  90. <div class="slides">
  91. <section id="title-slide">
  92. <h1 class="title">CPA Angriff auf Speck</h1>
  93. <p class="author">Robin Dietrich &amp; Marius Schwarz</p>
  94. </section>
  95. <section id="agenda" class="slide level1">
  96. <h1>Agenda</h1>
  97. <ul>
  98. <li>Speck Schiffre</li>
  99. <li>CPA Angriffe</li>
  100. <li>CPA auf Speck</li>
  101. <li>Gegenmaßnahmen</li>
  102. <li>Hiding</li>
  103. </ul>
  104. </section>
  105. <section id="speck" class="slide level1">
  106. <h1>Speck</h1>
  107. <ul>
  108. <li>Symmentrische ARX Schiffre
  109. <ul>
  110. <li>Add/Rotate/XOR</li>
  111. </ul></li>
  112. <li>Entworfen von der NSA (Zusammen mit der Schiffre Simon)</li>
  113. <li>Performant in Hard-/Software</li>
  114. <li>Speck bietet mehrere mögliche Modis
  115. <ul>
  116. <li>Anzahl Runden, Schlüssellänge, Blocklänge</li>
  117. </ul></li>
  118. <li>Paper: <a href="https://csrc.nist.gov/csrc/media/events/lightweight-cryptography-workshop-2015/documents/papers/session1-shors-paper.pdf">Simon and Speck: Block Ciphers for the Internet of Things</a></li>
  119. </ul>
  120. </section>
  121. <section id="speck---setups" class="slide level1">
  122. <h1>Speck - Setups</h1>
  123. <table>
  124. <thead>
  125. <tr class="header">
  126. <th>Speck</th>
  127. <th>Blocklänge</th>
  128. <th>Schlüssellänge</th>
  129. <th>Runden</th>
  130. </tr>
  131. </thead>
  132. <tbody>
  133. <tr class="odd">
  134. <td><span style="color:#d08a1d"><strong>Speck3264</strong></span></td>
  135. <td><span style="color:#d08a1d"><strong>32 Bit</strong></span></td>
  136. <td><span style="color:#d08a1d"><strong>64 Bit</strong></span></td>
  137. <td><span style="color:#d08a1d"><strong>22</strong></span></td>
  138. </tr>
  139. <tr class="even">
  140. <td>Speck4872</td>
  141. <td>48 Bit</td>
  142. <td>72 Bit</td>
  143. <td>22</td>
  144. </tr>
  145. <tr class="odd">
  146. <td>Speck4896</td>
  147. <td>48 Bit</td>
  148. <td>96 Bit</td>
  149. <td>23</td>
  150. </tr>
  151. <tr class="even">
  152. <td>Speck6496</td>
  153. <td>64 Bit</td>
  154. <td>96 Bit</td>
  155. <td>26</td>
  156. </tr>
  157. <tr class="odd">
  158. <td>Speck64128</td>
  159. <td>64 Bit</td>
  160. <td>128 Bit</td>
  161. <td>27</td>
  162. </tr>
  163. <tr class="even">
  164. <td>Speck9696</td>
  165. <td>96 Bit</td>
  166. <td>96 Bit</td>
  167. <td>28</td>
  168. </tr>
  169. <tr class="odd">
  170. <td>Speck96144</td>
  171. <td>96 Bit</td>
  172. <td>144 Bit</td>
  173. <td>29</td>
  174. </tr>
  175. <tr class="even">
  176. <td>Speck128128</td>
  177. <td>128 Bit</td>
  178. <td>128 Bit</td>
  179. <td>32</td>
  180. </tr>
  181. <tr class="odd">
  182. <td>Speck128192</td>
  183. <td>128 Bit</td>
  184. <td>192 Bit</td>
  185. <td>33</td>
  186. </tr>
  187. <tr class="even">
  188. <td>Speck1281256</td>
  189. <td>128 Bit</td>
  190. <td>256 Bit</td>
  191. <td>34</td>
  192. </tr>
  193. </tbody>
  194. </table>
  195. </section>
  196. <section id="speck---rundenfunktion" class="slide level1">
  197. <h1>Speck - Rundenfunktion</h1>
  198. <p><img data-src="img/rundenfunktion.png" width="400" /></p>
  199. <ul>
  200. <li>Wird während der Key Schedule aufgerufen</li>
  201. <li>Wird beim der Verschlüsselung aufgerufen</li>
  202. </ul>
  203. </section>
  204. <section id="speck---pseudocode" class="slide level1">
  205. <h1>Speck - Pseudocode</h1>
  206. <div class="sourceCode" id="cb1"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>pt <span class="op">=</span> Plaintext Bytes Pt <span class="op">=</span> Plaintext as <span class="dv">16</span> Bit Words</span>
  207. <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>ct <span class="op">=</span> Ciphertext Bytes Ct <span class="op">=</span> Ciphertext as <span class="dv">16</span> Bit Words</span>
  208. <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>k <span class="op">=</span> Key as Bytes K <span class="op">=</span> Key as <span class="dv">16</span> Bit Words</span>
  209. <span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span>
  210. <span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co">// Key Schedule</span></span>
  211. <span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a>D<span class="op">=</span>K<span class="op">[</span><span class="dv">3</span><span class="op">],</span> C<span class="op">=</span>K<span class="op">[</span><span class="dv">2</span><span class="op">],</span> B<span class="op">=</span>K<span class="op">[</span><span class="dv">1</span><span class="op">],</span> A<span class="op">=</span>K<span class="op">[</span><span class="dv">0</span><span class="op">]</span></span>
  212. <span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a></span>
  213. <span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> i in <span class="fl">0.</span><span class="er">.</span><span class="op">&lt;</span><span class="dv">22</span></span>
  214. <span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> rk<span class="op">[</span>i<span class="op">]=</span>A</span>
  215. <span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> ER16<span class="op">(</span>B<span class="op">,</span> A<span class="op">,</span> i<span class="op">++)</span></span>
  216. <span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> rk<span class="op">[</span>i<span class="op">]=</span>A</span>
  217. <span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a> ER16<span class="op">(</span>C<span class="op">,</span> A<span class="op">,</span> i<span class="op">++)</span></span>
  218. <span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> rk<span class="op">[</span>i<span class="op">]=</span>A</span>
  219. <span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a> ER16<span class="op">(</span>D<span class="op">,</span> A<span class="op">,</span> i<span class="op">++)</span></span>
  220. <span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a></span>
  221. <span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="co">// Encryption</span></span>
  222. <span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a>Ct<span class="op">[</span><span class="dv">0</span><span class="op">]=</span>Pt<span class="op">[</span><span class="dv">0</span><span class="op">];</span> Ct<span class="op">[</span><span class="dv">1</span><span class="op">]=</span>Pt<span class="op">[</span><span class="dv">1</span><span class="op">];</span></span>
  223. <span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a></span>
  224. <span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> i in <span class="fl">0.</span><span class="er">.</span><span class="op">&lt;</span><span class="dv">22</span></span>
  225. <span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a> ER16<span class="op">(</span>Ct<span class="op">[</span><span class="dv">1</span><span class="op">],</span> Ct<span class="op">[</span><span class="dv">0</span><span class="op">],</span> rk<span class="op">[</span>i<span class="op">++])</span></span></code></pre></div>
  226. </section>
  227. <section id="speck---möglicher-angriff" class="slide level1">
  228. <h1>Speck - Möglicher Angriff</h1>
  229. <ul>
  230. <li>Angriff der Rundenfunktion</li>
  231. <li>ADD/XOR/ROT Operationen</li>
  232. </ul>
  233. <div class="sourceCode" id="cb2"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> FuncER16<span class="op">(</span>u16 <span class="op">*</span>x<span class="op">,</span> u16 <span class="op">*</span>y<span class="op">,</span> u16 k<span class="op">)</span></span>
  234. <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
  235. <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> u16 tmp_x <span class="op">=</span> <span class="op">*</span>x<span class="op">;</span></span>
  236. <span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> u16 tmp_y <span class="op">=</span> <span class="op">*</span>y<span class="op">;</span></span>
  237. <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span>
  238. <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="op">*</span>x <span class="op">=</span> <span class="op">(((</span>tmp_x<span class="op">)&gt;&gt;(</span><span class="dv">7</span><span class="op">))</span> <span class="op">|</span> <span class="op">((</span>tmp_x<span class="op">)&lt;&lt;(</span><span class="dv">16</span><span class="op">-(</span><span class="dv">7</span><span class="op">))));</span> <span class="co">// ROR(7)</span></span>
  239. <span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> <span class="op">*</span>x <span class="op">+=</span> <span class="op">*</span>y<span class="op">;</span></span>
  240. <span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a></span>
  241. <span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> <span class="op">*</span>x <span class="op">=</span> <span class="op">*</span>x <span class="op">^</span> k<span class="op">;</span></span>
  242. <span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a></span>
  243. <span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> <span class="op">*</span>y <span class="op">=</span> <span class="op">(((</span>tmp_y<span class="op">)&lt;&lt;(</span><span class="dv">2</span><span class="op">))</span> <span class="op">|</span> <span class="op">(</span>tmp_y<span class="op">&gt;&gt;(</span><span class="dv">16</span><span class="op">-(</span><span class="dv">2</span><span class="op">))));</span> <span class="co">// ROL(2)</span></span>
  244. <span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> <span class="op">*</span>y <span class="op">=</span> <span class="op">*</span>y <span class="op">^</span> <span class="op">*</span>x<span class="op">;</span></span>
  245. <span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
  246. </section>
  247. <section id="speck---möglicher-angriff-1" class="slide level1">
  248. <h1>Speck - Möglicher Angriff</h1>
  249. <ul>
  250. <li>Der Rundenschlüssel steckt in der XOR Operation:</li>
  251. </ul>
  252. <p><img data-src="img/er16_enc_rk.png" /> <img data-src="img/er16_annot.png" /></p>
  253. </section>
  254. <section id="correlation-power-analysis" class="slide level1">
  255. <h1>Correlation Power Analysis</h1>
  256. <ul>
  257. <li>Variante von Differential Power Analysis (DPA)</li>
  258. <li>Nutzt Pearson Correlation Coefficient (PCC)</li>
  259. <li><strong>Bei Speck:</strong> Korrelation zwischen Power-Trace und Rundenschlüssel</li>
  260. <li>Vorgehen:
  261. <ul>
  262. <li>Modell erstellen</li>
  263. <li>Finden der Korrelationen im Modell</li>
  264. <li>Anwenden auf Hardware Implementierung</li>
  265. </ul></li>
  266. </ul>
  267. </section>
  268. <section id="hamming-weight" class="slide level1">
  269. <h1>Hamming Weight</h1>
  270. <ul>
  271. <li>Passendes Modell zum ‘bewerten’ des Stromverbrauchs</li>
  272. <li>Chip hat ein gewissen Basisverbrauch (IDLE)</li>
  273. <li>Werden Bytes im Chip verändert (<span class="math inline">0 → 1; 1 → 0</span>) wird Strom benötigt</li>
  274. <li>Verhalten kann durch die Hamming-Distanz simuliert werden</li>
  275. <li><strong>Hamming Distanz:</strong> Anzahl der Veränderter Bits:</li>
  276. </ul>
  277. <p><span class="math display"><em>H</em><em>a</em><em>m</em><em>m</em><em>i</em><em>n</em><em>g</em><em>D</em><em>i</em><em>s</em><em>t</em><em>a</em><em>n</em><em>c</em><em>e</em>(0100101,0010101) = 2</span></p>
  278. <p>Der Unterschied zweier per XOR verknüpfter Daten, wird als Hamming-Gewicht bezeichnet:</p>
  279. <p><span class="math display"><em>H</em><em>a</em><em>m</em><em>m</em><em>i</em><em>n</em><em>g</em><em>D</em><em>i</em><em>s</em><em>t</em><em>a</em><em>n</em><em>c</em><em>e</em>(0100101,0010101) = <em>H</em><em>a</em><em>m</em><em>m</em><em>i</em><em>n</em><em>g</em><em>W</em><em>e</em><em>i</em><em>g</em><em>h</em><em>t</em>(0100101⊕0010101)</span></p>
  280. </section>
  281. <section id="speck---modell" class="slide level1">
  282. <h1>Speck - Modell</h1>
  283. <ul>
  284. <li>Einfaches Modell der Speck Verschlüsselung</li>
  285. <li>Kann für die ersten 2 Byte des Rundenschlüssels genutzt werden:</li>
  286. </ul>
  287. <div class="sourceCode" id="cb3"><pre class="sourceCode python"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> simple_speck(plaintext, key):</span>
  288. <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> Ct_0 <span class="op">=</span> (<span class="bu">int</span>(plaintext[<span class="dv">1</span>]) <span class="op">&lt;&lt;</span> <span class="dv">8</span>) <span class="op">+</span> <span class="bu">int</span>(plaintext[<span class="dv">0</span>]) <span class="co"># RIGHT Key</span></span>
  289. <span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> Ct_1 <span class="op">=</span> (<span class="bu">int</span>(plaintext[<span class="dv">3</span>]) <span class="op">&lt;&lt;</span> <span class="dv">8</span>) <span class="op">+</span> <span class="bu">int</span>(plaintext[<span class="dv">2</span>]) <span class="co"># LEFT Key</span></span>
  290. <span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
  291. <span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> Ct_1, Ct_0 <span class="op">=</span> ER16(Ct_1, Ct_0, key) <span class="co"># Calculate Roundfunction</span></span>
  292. <span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a></span>
  293. <span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> popcount((Ct_1 <span class="op">&lt;&lt;</span> <span class="dv">8</span>) <span class="op">+</span> Ct_0) <span class="co"># Return Hamming Weight (aka Popcount)</span></span></code></pre></div>
  294. </section>
  295. <section id="speck---simulation" class="slide level1">
  296. <h1>Speck - Simulation</h1>
  297. <ol start="0" type="1">
  298. <li>Simulation anhand des Modells mit <span class="math inline"><em>n</em></span> traces</li>
  299. <li>Generieren von <span class="math inline"><em>n</em></span> zufälligen Klartexten mit <strong>fixem</strong> Keybyte (+ noise)</li>
  300. <li>Simulation aller möglichen Keybytes per Hamming Weight</li>
  301. <li>Berechnen des PCC aller Keys über alle traces</li>
  302. </ol>
  303. <p><img data-src="img/simulation_corr.png" /></p>
  304. <p><span class="math inline">→</span> Das korrekte Keybyte ist: 0x68</p>
  305. </section>
  306. <section id="t-test" class="slide level1">
  307. <h1>T-Test</h1>
  308. <ul>
  309. <li>Wird verwendet um <em>Leakage</em> zu erkennen
  310. <ul>
  311. <li>Gibt das Berechnen einer Chiffre mehr Information zurück als geplant: Leakage</li>
  312. <li>Ausnutzbar z.B. durch die Power Traces</li>
  313. </ul></li>
  314. <li>Berechnet durch:</li>
  315. </ul>
  316. <p><img data-src="img/ttest_calc.png" /></p>
  317. <ul>
  318. <li>Vergleicht zwei unabhängige Stichproben miteinander, und vergleicht Mittelwerte</li>
  319. <li>Je unterschiedlicher die Mittelwerte <span class="math inline">→</span> desto weniger Leakage</li>
  320. </ul>
  321. </section>
  322. <section id="t-test-1" class="slide level1">
  323. <h1>T-Test</h1>
  324. <ul>
  325. <li>T-Test der aufgezeichneten Power-Traces:</li>
  326. </ul>
  327. <p><img data-src="img/t_test_original.png" /></p>
  328. </section>
  329. <section id="angriff---hardware" class="slide level1">
  330. <h1>Angriff - Hardware</h1>
  331. <ol type="1">
  332. <li>Implementierung von Speck auf CW</li>
  333. <li>Aufzeichnen von <span class="math inline"><em>n</em></span> Power Traces</li>
  334. <li>Berechnung des Software Modells</li>
  335. <li>Berechnen der Korrelationen zwischen Modell/Powertraces
  336. <ul>
  337. <li>Keybyte für Keybyte</li>
  338. <li>Rückrechnen des Rundenschlüssels</li>
  339. </ul></li>
  340. </ol>
  341. </section>
  342. <section id="korrelationen-des-ersten-keybytes" class="slide level1">
  343. <h1>Korrelationen des ersten Keybytes</h1>
  344. <ul>
  345. <li>Correlationen des ersten Keybytes</li>
  346. <li>Korrelation fällt höher aus als im Modell</li>
  347. <li>Deutliches Maximum der Korrelation bei 0x22 (Korrektes Keybyte)</li>
  348. </ul>
  349. <p><img data-src="img/correlation_first_keybyte.png" width="550" /></p>
  350. </section>
  351. <section id="problem-blocksize" class="slide level1">
  352. <h1>Problem: Blocksize</h1>
  353. <ul>
  354. <li>Bei <strong>Speck1632:</strong> Operationen nicht auf Byte sondern auf 16-Bit Ebene</li>
  355. <li>Erste Idee: Modell und Korrelation auf <span class="math inline">2<sup>16</sup></span> Keys</li>
  356. <li><span class="math inline">→</span> Keyspace ist abdeckbar (65536 Keys)</li>
  357. <li><span class="math inline">→</span> Zu langsam, Unschön</li>
  358. <li><span class="math inline">→</span> Nicht möglich für andere Modis von Speck (32 Bit Subkeys)</li>
  359. <li><strong>Lösung:</strong> Modell funktioniert auch auf allen Teilbytes per Shift:</li>
  360. </ul>
  361. <div class="sourceCode" id="cb4"><pre class="sourceCode python"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>rightkey <span class="op">=</span> <span class="bn">0x00</span></span>
  362. <span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> guess_key <span class="kw">in</span> <span class="bu">range</span>(<span class="dv">256</span>):</span>
  363. <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> leftkey <span class="op">=</span> model( (guess_key <span class="op">&lt;&lt;</span> <span class="dv">8</span>) <span class="op">+</span> righkey )</span>
  364. <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
  365. <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> guess_key <span class="kw">in</span> <span class="bu">range</span>(<span class="dv">256</span>):</span>
  366. <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> rightkey <span class="op">=</span> model( (leftkey <span class="op">&lt;&lt;</span> <span class="dv">8</span>) <span class="op">+</span> guess_key )</span></code></pre></div>
  367. <ul>
  368. <li>Auch umsetzbar auf Speck mit Blocksize &gt; 16 Bit</li>
  369. </ul>
  370. </section>
  371. <section id="problem-nth-keybytes" class="slide level1">
  372. <h1>Problem: <span class="math inline"><em>n</em><sup><em>t</em><em>h</em></sup></span> Keybytes</h1>
  373. <ul>
  374. <li>Modell kann nur für die ersten zwei Keybytes genutzt werden, da:</li>
  375. </ul>
  376. <div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> i in <span class="fl">0.</span><span class="er">.</span><span class="op">&lt;</span><span class="dv">22</span></span>
  377. <span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> ER16<span class="op">(</span>Ct<span class="op">[</span><span class="dv">1</span><span class="op">],</span> Ct<span class="op">[</span><span class="dv">0</span><span class="op">],</span> rk<span class="op">[</span>i<span class="op">++])</span></span></code></pre></div>
  378. <ul>
  379. <li>Die (bereits bekannten) Rundenkeys müssen miteingeschlossen werden</li>
  380. <li>Muss an der richtigen Stelle passieren (<span class="math inline">⊕</span>-Operation)</li>
  381. </ul>
  382. </section>
  383. <section id="problem-nth-keybytes-1" class="slide level1">
  384. <h1>Problem: <span class="math inline"><em>n</em><sup><em>t</em><em>h</em></sup></span> Keybytes</h1>
  385. <ul>
  386. <li>Anpassung des Modells:</li>
  387. </ul>
  388. <div class="sourceCode" id="cb6"><pre class="sourceCode python"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># -------------- for one key -----------------#</span></span>
  389. <span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> x <span class="op">=</span> ((x <span class="op">&lt;&lt;</span> (<span class="dv">16</span> <span class="op">-</span> ALPHA)) <span class="op">+</span> (x <span class="op">&gt;&gt;</span> ALPHA)) <span class="op">&amp;</span> mod_mask <span class="co"># x = ROR(x, 7)</span></span>
  390. <span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> x <span class="op">=</span> (x <span class="op">+</span> y) <span class="op">&amp;</span> mod_mask <span class="co"># x = ADD(x, y)</span></span>
  391. <span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a></span>
  392. <span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> x <span class="op">=</span> x <span class="op">^</span> knownkey[<span class="dv">0</span>]</span>
  393. <span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a></span>
  394. <span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="co"># -------------- for second key -----------------#</span></span>
  395. <span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a></span>
  396. <span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> y <span class="op">=</span> ((y <span class="op">&gt;&gt;</span> (<span class="dv">16</span> <span class="op">-</span> BETA)) <span class="op">+</span> (y <span class="op">&lt;&lt;</span> BETA)) <span class="op">&amp;</span> mod_mask <span class="co"># y = ROL(y, 2)</span></span>
  397. <span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a> y <span class="op">=</span> y <span class="op">^</span> x <span class="co"># y = XOR(y, x)</span></span>
  398. <span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a> x <span class="op">=</span> ((x <span class="op">&lt;&lt;</span> (<span class="dv">16</span> <span class="op">-</span> ALPHA)) <span class="op">+</span> (x <span class="op">&gt;&gt;</span> ALPHA)) <span class="op">&amp;</span> mod_mask <span class="co"># x = ROR(x, 7)</span></span>
  399. <span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a> x <span class="op">=</span> (x <span class="op">+</span> y) <span class="op">&amp;</span> mod_mask <span class="co"># x = ADD(x, y)</span></span>
  400. <span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a></span>
  401. <span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a> x <span class="op">=</span> x <span class="op">^</span> knownkey[<span class="dv">1</span>] <span class="co"># x = XOR(x, k)</span></span>
  402. <span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a></span>
  403. <span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a> <span class="co"># -------------- for third key -----------------#</span></span>
  404. <span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a> <span class="co"># [...]</span></span></code></pre></div>
  405. </section>
  406. <section id="korrelationen-des-ersten-keybytes-1" class="slide level1">
  407. <h1>Korrelationen des ersten Keybytes</h1>
  408. <ul>
  409. <li>Graph zeigt die Korrelationen des ersten Keybytes bis 5000 traces</li>
  410. <li>Ab ~800 Traces hebt sich die Korrelation deutlich hervor</li>
  411. </ul>
  412. <p><img data-src="img/traces.png" width="550" /></p>
  413. </section>
  414. <section id="gegenmaßnahmen" class="slide level1">
  415. <h1>Gegenmaßnahmen</h1>
  416. </section>
  417. <section id="hiding" class="slide level1">
  418. <h1>Hiding</h1>
  419. <ul>
  420. <li>Verstecken des eigentlichen “Leakages” in Rauschen</li>
  421. <li><span class="math inline">→</span> Erhöhung des vorhandenen Rauschens während der Berechnung</li>
  422. <li>Mehrere Möglichkeiten
  423. <ul>
  424. <li>Mischen der Instruction-Order</li>
  425. <li><strong>Hinzufügen von “Dummy Instructionen”</strong></li>
  426. <li>Clock Jitter</li>
  427. </ul></li>
  428. </ul>
  429. </section>
  430. <section id="hiding---code" class="slide level1">
  431. <h1>Hiding - Code</h1>
  432. <ul>
  433. <li><strong>Ansatz:</strong> Korrelation kommt von <code>ER16()</code>
  434. <ul>
  435. <li>Add/XOR/Rotate</li>
  436. </ul></li>
  437. <li>Hinzufügen weitere AXR Operationen um noise zu erhöhen</li>
  438. <li>Ersetzen von jeder XOR Operatione mit folgender:</li>
  439. </ul>
  440. <div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="dt">uint16_t</span> XOR<span class="op">(</span><span class="dt">uint16_t</span> a<span class="op">,</span> <span class="dt">uint16_t</span> b<span class="op">,</span> <span class="dt">int</span> random<span class="op">)</span> <span class="op">{</span></span>
  441. <span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="dt">uint8_t</span> tmp <span class="op">=</span> random <span class="op">^</span> <span class="bn">0x5F</span><span class="op">;</span></span>
  442. <span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> tmp <span class="op">^=</span> <span class="op">(</span>random <span class="op">^</span> a<span class="op">);</span></span>
  443. <span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> tmp <span class="op">^=</span> <span class="op">(</span>tmp <span class="op">^</span> b<span class="op">);</span></span>
  444. <span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> tmp <span class="op">&amp;=</span> <span class="op">(</span>tmp <span class="op">&amp;</span> a<span class="op">);</span></span>
  445. <span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> tmp <span class="op">&amp;=</span> <span class="op">(</span>tmp <span class="op">&amp;</span> b<span class="op">);</span></span>
  446. <span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> a <span class="op">^</span> b<span class="op">;</span></span>
  447. <span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
  448. <ul>
  449. <li><code>Random</code> wird bei jeder Verschlüsslung erneut generiert</li>
  450. </ul>
  451. </section>
  452. <section id="hiding---t-test" class="slide level1">
  453. <h1>Hiding - T-Test</h1>
  454. <ul>
  455. <li>Ergebnisse des T-Tests mit implementierter Hiding Maßnahmen:</li>
  456. </ul>
  457. <p><img data-src="img/t_test_hiding_random.png" /></p>
  458. <ul>
  459. <li>Bedarf weitere Analysen, Unterschied der beiden T-Tests sind nur Minimal</li>
  460. <li><strong>Keine</strong> Indikation dass Hiding funktioniert laut T-Test</li>
  461. </ul>
  462. </section>
  463. <section id="korrelationen-des-ersten-keybytes-2" class="slide level1">
  464. <h1>Korrelationen des ersten Keybytes</h1>
  465. <ul>
  466. <li>Besseres Ergbniss der Korrelationen bis 5000 Traces</li>
  467. <li>Korrelationen flachen ab ~800 drastisch ab</li>
  468. <li>Keine Korrelation sticht heraus</li>
  469. </ul>
  470. <p><img data-src="img/corr_traces_hiding_5k.png" width="550" /></p>
  471. <ul>
  472. <li>Es war nicht möglich den Angriff erneut durchzuführen</li>
  473. <li>Neue Korrelationen nach einigen Test lediglich bei ~0.18 mit falschem Keybyte</li>
  474. </ul>
  475. </section>
  476. <section id="hiding-potentieller-bypass" class="slide level1">
  477. <h1>Hiding (Potentieller) Bypass</h1>
  478. <ul>
  479. <li>Korrelation sollte weiterhin möglich sein wenn man die Operationen in Betracht zieht</li>
  480. <li>Schwierigkeit hängt am Zufallszahlengenerator</li>
  481. <li><strong>Problem:</strong> Sichere Zufallszahlen auf Embedded Chips ist nicht trivial</li>
  482. </ul>
  483. <p><span class="math inline">→</span> Bypass konnte <strong>nicht</strong> realisiert werden</p>
  484. </section>
  485. <section id="referenzen" class="slide level1">
  486. <h1>Referenzen</h1>
  487. <ul>
  488. <li><a href="Improved%20Differential%20Cryptanalysis%20of%20Round-Reduced%20Speck">Improved Differential Cryptanalysis of Round-Reduced Speck</a></li>
  489. <li><a href="Breaking%20Speck%20cryptosystem%20using%20correlation%20power%20analysis%20attack">Breaking Speck cryptosystem using correlation power analysis attack</a></li>
  490. <li><a href="%7BSpeck-R:%20An%20ultra%20light-weight%20cryptographic%20scheme%20for%20Internet%20of%20Things">Speck-R: An ultra light-weight cryptographic scheme for Internet of Things</a></li>
  491. </ul>
  492. </section>
  493. </div>
  494. </div>
  495. <script src="./reveal.js/dist/reveal.js"></script>
  496. <!-- reveal.js plugins -->
  497. <script src="./reveal.js/plugin/notes/notes.js"></script>
  498. <script src="./reveal.js/plugin/search/search.js"></script>
  499. <script src="./reveal.js/plugin/zoom/zoom.js"></script>
  500. <script>
  501. // Full list of configuration options available at:
  502. // https://revealjs.com/config/
  503. Reveal.initialize({
  504. // Display controls in the bottom right corner
  505. controls: true,
  506. // Help the user learn the controls by providing hints, for example by
  507. // bouncing the down arrow when they first encounter a vertical slide
  508. controlsTutorial: true,
  509. // Determines where controls appear, "edges" or "bottom-right"
  510. controlsLayout: 'bottom-right',
  511. // Visibility rule for backwards navigation arrows; "faded", "hidden"
  512. // or "visible"
  513. controlsBackArrows: 'faded',
  514. // Display a presentation progress bar
  515. progress: true,
  516. // Display the page number of the current slide
  517. slideNumber: true,
  518. // 'all', 'print', or 'speaker'
  519. showSlideNumber: 'all',
  520. // Add the current slide number to the URL hash so that reloading the
  521. // page/copying the URL will return you to the same slide
  522. hash: false,
  523. // Start with 1 for the hash rather than 0
  524. hashOneBasedIndex: false,
  525. // Flags if we should monitor the hash and change slides accordingly
  526. respondToHashChanges: true,
  527. // Push each slide change to the browser history
  528. history: false,
  529. // Enable keyboard shortcuts for navigation
  530. keyboard: true,
  531. // Enable the slide overview mode
  532. overview: true,
  533. // Disables the default reveal.js slide layout (scaling and centering)
  534. // so that you can use custom CSS layout
  535. disableLayout: false,
  536. // Vertical centering of slides
  537. center: true,
  538. // Enables touch navigation on devices with touch input
  539. touch: true,
  540. // Loop the presentation
  541. loop: false,
  542. // Change the presentation direction to be RTL
  543. rtl: false,
  544. // see https://revealjs.com/vertical-slides/#navigation-mode
  545. navigationMode: 'default',
  546. // Randomizes the order of slides each time the presentation loads
  547. shuffle: false,
  548. // Turns fragments on and off globally
  549. fragments: true,
  550. // Flags whether to include the current fragment in the URL,
  551. // so that reloading brings you to the same fragment position
  552. fragmentInURL: true,
  553. // Flags if the presentation is running in an embedded mode,
  554. // i.e. contained within a limited portion of the screen
  555. embedded: false,
  556. // Flags if we should show a help overlay when the questionmark
  557. // key is pressed
  558. help: true,
  559. // Flags if it should be possible to pause the presentation (blackout)
  560. pause: true,
  561. // Flags if speaker notes should be visible to all viewers
  562. showNotes: false,
  563. // Global override for autoplaying embedded media (null/true/false)
  564. autoPlayMedia: null,
  565. // Global override for preloading lazy-loaded iframes (null/true/false)
  566. preloadIframes: null,
  567. // Number of milliseconds between automatically proceeding to the
  568. // next slide, disabled when set to 0, this value can be overwritten
  569. // by using a data-autoslide attribute on your slides
  570. autoSlide: 0,
  571. // Stop auto-sliding after user input
  572. autoSlideStoppable: true,
  573. // Use this method for navigation when auto-sliding
  574. autoSlideMethod: null,
  575. // Specify the average time in seconds that you think you will spend
  576. // presenting each slide. This is used to show a pacing timer in the
  577. // speaker view
  578. defaultTiming: null,
  579. // Enable slide navigation via mouse wheel
  580. mouseWheel: false,
  581. // The display mode that will be used to show slides
  582. display: 'block',
  583. // Hide cursor if inactive
  584. hideInactiveCursor: true,
  585. // Time before the cursor is hidden (in ms)
  586. hideCursorTime: 5000,
  587. // Opens links in an iframe preview overlay
  588. previewLinks: false,
  589. // Transition style (none/fade/slide/convex/concave/zoom)
  590. transition: 'slide',
  591. // Transition speed (default/fast/slow)
  592. transitionSpeed: 'default',
  593. // Transition style for full page slide backgrounds
  594. // (none/fade/slide/convex/concave/zoom)
  595. backgroundTransition: 'fade',
  596. // Number of slides away from the current that are visible
  597. viewDistance: 3,
  598. // Number of slides away from the current that are visible on mobile
  599. // devices. It is advisable to set this to a lower number than
  600. // viewDistance in order to save resources.
  601. mobileViewDistance: 2,
  602. // reveal.js plugins
  603. plugins: [
  604. RevealNotes,
  605. RevealSearch,
  606. RevealZoom
  607. ]
  608. });
  609. </script>
  610. </body>
  611. </html>