slides.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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>Implementation Attacks</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">Implementation Attacks</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>Einleitung</li>
  99. <li>Seitenkanalangriffe</li>
  100. <li>Speck</li>
  101. <li>CPA Angriffe</li>
  102. <li>CPA auf Speck</li>
  103. <li>Gegenmaßnahmen</li>
  104. <li>Hiding</li>
  105. </ul>
  106. </section>
  107. <section id="bedeutung-von-seitenkanalangriffen" class="slide level1">
  108. <h1>Bedeutung von Seitenkanalangriffen</h1>
  109. </section>
  110. <section id="voraussetzungen-für-erfolgreichen-angriff" class="slide level1">
  111. <h1>Voraussetzungen für erfolgreichen Angriff</h1>
  112. </section>
  113. <section id="speck" class="slide level1">
  114. <h1>Speck</h1>
  115. <ul>
  116. <li>Symmentrische ARX Schiffre
  117. <ul>
  118. <li>Add/Rotate/XOR</li>
  119. </ul></li>
  120. <li>Entworfen von der NSA (Zusammen mit der Schiffre Simon)</li>
  121. <li>Performant in Hard-/Software</li>
  122. <li>Speck bietet mehrere mögliche Modis
  123. <ul>
  124. <li>Anzahl Runden, Schlüssellänge, Blocklänge</li>
  125. </ul></li>
  126. <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>
  127. </ul>
  128. </section>
  129. <section id="speck---setups" class="slide level1">
  130. <h1>Speck - Setups</h1>
  131. <table>
  132. <thead>
  133. <tr class="header">
  134. <th>Speck</th>
  135. <th>Blocklänge</th>
  136. <th>Schlüssellänge</th>
  137. <th>Runden</th>
  138. </tr>
  139. </thead>
  140. <tbody>
  141. <tr class="odd">
  142. <td><span style="color:#d08a1d"><strong>Speck3264</strong></span></td>
  143. <td><span style="color:#d08a1d"><strong>32 Bit</strong></span></td>
  144. <td><span style="color:#d08a1d"><strong>64 Bit</strong></span></td>
  145. <td><span style="color:#d08a1d"><strong>22</strong></span></td>
  146. </tr>
  147. <tr class="even">
  148. <td>Speck4872</td>
  149. <td>48 Bit</td>
  150. <td>72 Bit</td>
  151. <td>22</td>
  152. </tr>
  153. <tr class="odd">
  154. <td>Speck4896</td>
  155. <td>48 Bit</td>
  156. <td>96 Bit</td>
  157. <td>23</td>
  158. </tr>
  159. <tr class="even">
  160. <td>Speck6496</td>
  161. <td>64 Bit</td>
  162. <td>96 Bit</td>
  163. <td>26</td>
  164. </tr>
  165. <tr class="odd">
  166. <td>Speck64128</td>
  167. <td>64 Bit</td>
  168. <td>128 Bit</td>
  169. <td>27</td>
  170. </tr>
  171. <tr class="even">
  172. <td>Speck9696</td>
  173. <td>96 Bit</td>
  174. <td>96 Bit</td>
  175. <td>28</td>
  176. </tr>
  177. <tr class="odd">
  178. <td>Speck96144</td>
  179. <td>96 Bit</td>
  180. <td>144 Bit</td>
  181. <td>29</td>
  182. </tr>
  183. <tr class="even">
  184. <td>Speck128128</td>
  185. <td>128 Bit</td>
  186. <td>128 Bit</td>
  187. <td>32</td>
  188. </tr>
  189. <tr class="odd">
  190. <td>Speck128192</td>
  191. <td>128 Bit</td>
  192. <td>192 Bit</td>
  193. <td>33</td>
  194. </tr>
  195. <tr class="even">
  196. <td>Speck1281256</td>
  197. <td>128 Bit</td>
  198. <td>256 Bit</td>
  199. <td>34</td>
  200. </tr>
  201. </tbody>
  202. </table>
  203. </section>
  204. <section id="speck---rundenfunktion" class="slide level1">
  205. <h1>Speck - Rundenfunktion</h1>
  206. <p><img data-src="img/rundenfunktion.png" width="400" /></p>
  207. <ul>
  208. <li>Wird während der Key Schedule aufgerufen</li>
  209. <li>Wird beim der Verschlüsselung aufgerufen</li>
  210. </ul>
  211. </section>
  212. <section id="speck---pseudocode" class="slide level1">
  213. <h1>Speck - Pseudocode</h1>
  214. <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>
  215. <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>
  216. <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>
  217. <span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span>
  218. <span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co">// Key Schedule</span></span>
  219. <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>
  220. <span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a></span>
  221. <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>
  222. <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>
  223. <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>
  224. <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>
  225. <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>
  226. <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>
  227. <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>
  228. <span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a></span>
  229. <span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="co">// Encryption</span></span>
  230. <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>
  231. <span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a></span>
  232. <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>
  233. <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>
  234. </section>
  235. <section id="speck---möglicher-angriff" class="slide level1">
  236. <h1>Speck - Möglicher Angriff</h1>
  237. <ul>
  238. <li>Angriff der Rundenfunktion</li>
  239. <li>ADD/XOR/ROT Operationen</li>
  240. </ul>
  241. <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>
  242. <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
  243. <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>
  244. <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>
  245. <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span>
  246. <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>
  247. <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>
  248. <span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a></span>
  249. <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>
  250. <span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a></span>
  251. <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>
  252. <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>
  253. <span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
  254. </section>
  255. <section id="speck---möglicher-angriff-1" class="slide level1">
  256. <h1>Speck - Möglicher Angriff</h1>
  257. <ul>
  258. <li>Der Rundenschlüssel steckt in der XOR Operation</li>
  259. </ul>
  260. <p><img data-src="img/er16_enc_rk.png" /> <img data-src="img/er16_annot.png" /></p>
  261. </section>
  262. <section id="correlation-power-analysis" class="slide level1">
  263. <h1>Correlation Power Analysis</h1>
  264. <ul>
  265. <li>Variante von Differential Power Analysis (DPA)</li>
  266. <li>Nutzt Pearson Correlation Coefficient (PCC)</li>
  267. <li><strong>Bei Speck:</strong> Korrelation zwischen Power-Trace und Rundenschlüssel</li>
  268. <li>Vorgehen:
  269. <ul>
  270. <li>Modell erstellen</li>
  271. <li>Finden der Korrelationen im Modell</li>
  272. <li>Anwenden auf Hardware Implementierung</li>
  273. </ul></li>
  274. </ul>
  275. </section>
  276. <section id="theoretischer-angriff" class="slide level1">
  277. <h1>Theoretischer Angriff</h1>
  278. </section>
  279. <section id="hamming-weight" class="slide level1">
  280. <h1>Hamming Weight</h1>
  281. <ul>
  282. <li>Passendes Modell zum ‘bewerten’ des Stromverbrauchs</li>
  283. <li>Chip hat ein gewissen Basisverbrauch (IDLE)</li>
  284. <li>Werden Bytes im Chip verändert (<span class="math inline">0 → 1; 1 → 0</span>) wird Strom benötigt</li>
  285. <li>Verhalten kann durch die Hamming-Distanz simuliert werden</li>
  286. <li><strong>Hamming Distanz:</strong> Anzahl der Veränderter Bits:</li>
  287. </ul>
  288. <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>
  289. <p>Der Unterschied zweier per XOR verknüpfter Daten, wird als Hamming-Gewicht bezeichnet:</p>
  290. <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>
  291. </section>
  292. <section id="speck---modell" class="slide level1">
  293. <h1>Speck - Modell</h1>
  294. <ul>
  295. <li>Einfaches Modell der Speck Verschlüsselung</li>
  296. <li>Kann für die ersten 2 Byte des Rundenschlüssels genutzt werden:</li>
  297. </ul>
  298. <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>
  299. <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>
  300. <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>
  301. <span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> </span>
  302. <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>
  303. <span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> </span>
  304. <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 Wight (aka Popcount)</span></span></code></pre></div>
  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>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" class="slide level1">
  330. <h1>Angriff</h1>
  331. <ol type="1">
  332. <li>Implementierung von Speck auf CW</li>
  333. <li>Aufzeichnen von X PowerTraces</li>
  334. <li>Berechnung des Software Modells</li>
  335. <li>Berechnen der Korrelationen zwischen Modell/Powertraces
  336. <ol type="1">
  337. <li>Keybyte für Keybyte</li>
  338. <li>Rückrechnen des Rundenschlüssels</li>
  339. </ol></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>Deutliches Maximum der Korrelation bei 0x11</li>
  347. </ul>
  348. <p><img data-src="img/correlation_keybyte.png" width="550" /></p>
  349. </section>
  350. <section id="problem-blocksize" class="slide level1">
  351. <h1>Problem: Blocksize</h1>
  352. <ul>
  353. <li>Bei <strong>Speck1632:</strong> Operationen nicht auf Byte sondern auf 16-Bit Ebene</li>
  354. <li>Erste Idee: Modell und Korrelation auf <span class="math inline">2<sup>16</sup></span> Keys</li>
  355. <li><span class="math inline"></span> Zu langsam, Unschön</li>
  356. <li><span class="math inline"></span> Nicht möglich für andere Modis von Speck</li>
  357. <li><strong>Lösung:</strong> Modell funktioniert auch auf allen Teilbytes:</li>
  358. </ul>
  359. <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>
  360. <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>
  361. <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>
  362. <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
  363. <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>
  364. <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>
  365. <ul>
  366. <li>Auch umsetzbar auf Speck mit Blocksize &gt; 16 Bit</li>
  367. </ul>
  368. </section>
  369. <section id="problem-nth-keybytes" class="slide level1">
  370. <h1>Problem: <span class="math inline"><em>n</em><sup><em>t</em><em>h</em></sup></span> Keybytes</h1>
  371. <ul>
  372. <li>Modell kann nur für die ersten zwei Keybytes genutzt werden, da:</li>
  373. </ul>
  374. <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>
  375. <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>
  376. <ul>
  377. <li>Die Rundenkeys zuvor müssen miteingeschlossen werden</li>
  378. <li>Muss an der richtigen Stelle passieren (<span class="math inline"></span>-Operation)</li>
  379. </ul>
  380. </section>
  381. <section id="problem-nth-keybytes-1" class="slide level1">
  382. <h1>Problem: <span class="math inline"><em>n</em><sup><em>t</em><em>h</em></sup></span> Keybytes</h1>
  383. <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>
  384. <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>
  385. <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>
  386. <span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> </span>
  387. <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>
  388. <span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> </span>
  389. <span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="co"># -------------- for second key -----------------#</span></span>
  390. <span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> </span>
  391. <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>
  392. <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>
  393. <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>
  394. <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>
  395. <span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a> </span>
  396. <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>
  397. <span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a> </span>
  398. <span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a> <span class="co"># -------------- for third key -----------------#</span></span>
  399. <span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a> <span class="co"># [...]</span></span></code></pre></div>
  400. </section>
  401. <section id="korrelationen-des-ersten-keybytes-1" class="slide level1">
  402. <h1>Korrelationen des ersten Keybytes</h1>
  403. <p><img data-src="img/traces.png" width="550" /></p>
  404. </section>
  405. <section id="gegenmaßnahmen" class="slide level1">
  406. <h1>Gegenmaßnahmen</h1>
  407. </section>
  408. <section id="hiding" class="slide level1">
  409. <h1>Hiding</h1>
  410. <ul>
  411. <li>Verstecken des eigentlichen “Leakages” in Rauschen</li>
  412. <li><span class="math inline"></span> Erhöhung des vorhandenen Rauschens während der Berechnung</li>
  413. <li>Mehrere Möglichkeiten
  414. <ul>
  415. <li>Mischen der Instruction-Order</li>
  416. <li><strong>Hinzufügen von “Dummy Instructionen”</strong></li>
  417. <li>Clock Jitter</li>
  418. </ul></li>
  419. </ul>
  420. </section>
  421. <section id="hiding---code" class="slide level1">
  422. <h1>Hiding - Code</h1>
  423. <ul>
  424. <li><strong>Ansatz:</strong> Korrelation kommt von <code>ER16()</code>
  425. <ul>
  426. <li>XOR/Add/Rotate</li>
  427. </ul></li>
  428. <li>Hinzufügen weitere RXA Operationen um Noice zu erhöhen</li>
  429. <li>Ersetzen von jeder XOR Operatione mit folgender:</li>
  430. </ul>
  431. <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>
  432. <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>
  433. <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>
  434. <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>
  435. <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>
  436. <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>
  437. <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>
  438. <span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
  439. <ul>
  440. <li>Random wird bei jeder Verschlüsslung erneut generiert</li>
  441. </ul>
  442. </section>
  443. <section id="hiding---t-test" class="slide level1">
  444. <h1>Hiding - T-Test</h1>
  445. <ul>
  446. <li>Ergebnisse des T-Tests mit implementierter Hiding Maßnahmen:</li>
  447. </ul>
  448. <p><img data-src="img/t_test_hiding_random.png" /></p>
  449. <ul>
  450. <li>Bedarf weitere Analysen, Unterschied der beiden T-Tests sind nur Minimal</li>
  451. <li>Keine Indikation dass Hiding funktioniert</li>
  452. </ul>
  453. </section>
  454. <section id="korrelationen-des-ersten-keybytes-2" class="slide level1">
  455. <h1>Korrelationen des ersten Keybytes</h1>
  456. <ul>
  457. <li>Besseres Ergbniss der Korrelationen bis 5000 Traces</li>
  458. <li>Keine Korrelation sticht heraus</li>
  459. </ul>
  460. <p><img data-src="img/corr_traces_hiding_5k.png" width="550" /></p>
  461. </section>
  462. <section id="hiding-bypass" class="slide level1">
  463. <h1>Hiding Bypass</h1>
  464. <ul>
  465. <li>Korrelation sollte weiterhin möglich sein wenn man die Operationen in Betracht zieht</li>
  466. <li>Schwierigkeit hängt am Zufallszahlengenerator</li>
  467. <li><strong>Problem:</strong> Sichere Zufallszahlen auf Embedded Chips ist nicht trivial</li>
  468. </ul>
  469. <p><span class="math inline"></span> Bypass konnte <strong>nicht</strong> realisiert werden</p>
  470. </section>
  471. <section id="referenzen" class="slide level1">
  472. <h1>Referenzen</h1>
  473. <ul>
  474. <li><a href="Improved%20Differential%20Cryptanalysis%20of%20Round-Reduced%20Speck">Improved Differential Cryptanalysis of Round-Reduced Speck</a></li>
  475. <li><a href="Breaking%20Speck%20cryptosystem%20using%20correlation%20power%20analysis%20attack">Breaking Speck cryptosystem using correlation power analysis attack</a></li>
  476. <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>
  477. </ul>
  478. </section>
  479. </div>
  480. </div>
  481. <script src="./reveal.js/dist/reveal.js"></script>
  482. <!-- reveal.js plugins -->
  483. <script src="./reveal.js/plugin/notes/notes.js"></script>
  484. <script src="./reveal.js/plugin/search/search.js"></script>
  485. <script src="./reveal.js/plugin/zoom/zoom.js"></script>
  486. <script>
  487. // Full list of configuration options available at:
  488. // https://revealjs.com/config/
  489. Reveal.initialize({
  490. // Display controls in the bottom right corner
  491. controls: true,
  492. // Help the user learn the controls by providing hints, for example by
  493. // bouncing the down arrow when they first encounter a vertical slide
  494. controlsTutorial: true,
  495. // Determines where controls appear, "edges" or "bottom-right"
  496. controlsLayout: 'bottom-right',
  497. // Visibility rule for backwards navigation arrows; "faded", "hidden"
  498. // or "visible"
  499. controlsBackArrows: 'faded',
  500. // Display a presentation progress bar
  501. progress: true,
  502. // Display the page number of the current slide
  503. slideNumber: true,
  504. // 'all', 'print', or 'speaker'
  505. showSlideNumber: 'all',
  506. // Add the current slide number to the URL hash so that reloading the
  507. // page/copying the URL will return you to the same slide
  508. hash: false,
  509. // Start with 1 for the hash rather than 0
  510. hashOneBasedIndex: false,
  511. // Flags if we should monitor the hash and change slides accordingly
  512. respondToHashChanges: true,
  513. // Push each slide change to the browser history
  514. history: false,
  515. // Enable keyboard shortcuts for navigation
  516. keyboard: true,
  517. // Enable the slide overview mode
  518. overview: true,
  519. // Disables the default reveal.js slide layout (scaling and centering)
  520. // so that you can use custom CSS layout
  521. disableLayout: false,
  522. // Vertical centering of slides
  523. center: true,
  524. // Enables touch navigation on devices with touch input
  525. touch: true,
  526. // Loop the presentation
  527. loop: false,
  528. // Change the presentation direction to be RTL
  529. rtl: false,
  530. // see https://revealjs.com/vertical-slides/#navigation-mode
  531. navigationMode: 'default',
  532. // Randomizes the order of slides each time the presentation loads
  533. shuffle: false,
  534. // Turns fragments on and off globally
  535. fragments: true,
  536. // Flags whether to include the current fragment in the URL,
  537. // so that reloading brings you to the same fragment position
  538. fragmentInURL: true,
  539. // Flags if the presentation is running in an embedded mode,
  540. // i.e. contained within a limited portion of the screen
  541. embedded: false,
  542. // Flags if we should show a help overlay when the questionmark
  543. // key is pressed
  544. help: true,
  545. // Flags if it should be possible to pause the presentation (blackout)
  546. pause: true,
  547. // Flags if speaker notes should be visible to all viewers
  548. showNotes: false,
  549. // Global override for autoplaying embedded media (null/true/false)
  550. autoPlayMedia: null,
  551. // Global override for preloading lazy-loaded iframes (null/true/false)
  552. preloadIframes: null,
  553. // Number of milliseconds between automatically proceeding to the
  554. // next slide, disabled when set to 0, this value can be overwritten
  555. // by using a data-autoslide attribute on your slides
  556. autoSlide: 0,
  557. // Stop auto-sliding after user input
  558. autoSlideStoppable: true,
  559. // Use this method for navigation when auto-sliding
  560. autoSlideMethod: null,
  561. // Specify the average time in seconds that you think you will spend
  562. // presenting each slide. This is used to show a pacing timer in the
  563. // speaker view
  564. defaultTiming: null,
  565. // Enable slide navigation via mouse wheel
  566. mouseWheel: false,
  567. // The display mode that will be used to show slides
  568. display: 'block',
  569. // Hide cursor if inactive
  570. hideInactiveCursor: true,
  571. // Time before the cursor is hidden (in ms)
  572. hideCursorTime: 5000,
  573. // Opens links in an iframe preview overlay
  574. previewLinks: false,
  575. // Transition style (none/fade/slide/convex/concave/zoom)
  576. transition: 'slide',
  577. // Transition speed (default/fast/slow)
  578. transitionSpeed: 'default',
  579. // Transition style for full page slide backgrounds
  580. // (none/fade/slide/convex/concave/zoom)
  581. backgroundTransition: 'fade',
  582. // Number of slides away from the current that are visible
  583. viewDistance: 3,
  584. // Number of slides away from the current that are visible on mobile
  585. // devices. It is advisable to set this to a lower number than
  586. // viewDistance in order to save resources.
  587. mobileViewDistance: 2,
  588. // reveal.js plugins
  589. plugins: [
  590. RevealNotes,
  591. RevealSearch,
  592. RevealZoom
  593. ]
  594. });
  595. </script>
  596. </body>
  597. </html>