formal methods in differential and linear trail search
play

Formal Methods in Differential and Linear Trail Search Beno t - PowerPoint PPT Presentation

Formal Methods in Differential and Linear Trail Search Beno t Viguier October 7, 2016 1 Overview Introduction Keccak Differential Cryptanalysis Semantics of Trees and Iterators Proven Iterator Conclusion 2 Introduction Hashing vs


  1. Formal Methods in Differential and Linear Trail Search Benoˆ ıt Viguier October 7, 2016 1

  2. Overview Introduction Keccak Differential Cryptanalysis Semantics of Trees and Iterators Proven Iterator Conclusion 2

  3. Introduction

  4. Hashing vs Encryption Hashing Hash Plaintext Ciphertext Encryption 3

  5. Second pre-image attack Hashing I will pay 5 $ . 0xAB8924 = I will pay 5000 $ . 0xAB8924 Collision attack 4

  6. Keccak

  7. Sponge construction Sponge construction + invertible permutation f named Keccak - f [ b ] . m 0 m 1 m 2 m 3 z 0 z 1 z 2 r bits f f f f f f c bits Absorbing phase Squeezing phase Figure 1: A sponge construction bit rate ( r ) + capacity ( c ) = width ( b ) Keccak - f [ 1600 ]= ( ι ◦ χ ◦ π ◦ ρ ◦ θ ) 24 and b = 1600 5

  8. State Row Lane y Column z Slice x Figure 2: Keccak[200] state 6

  9. Keccak- f : θ Linear mixing layer on column parity. θ ( a ) a θ p [ x , z ] : � 4 � y = 0 a [ x , y , z ] E ( x , z ) = P [ x − 1 , z ] ⊕ P [ x + 1 , z − 1 ] parity plane P θ -effect Figure 3: Application of θ to a state. P is called the parity plane. 7

  10. Keccak- f : ρ and π Bit-wise cyclic shift rotation on lanes. Figure 4: The ρ transformation Lane transposition. Figure 5: The π transposition 8

  11. Keccak- f : χ Non-linear mapping f algebraic degree of 2 which operates on rows. not and xor Figure 6: The χ transformation 9

  12. Differential Cryptanalysis

  13. Differentials t ′ t 1 � = ∆ 1 1 f f t ′ t 2 � = ∆ 2 2 f Figure 7: A differential (∆ 1 = ⇒ ∆ 2 ) Given an input difference ∆ 1 , chances are that a difference ∆ 2 will occur. It can be associated with a probability: P [(∆ 1 ⇒ ∆ 2 )] . 10

  14. Trails t ′ t 0 � = ∆ 0 0 f f t ′ t 1 � = ∆ 1 1 f f t ′ t 2 � = ∆ 2 2 f f Figure 8: A trail (∆ 0 = ⇒ ∆ 1 = ⇒ ∆ 2 ) f f Goal: Find a trail (∆ 0 = ⇒ · · · = ⇒ ∆ n ) such as ∆ n = 0 ( ⇔ collision). 11

  15. There are 2 1600 − 1 input differences possible for Keccak- f [ 1600 ] . Estimated number of hydrogen atoms in the Universe: ≈ 2 265 11

  16. Tree decomposition Resulting states Resulting states Add Orbitals Add Orbitals Iterate on Orbitals Add and Iterate Orbitals Column Assignment Add Run Iterate on Columns (Odd, Affected) Column Assignment Column Assignment Iterate on Run Add Run Add empty Run (Parity Kernel) Figure 9: Tree decomposition of the search. 12

  17. From Code to Proofs What are the verifications needed? • orbitals (involution, order) • colunms assignement (order) • runs (order, z-canonicity factorization) • and more. . . What are the difficulties? • C++ ⇒ no VST, no FRAMA-C, no Why3. • Huge source code! What have been done during this Internship? • Using Hoare Logic. • Orbitals: involution and order The time I would have spent on more proofs would not have been compensated by the gain of the correction. 13

  18. Tree decomposition Resulting states Resulting states Add Orbitals Add Orbitals Iterate on Orbitals Add and Iterate Orbitals Column Assignment Add Run Iterate on Columns (Odd, Affected) Column Assignment Column Assignment Iterate on Run Add Run Add empty Run (Parity Kernel) Figure 10: Tree decomposition of the search.

  19. Tree decomposition Resulting states Resulting states Add Orbitals Add Orbitals Iterate on Orbitals Add and Iterate Orbitals Column Assignment Add Run Iterate on Columns (Odd, Affected) Column Assignment Column Assignment Iterate on Run Add Run Add empty Run (Parity Kernel) Figure 10: Tree decomposition of the search.

  20. Tree decomposition Resulting states Resulting states Add Orbitals Add Orbitals Iterate on Orbitals Add and Iterate Orbitals Column Assignment Add Run Iterate on Columns (Odd, Affected) Column Assignment Column Assignment Iterate on Run Add Run Add empty Run (Parity Kernel) Figure 10: Tree decomposition of the search. 14

  21. Semantics of Trees and Iterators

  22. Tree traversal: Tree definition Section trees. Variable (X : Type). (* we do not want the too weak Coq generated induction principles *) root Unset Elimination Schemes. Inductive Tree : Type := node : X → list Tree → Tree. Set Elimination Schemes. N 1 Section Tree_ind. Variable P : Tree → Prop. Hypothesis HP : ∀ a ll, ( ∀ x, In x ll → P x) → P (node a ll). N 3 N 2 Definition Tree_ind : ∀ t, P t. End Tree_ind. End trees. Figure 11: Tree Code 1: Tree definition Induction principle : 1. prove the property for a tree with no children. 2. Assume that the property is True for all children, prove it for the parent. 15

  23. Tree traversal: Path definition Definition Path := list nat. Definition getNode (p:Path) (t:Tree X) : option (Tree X) := ... Code 2: Path definition Each node from the tree can be accessed by a root path specified as the list of the index of the child to consider. returns root . [ ] • returns N 1 . [0] • N 1 returns N 2 . [0,0] • returns N 3 . [1,0] • N 3 N 2 getNode ( p ) returns Some ( n , l ) if a node n with childrens l exists or None . Figure 12: Tree 16

  24. Tree traversal: Moves 9. VISITED root 8. TO_PARENT 1. TO_CHILD 7. VISITED N 1 2. TO_CHILD 6. TO_PARENT N 3 N 2 5. VISITED 3. VISITED 4. TO_SIBLING Figure 13: Iteration through a tree Inductive MoveSS : Type := TO_PARENT | TO_CHILD | TO_SIBLING | VISITED. Code 3: Definition of the movements 17

  25. Tree traversal: Rules We can use Small-step semantics to specify rules over moves. it : ( move , path , visited nodes ) → ( move ′ , path ′ , visited nodes ′ ) Inductive iterator_smallstep_v X : Tree X → MoveSS ∗ Path ∗ ( Visited X ) → MoveSS ∗ Path ∗ ( Visited X ) → Prop := ... ( visit up) ( TO PARENT , p , v ) → ( VISITED , p , v ) m � = TO PARENT m � = VISITED getNode ( p ) �→ Some ( n , [ ]) ( visit no sons) ( m , p , v ) → ( VISITED , p , n :: v ) m � = TO PARENT m � = VISITED getNode ( p ) �→ Some ( n , l ) l � = [ ] ( down) ( m , p , v ) → ( TO CHILD , 0 :: p , n :: v ) getNode ( h :: p ) �→ Some ( n , l ) getNode ( h + 1 :: p ) �→ None ( up) ( VISITED , h :: p , v ) → ( TO PARENT , p , v ) getNode ( h + 1 :: p ) �→ Some ( n , l ) ( next) ( VISITED , h :: p , v ) → ( TO SIBLING , h + 1 :: p , v ) 18

  26. Tree traversal: Rules 1. visit up If we just went back to the parent, the next move is VISITED . 9. visit_up root 2. visit no sons If the node does not have children, 8. up the next move is VISITED . 1. down 7. visit_up 3. down If the node has a child N 1 6. up 2. down (and the node is not VISITED ), the next move is TO_CHILD . 4. up N 3 N 2 If the node is VISITED and has no siblings, 4. the next move is TO_PARENT 5. next 3. visit_no_sons visit_no_sons 5. next Figure 14: Iteration rules applied to tree traversal If the node is VISITED and has siblings, the next move is TO_SIBLING 19

  27. Tree traversal: Theorems Iterator is deterministic : ∀ move path visited , ( ∀ move 1 path 1 visited 1 , it : ( move , path , visited ) → ( move 1 , path 1 , visited 1 ) ∧ ∀ move 2 path 2 visited 2 , it : ( move , path , visited ) → ( move 2 , path 2 , visited 2 ) ) ⇒ move 1 = move 2 ∧ path 1 = path 2 ∧ visited 1 = visited 2 Iterator’s traversal is complete : it : ( TO CHILD , [ ] , [ ]) → ∗ ( VISITED , [ ] , visited ) where visited is the list of the values of all the nodes 20

  28. Tree pruning Resulting states Resulting states Add Orbitals Add Orbitals Iterate on Orbitals Add and Iterate Orbitals Column Assignment Add Run Iterate on Columns (Odd, Affected) Column Assignment Column Assignment Iterate on Run Add Run Add empty Run (Parity Kernel) Figure 15: Tree pruning.

  29. Tree pruning Resulting states Resulting states Add Orbitals Add Orbitals Iterate on Orbitals Add and Iterate Orbitals Column Assignment Add Run Iterate on Columns (Odd, Affected) Column Assignment Column Assignment Iterate on Run Add Run Add empty Run (Parity Kernel) Figure 15: Tree pruning. 21

  30. Tree traversal: Rules Augmented The iterator should also cut branches of the tree when some conditions are met (simulated by the evaluation of a function B : node → Bool ) ( visit up) ( TO PARENT , p , v ) → ( VISITED , p , v ) m � = TO PARENT m � = VISITED getNode p �→ Some ( n , [ ]) B n = True ( visit no sons true) ( m , p , v ) → ( VISITED , p , n :: v ) m � = TO PARENT m � = VISITED getNode p �→ Some ( n , l ) l � = [ ] B n = True ( down) ( m , p , v ) → ( TO CHILD , 0 :: p , n :: v ) m � = VISITED getNode p �→ Some ( n , l ) B n = False ( down forbiden) ( m , p , v ) → ( VISITED , p , v ) getNode ( h :: p ) �→ Some ( n , l ) getNode ( h + 1 :: p ) �→ None ( up) ( VISITED , h :: p , v ) → ( TO PARENT , p , v ) getNode ( h + 1 :: p ) �→ Some ( n , l ) ( next) ( VISITED , h :: p , v ) → ( TO SIBLING , h + 1 :: p , v ) 22

  31. Proven Iterator

  32. Toward an Iterator The iterator ( manager ) should provide the next move with the minimum of required information. • Path • is the last move toward the parent ? • move VISITED will be skipped. 23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend