square always exponentiation
play

Square Always Exponentiation Christophe Clavier 1 Benoit Feix 1 , 2 - PowerPoint PPT Presentation

Introduction Square Always Parallelization Conclusion Square Always Exponentiation Christophe Clavier 1 Benoit Feix 1 , 2 Georges Gagnerot 1 , 2 ene Roussellet 2 Vincent Verneuil 2 , 3 Myl` 1 XLIM-Universit e de Limoges, France 2 INSIDE


  1. Introduction Square Always Parallelization Conclusion Square Always Exponentiation Christophe Clavier 1 Benoit Feix 1 , 2 Georges Gagnerot 1 , 2 ene Roussellet 2 Vincent Verneuil 2 , 3 Myl` 1 XLIM-Universit´ e de Limoges, France 2 INSIDE Secure, Aix-en-Provence, France 3 Univ. Bordeaux, IMB, France Indocrypt 2011 - December 12, 2011 Vincent Verneuil - Square Always Exponentiation 1 / 38

  2. Introduction Square Always Parallelization Conclusion Outline Introduction 1 Motivation Recalls Contribution Square Always 2 Principle Algorithms 3 Parallelization Generalities Algorithms Conclusion 4 Vincent Verneuil - Square Always Exponentiation 2 / 38

  3. Introduction Square Always Parallelization Conclusion Outline Introduction 1 Motivation Recalls Contribution Square Always 2 Principle Algorithms 3 Parallelization Generalities Algorithms Conclusion 4 Vincent Verneuil - Square Always Exponentiation 2 / 38

  4. Introduction Square Always Parallelization Conclusion Motivation Outline Introduction 1 Motivation Recalls Contribution Square Always 2 Principle Algorithms 3 Parallelization Generalities Algorithms Conclusion 4 Vincent Verneuil - Square Always Exponentiation 2 / 38

  5. Introduction Square Always Parallelization Conclusion Motivation Motivation • Exponentiation is the core operation of RSA, DSA, Diffie-Hellman protocols. • Embedded in constrained devices (smart cards, etc.) with low resources. • Targeted by side-channel attacks in this sensitive context. Vincent Verneuil - Square Always Exponentiation 3 / 38

  6. Introduction Square Always Parallelization Conclusion Motivation Context Let consider the computation of m d mod n with d = ( d k − 1 d k − 2 ... d 0 ) 2 . M the cost of a modular multiplication. S the cost of a modular squaring. Two cases : fast squaring ( S / M = . 8) or not ( S / M = 1). Vincent Verneuil - Square Always Exponentiation 4 / 38

  7. Introduction Square Always Parallelization Conclusion Recalls Outline Introduction 1 Motivation Recalls Contribution Square Always 2 Principle Algorithms 3 Parallelization Generalities Algorithms Conclusion 4 Vincent Verneuil - Square Always Exponentiation 4 / 38

  8. Introduction Square Always Parallelization Conclusion Recalls Basic Exponentiation Square-and-Multiply Algorithms Left-to-right Right-to-left Vincent Verneuil - Square Always Exponentiation 5 / 38

  9. Introduction Square Always Parallelization Conclusion Recalls Basic Exponentiation Square-and-Multiply Algorithms Left-to-right Right-to-left � 2 � 2 � m d k − 1 � 2 ... � m d = m d k − 1 2 k − 1 × m d k − 2 2 k − 2 × ... × m d 0 m d = m d 0 × m d 1 × � ... Vincent Verneuil - Square Always Exponentiation 5 / 38

  10. Introduction Square Always Parallelization Conclusion Recalls Basic Exponentiation Square-and-Multiply Algorithms Left-to-right Right-to-left � 2 � 2 � m d k − 1 � 2 ... � m d = m d k − 1 2 k − 1 × m d k − 2 2 k − 2 × ... × m d 0 m d = m d 0 × m d 1 × � ... Input: m , n , d ∈ N Input: m , n , d ∈ N Output: m d mod n Output: m d mod n a ← 1 a ← 1 ; b ← m for i = k − 1 to 0 do for i = 0 to k − 1 do a ← a 2 mod n if d i = 1 then if d i = 1 then a ← a × b mod n b ← b 2 mod n a ← a × m mod n return a return a Vincent Verneuil - Square Always Exponentiation 5 / 38

  11. Introduction Square Always Parallelization Conclusion Recalls Side-Channel Threats When a computation involving a secret occurs on an embedded devices, side-channels (power, EM) may be spotted to search for leakages. Kocher introduced in 1999 the simple and differential side-channel analysis. Vincent Verneuil - Square Always Exponentiation 6 / 38

  12. Introduction Square Always Parallelization Conclusion Recalls Simple Side-Channel Analysis on Exponentiation (SPA) Side-channel leakage: power, EM, etc. The whole exponent may be recovered using a single curve. Vincent Verneuil - Square Always Exponentiation 7 / 38

  13. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Montgomery ladder Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Vincent Verneuil - Square Always Exponentiation 8 / 38

  14. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Montgomery ladder Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Square & multiply always: S, M, S, M,S, M,S, M,S, M, S, M. . . Vincent Verneuil - Square Always Exponentiation 8 / 38

  15. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Montgomery ladder Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Square & multiply always: S, M, S, M,S, M,S, M,S, M, S, M. . . Vincent Verneuil - Square Always Exponentiation 8 / 38

  16. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Montgomery ladder Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Square & multiply always: S, M, S, M,S, M,S, M,S, M, S, M. . . Montgomery ladder: S, M, S, M,S, M,S, M,S, M, S, M. . . Vincent Verneuil - Square Always Exponentiation 8 / 38

  17. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Montgomery ladder Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Square & multiply always: S, M, S, M,S, M,S, M,S, M, S, M. . . Montgomery ladder: S, M, S, M,S, M,S, M,S, M, S, M. . . Input: m , n , d ∈ N Output: m d mod n 1: R 0 ← 1 2: R 1 ← m 3: for i = k − 1 to 0 do R 1 − d i ← R 0 × R 1 mod n 4: 2 mod n R d i ← R d i 5: 6: return R 0 Vincent Verneuil - Square Always Exponentiation 8 / 38

  18. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Atomic Exponentiation “Multiply Always” Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Vincent Verneuil - Square Always Exponentiation 9 / 38

  19. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Atomic Exponentiation “Multiply Always” Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Multiply always: M,M, M,M,M, M,M, M,M,M. . . Vincent Verneuil - Square Always Exponentiation 9 / 38

  20. Introduction Square Always Parallelization Conclusion Recalls Regular Exponentiation Atomic Exponentiation “Multiply Always” Square & multiply: S, M, S, S, M, S, M, S, S, M. . . Multiply always: M,M, M,M,M, M,M, M,M,M. . . Input: m , n , d ∈ N Output: m d mod n 1: R 0 ← 1 2: R 1 ← m 3: i ← k − 1 4: t ← 0 5: while i ≥ 0 do R 0 ← R 0 × R t mod n 6: t ← t ⊕ d i [ ⊕ is bitwise XOR] 7: i ← i − 1 + t 8: 9: return R 0 Vincent Verneuil - Square Always Exponentiation 9 / 38

  21. Introduction Square Always Parallelization Conclusion Recalls Squaring-Multiplication Discrimination Attack In [ Distinguishing Multiplications from Squaring Operations , SAC 2008], Amiel et al. observed that E x , y ( HW ( x × y )) has a different value whether: • x = y uniformly distributed in [ 0 , 2 k − 1 ] , • x and y independent and uniformly distributed in [ 0 , 2 k − 1 ] . Vincent Verneuil - Square Always Exponentiation 10 / 38

  22. Introduction Square Always Parallelization Conclusion Recalls Squaring-Multiplication Discrimination Attack Attack: subtract two (averaged) power traces of consecutive atomic multiplications. Countermeasure: exponent blinding d ∗ ← d + r ψ ( n ) . Vincent Verneuil - Square Always Exponentiation 11 / 38

  23. Introduction Square Always Parallelization Conclusion Recalls Cost Summary Algorithm Cost / bit S / M = 1 S / M = . 8 # reg Square & multiply 1 , 2 , 3 . 5 M + 1 S 1 . 5 M 1 . 3 M 2 Multiply always 2 , 3 1 . 5 M 1 . 5 M 1 . 5 M 2 Montgomery ladder 1 M + 1 S 2 M 1 . 8 M 2 1 algorithm unprotected towards the SPA 2 algorithm sensitive to S – M discrimination 3 possible sliding window optimization Vincent Verneuil - Square Always Exponentiation 12 / 38

  24. Introduction Square Always Parallelization Conclusion Contribution Outline Introduction 1 Motivation Recalls Contribution Square Always 2 Principle Algorithms 3 Parallelization Generalities Algorithms Conclusion 4 Vincent Verneuil - Square Always Exponentiation 12 / 38

  25. Introduction Square Always Parallelization Conclusion Contribution Our Contribution • Atomic exponentiation algorithms immune to the S – M discrimination • Better efficiency than ladder algorithms • Study of algorithms for parallelized (co)processors and space/time trade-offs Vincent Verneuil - Square Always Exponentiation 13 / 38

  26. Introduction Square Always Parallelization Conclusion Outline Introduction 1 Motivation Recalls Contribution Square Always 2 Principle Algorithms 3 Parallelization Generalities Algorithms Conclusion 4 Vincent Verneuil - Square Always Exponentiation 13 / 38

  27. Introduction Square Always Parallelization Conclusion Principle Outline Introduction 1 Motivation Recalls Contribution Square Always 2 Principle Algorithms 3 Parallelization Generalities Algorithms Conclusion 4 Vincent Verneuil - Square Always Exponentiation 13 / 38

  28. Introduction Square Always Parallelization Conclusion Principle Replacing Multiplications by Squarings x × y = ( x + y ) 2 − x 2 − y 2 (1) 2 � 2 � 2 � x + y � x − y x × y = (2) − 2 2 Vincent Verneuil - Square Always Exponentiation 14 / 38

Recommend


More recommend