PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/general.hpp

https://github.com/exp04shy/oklibrary
C++ Header | 271 lines | 0 code | 1 blank | 270 comment | 0 complexity | f6ff16b8f13efdd51a16ec3d35012468 MD5 | raw file
  1. // Matthew Gwynne, 2.1.2011 (Swansea)
  2. /* Copyright 2011 Oliver Kullmann
  3. This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
  4. it and/or modify it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation and included in this library; either version 3 of the
  6. License, or any later version. */
  7. /*!
  8. \file Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/general.hpp
  9. \brief Investigations into representations for components of the AES related to the SAT 2011 paper
  10. \todo Connections
  11. <ul>
  12. <li> See
  13. ComputerAlgebra/Satisfiability/Lisp/LinearConditions/plans/general.hpp for
  14. the handling of linear constraints in general. </li>
  15. </ul>
  16. \todo Considering output bits on their own
  17. <ul>
  18. <li> For better comparison with the DES-paper (see
  19. Cryptography/AdvancedEncryptionStandard/plans/general.hpp), we also need
  20. to consider the treatment of the boxes as 8 boolean functions (one for each
  21. output bit). </li>
  22. <li> In this way at least encryption by just UCP is ensured. </li>
  23. <li> We need to compare it with our standard approach, considering the
  24. whole boolean function. </li>
  25. <li> This needs to be done for all approaches (minimum, canonical, and
  26. bases). </li>
  27. </ul>
  28. \todo Overview
  29. <ul>
  30. <li> One needs to systematically explore CNF representations, with and
  31. without new variables. </li>
  32. <li> We consider methods for computing the following representations
  33. for the AES boxes:
  34. <ul>
  35. <li> the prime implicates.
  36. <li> minimum CNF representations. </li>
  37. <li> small (minimal) CNF representations
  38. (in cases where minimum representations are infeasible). </li>
  39. </ul>
  40. These are described in
  41. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Methods.hpp .
  42. </li>
  43. <li> There are currently open investigations in the following files:
  44. <ul>
  45. <li> 8-bit Sbox:
  46. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Sbox_8.hpp </li>
  47. <li> 8-bit Multiplication by 3:
  48. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Mul_3_8.hpp </li>
  49. <li> 8-bit Multiplication by 9:
  50. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Mul_9_8.hpp </li>
  51. <li> 8-bit Multiplication by 11:
  52. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Mul_11_8.hpp </li>
  53. <li> 8-bit Multiplication by 13:
  54. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Mul_13_8.hpp </li>
  55. <li> 8-bit Multiplication by 14:
  56. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Mul_14_8.hpp </li>
  57. </ul>
  58. </li>
  59. <li> For R-based representations see "R-based representations". </li>
  60. </ul>
  61. \todo Combining linear components
  62. <ul>
  63. <li> A full description of all of the possibilities for recombining
  64. AES and small scale linear components (from the Sbox and MixColumns)
  65. needs to be provided. </li>
  66. <li> The idea here is that, due to the linearity of the Sbox's affine
  67. transformation, and the MixColumns operations, as well as the
  68. fact the Shiftrows simply permutes bytes, the linear aspects of the Sbox
  69. can be moved out, and seperated (in the case of the affine addition),
  70. or merged into the boxes for the MixColumn. </li>
  71. <li> For the Sbox, we have 3 possibilities:
  72. <ul>
  73. <li> Full Sbox (M . s^(-1) + A) . </li>
  74. <li> Sbox minus addition of the affine constant (M . s^(-1)). </li>
  75. <li> Sbox minus affine transform entirely (s^(-1)). </li>
  76. </ul>
  77. </li>
  78. <li> For the MixColumn multiplications, we have 2 possibilities:
  79. <ul>
  80. <li> Standard byte-field multiplications. </li>
  81. <li> Sbox linear component (M) and Standard byte-field multiplications
  82. together. </li>
  83. </ul>
  84. </li>
  85. <li> A description of how to generate such translation is needed. </li>
  86. <li> See also "Rearranging linear components of Sbox and MixColumns" in
  87. ComputerAlgebra/Cryptology/Lisp/Cryptanalysis/Rijndael/plans/Translations.hpp.
  88. </li>
  89. </ul>
  90. \todo Scripts for generating statistics on random boxes
  91. <ul>
  92. <li> We currently wish to investigate various types of random
  93. boxes to see how they compare with the standard AES components. </li>
  94. <li> Therefore, we need scripts to generate and almalgamate this data.
  95. </li>
  96. <li> We can generate the various random boxes using:
  97. <ul>
  98. <li> Random boolean function - random_full_fcs in
  99. ComputerAlgebra/Satisfiability/Lisp/Generators/RandomClauseSets.mac .
  100. </li>
  101. <li> Random linear maps - ss_sbox_linmap_gen_cnfp in
  102. ComputerAlgebra/Cryptology/Lisp/Cryptanalysis/Rijndael/SboxAnalysis.mac .
  103. </li>
  104. <li> Random permutations - random_permutation and perm2cnffcs in
  105. ComputerAlgebra/Satisfiability/Lisp/FiniteFunctions/Permutations.mac .
  106. </li>
  107. </ul>
  108. </li>
  109. <li> We also need scripts to investigate the small scale multiplications,
  110. as well as the multiplications combined with the Sbox linear map (see
  111. ComputerAlgebra/Cryptology/Lisp/Cryptanalysis/Rijndael/FieldOperationsAnalysis.mac).
  112. </li>
  113. </ul>
  114. \todo Find "best" solver(s) and local search algorithms for minimisation
  115. <ul>
  116. <li> There are currently a considerable number of problems in our
  117. investigation which require the solving of minimisation problems
  118. and finding transversals of subsumption hypergraphs when looking for
  119. minimum CNF representations
  120. (see
  121. Experimentation/Investigations/Cryptography/AdvancedEncryptionStandard/plans/SAT2011/Representations/Methods.hpp)
  122. </li>
  123. <li> We need a survey of the various solvers and local search algorithms
  124. that we can use with these problems, along with their performance on
  125. small instances, so that we can apply the best methods we have given
  126. limited resources. </li>
  127. </ul>
  128. \todo Standard naming scheme for experiment files
  129. <ul>
  130. <li> We need to think of a naming scheme for the AES boxes so
  131. we can create the hpp files discussing them in this directory. </li>
  132. <li> We have the following boxes to investigate:
  133. <ul>
  134. <li> Sboxes with the following variants and parameters:
  135. <ul>
  136. <li> Sboxes with exponent / number of bits ranging from 1-8. </li>
  137. <li> Sboxes without and without the affine constant addition
  138. and linear multiplication (see "Combining linear components"). </li>
  139. <li> random permutations for the Sbox. </li>
  140. <li> random linear maps inside and outside the Sbox. </li>
  141. </ul>
  142. At the simplest level we vary the exponent (as in the
  143. [Small Scale Variants of the AES; Cid, Murphy, Robshaw]) and
  144. keep the rest as defaults.
  145. </li>
  146. <li> Multiplication within the field with following variants:
  147. <ul>
  148. <li> the field element to multiply by. </li>
  149. <li> the exponent / number of bits ranging from 1-8. </li>
  150. <li> multiplications with and without the combination of
  151. the Sbox linear map (see "Combining linear components").
  152. </ul>
  153. </li>
  154. </ul>
  155. </li>
  156. <li> For now, we name:
  157. <ul>
  158. <li> the small scale Sboxes: Sbox_${e}.cnf , where ${e} is
  159. the field of the Sbox is a GF(2^e) finite field. </li>
  160. <li> the small scale multiplications by element "a", in the
  161. default field with exponent e: Mul_${a}_${e}.cnf . </li>
  162. </ul>
  163. </ul>
  164. \todo R-based representations
  165. <ul>
  166. <li> r-bases for r in {r_1,r_2}? (see rand_rbase_cs(F,r) in
  167. ComputerAlgebra/Satisfiability/Lisp/Reductions/RBases.mac.) </li>
  168. <li> One could consider certain prime implicates more important than others;
  169. for example ensuring that at least given a full input and/or a full output
  170. to one permutation the output resp. input can be inferred.
  171. <ol>
  172. <li> Can one formulate (relatively efficiently) the minimisation target
  173. that these inferences are "easily" available while otherwise using the
  174. smallest representation? </li>
  175. <li> We could generalise the notion of r-base w.r.t. specific clauses
  176. which have to be deducible via r, while all (other) removed clauses just
  177. need to follow logically, or perhaps using some stronger reduction. </li>
  178. </ol>
  179. </li>
  180. <li> When investigations begin fully in this area, this todo should be
  181. moved to a new file, and most likely a new sub-module. </li>
  182. </ul>
  183. \todo The square of the Sbox
  184. <ul>
  185. <li> As a start into the consideration of mergers within the AES-"circuit"
  186. we consider the square of the sbox. </li>
  187. <li> As a Maxima boolean-function this is obtained by
  188. \verbatim
  189. s2 : square_bf(rijn_sbox_bf);
  190. \endverbatim
  191. </li>
  192. <li> The full CNF representation is then obtained by
  193. \verbatim
  194. F2 : bf2relation_fullcnf_fcs(s2,8)$
  195. \endverbatim
  196. </li>
  197. <li> A DIMACS file is created via
  198. \verbatim
  199. output_fcs(
  200. sconcat("The squared AES Sbox in full CNF representation."),
  201. F2,
  202. "AES_Sbox2_full.cnf")$
  203. \verbatim
  204. </li>
  205. <li> Prime clauses:
  206. \verbatim
  207. > QuineMcCluskey-n16-O3-DNDEBUG AES_Sbox2_full.cnf > AES_PK2.cnf
  208. > cat AES_PK2.cnf | ExtendedDimacsFullStatistics-O3-DNDEBUG
  209. n non_taut_c red_l taut_c orig_l comment_count finished_bool
  210. 16 137185 1007214 0 1007214 1 1
  211. length count
  212. 5 5
  213. 6 3898
  214. 7 83267
  215. 8 49203
  216. 9 812
  217. \endverbatim
  218. </li>
  219. <li> This doesn't look much different from the Sbox itself; one needs to
  220. consider further properties. </li>
  221. </ul>
  222. \todo Understanding prime implicates after any partial assignment
  223. <ul>
  224. <li> To consider the AES boxes as an "active clause", we want to first be
  225. able, given a partial assignment, to infer as many forced assignments
  226. as possible. This can be done simply with the DNF representation. </li>
  227. <li> However, secondly one needs, given a partial assignment, to be able to
  228. determine various measures for heuristics. </li>
  229. <li> Therefore, investigating several statistics (most notably the number of
  230. clauses for a given variable) of the prime implicates of the clause-set,
  231. formed after taking the Sbox and applying each partial assignment, is
  232. necessary to try and discern a pattern. </li>
  233. <li> If such patterns can be deduced for particular clause-set measures,
  234. then the active clause can use this pattern, given a partial assignment,
  235. to return reasonable values for these measures which can be used for
  236. statistics. </li>
  237. <li> A C++ implementation of such a system whereby the set of prime
  238. implicates is taken as input, and each partial assignment along with
  239. the relevant statistics is returned is necessary. </li>
  240. <li> Such a C++ implementation would need to be able to apply a partial
  241. assignment to a clause-set and then compute various statistics on the
  242. result. This would need to be done for every partial assignment. </li>
  243. <li> After applying the partial assignment, to gain the prime implicates
  244. of the new boolean function, one must simply apply subsumption elimination
  245. to the new clause-set (which is just result of applying a partial assignment
  246. to the prime implicates of the original function). This can be done using
  247. functionality already in the library (MG: Where?). </li>
  248. </ul>
  249. */