2 1

2 1 Joppe W. Bos and Simon Friedberger Why these strange primes? - PowerPoint PPT Presentation

Fast Arithmetic Modulo 2 1 Joppe W. Bos and Simon Friedberger Why these strange primes? 2 Quantum computers NIST call for PQC standards [1] [2] Post-Quantum Cryptography 3 Lattice-based Code-based MQ-based


  1. Fast Arithmetic Modulo 2 𝑦 π‘ž 𝑧 Β± 1 Joppe W. Bos and Simon Friedberger

  2. Why these strange primes? 2 ο‚΄ Quantum computers ο‚΄ NIST call for PQC standards [1] [2]

  3. Post-Quantum Cryptography 3 ο‚΄ Lattice-based ο‚΄ Code-based ο‚΄ MQ-based ο‚΄ Hash-based ο‚΄ Isogeny-based ο‚΄ Little data (330 B / 10 x smaller) ο‚΄ Very slow (1000 x slower) ο‚΄ Requires more cryptanalysis (published 2011) ο‚΄ …but it has elliptic curves!

  4. ECC vs SIDH 4 ECC π‘œ 𝑄 = 𝑅 SIDH 𝐹 2 = Ξ¦ π‘œ ∘ β‹― ∘ Ξ¦ 1 (𝐹 1 ) [3] [3]

  5. Key exchange 5 [3]

  6. Fast Arithmethic modulo 2 𝑦 π‘ž 𝑧 Β± 1 6 #E(𝔾 q 2 ) = 2 𝑦 π‘ž 𝑧 2 q = 2 x p y Β± 1

  7. Fast Arithmethic modulo 2 𝑦 π‘ž 𝑧 Β± 1 6 #E(𝔾 q 2 ) = 2 𝑦 π‘ž 𝑧 2 q = 2 x p y Β± 1

  8. Compared approaches 7 ο‚΄ Montgomery reduction ο‚΄ Barrett division ο‚΄ Modular simplification ο‚΄ Shifting ο‚΄ Special radix ο‚΄ …

  9. Montgomery reduction 8 ο‚΄ Calculate 𝑏෨ Ξ€ ΰ·€ 𝑐 𝑆 = 𝑏𝑐𝑆 𝑛𝑝𝑒 𝑛 ο‚΄ Montgomery multiplication 𝑑𝑆 βˆ’1 = 𝑑 + πœˆπ‘π‘ 𝑛𝑝𝑒 𝑆 𝑛 /𝑆 (𝑛𝑝𝑒 𝑛) ο‚΄ Prime shape optimizations: ο‚΄ 𝜈 = βˆ’π‘› βˆ’1 ≑ 1 for 𝑛 ≑ Β±1 ο‚΄ 𝑦𝑛 = 𝑦 2 𝑦 π‘ž 𝑧 Β± 1 = π‘¦π‘ž 𝑧 2 𝑦 Β± 𝑦 ο‚΄ Costs π‘œ 2 + π‘œ optimized to π‘œ 2 2 M

  10. Montgomery reduction 9 ο‚΄ Calculate 𝑏෨ Ξ€ ΰ·€ 𝑐 𝑆 = 𝑏𝑐𝑆 𝑛𝑝𝑒 𝑛 ο‚΄ Montgomery multiplication 𝑑𝑆 βˆ’1 = 𝑑 + πœˆπ‘π‘ 𝑛𝑝𝑒 𝑆 𝑛 /𝑆 (𝑛𝑝𝑒 𝑛) ο‚΄ Prime shape optimizations: ο‚΄ 𝜈 = βˆ’π‘› βˆ’1 ≑ 1 for 𝑛 ≑ Β±1 ο‚΄ 𝑦𝑛 = 𝑦 2 𝑦 π‘ž 𝑧 Β± 1 = π‘¦π‘ž 𝑧 2 𝑦 Β± 𝑦 ο‚΄ Costs π‘œ 2 + π‘œ optimized to π‘œ 2 2 M

  11. Montgomery reduction 10 ο‚΄ Calculate 𝑏෨ Ξ€ ΰ·€ 𝑐 𝑆 = 𝑏𝑐𝑆 𝑛𝑝𝑒 𝑛 ο‚΄ Montgomery multiplication 𝑑𝑆 βˆ’1 = 𝑑 + πœˆπ‘π‘ 𝑛𝑝𝑒 𝑆 𝑛 /𝑆 (𝑛𝑝𝑒 𝑛) ο‚΄ Prime shape optimizations: ο‚΄ 𝜈 = βˆ’π‘› βˆ’1 ≑ 1 for 𝑛 ≑ Β±1 ο‚΄ 𝑦𝑛 = 𝑦 2 𝑦 π‘ž 𝑧 Β± 1 = π‘¦π‘ž 𝑧 2 𝑦 Β± 𝑦 ο‚΄ Costs π‘œ 2 + π‘œ optimized to π‘œ 2 2 M

  12. Barrett division 11 ο‚΄ Calculate 𝑑 𝑛𝑝𝑒 𝑛 as 𝑑 βˆ’ 𝑑/𝑛 𝑛 𝑛 as 𝑑 𝑑 𝑆 ο‚΄ Approximate 𝑆 𝑛 ο‚΄ Error of at most 𝑛 , or at most 3𝑛 after some more optimizations ο‚΄ Also gives the fraction not just the remainder ο‚΄ Costs π‘œ 2 + 4π‘œ + 1 optimized to 5 8 π‘œ 2 + 13 4 π‘œ + 1 𝑁

  13. Barrett division 12 ο‚΄ Calculate 𝑑 𝑛𝑝𝑒 𝑛 as 𝑑 βˆ’ 𝑑/𝑛 𝑛 𝑛 as 𝑑 𝑑 𝑆 ο‚΄ Approximate 𝑆 𝑛 ο‚΄ Error of at most 𝑛 , or at most 3𝑛 after some more optimizations ο‚΄ Also gives the fraction not just the remainder ο‚΄ Costs π‘œ 2 + 4π‘œ + 1 optimized to 5 8 π‘œ 2 + 13 4 π‘œ + 1 𝑁

  14. Simplified Modulus 13 ο‚΄ Pick 𝑆 = 𝑛 + 1 = 2 𝑦 π‘ž 𝑧 ο‚΄ 𝑑 = 𝑑 1 𝑆 + 𝑑 0 = 𝑑 1 𝑛 + 𝑑 1 + 𝑑 0 ≑ 𝑑 1 + 𝑑 0 ο‚΄ Need to divide 𝑑 𝑆 and suppose 𝑆 = 2 𝑦 𝑆′ ο‚΄ Idea: Use Barrett division with special modulus β€² and 𝑑 1 β€² 2 𝑦 + 𝑑 0 β€² = 𝑣𝑆′ + 𝑀 it follows that ο‚΄ If 𝑑 = 𝑑 1 ο‚΄ 𝑑 = 𝑣2 𝑦 𝑆′ + 𝑀2 𝑦 + 𝑑 0 β€² ο‚΄ It follows that 𝑀2 𝑦 + 𝑑 0 β€² = 𝑑 0 and 𝑣 = 𝑑 1 3 1 5 8 π‘œ 2 + 13 ο‚΄ Cost ℬ 2 π‘œ, 2 π‘œ = 4 π‘œ + 1 𝑁

  15. Folding 14 ο‚΄ Save time on the reduction by computing a multiplication first ο‚΄ With precomputed 𝜈 = 𝑆 𝑛𝑝𝑒 𝑛 ο‚΄ Transform 𝑑 = 𝑑 1 𝑆 + 𝑑 0 it is clear that 𝑑 ≑ 𝑑 1 𝜈 + 𝑑 0 𝑛𝑝𝑒 𝑛 ο‚΄ Picking 𝑆 appropriately will reduce the size of the number to reduce ο‚΄ Costs: For 𝑆 1.5 times as long as 𝑛 we get ο‚΄ 𝑑 is reduced in length by 25 % ο‚΄ Cost π‘œ 2 2 𝑁 ο‚΄ Folding + Barrett Cost π‘œ 2 2 + 5 4 π‘œ + 1 𝑁

  16. Interleaved vs Non-interleaved 15 ο‚΄ Interleave multiplication and reduction ο‚΄ Uses less memory ο‚΄ Multiply and reduce separately ο‚΄ Allows asymptotically fast multiplication algorithms ο‚΄ SIDH: Arithmetic in 𝔾 q 2 ο‚΄ (𝑏 + 𝑗𝑐)(𝑑 + 𝑗𝑒) ο‚΄ Interleaved: 4 M&R, Non-interleaved: 4 M + 2 R ο‚΄ Using Karatsuba: 3 M&R vs 3 M + 2 R ο‚΄ Non-interleaved is to be preferred for SIDH

  17. Modulus based Radix 16 ο‚΄ Recent approach from WAIFI ο‚΄ Pick 𝑆 = 𝑛 and representation 𝑏 = 𝑏 1 𝑆 + 𝑏 0 this gives ο‚΄ 𝑏𝑐 = 𝑏 1 𝑐 1 𝑆 2 + (𝑏 1 𝑐 0 + 𝑏 0 𝑐 1 )𝑆 + 𝑏 0 𝑐 0 = 𝑏 1 𝑐 0 + 𝑏 0 𝑐 1 𝑆 + 𝑏 1 𝑐 1 + 𝑏 0 𝑐 0 ο‚΄ Reduce both parts again using Barrett division ο‚΄ Costs: 17 16 π‘œ 2 + 13 4 π‘œ + 2 𝑁 ο‚΄ Unfortunately interleaved

  18. Results (interleaved) 17 (Costs for multiplication and reduction)

  19. Results (non-interleaved) 18 (Costs for reduction only)

  20. Shifting 19 ο‚΄ 2 372 3 239 βˆ’ 1 ο‚΄ 2 372 3 239 has 372 zero bits ο‚΄ 5 words of 64 bit and another 52 bits ο‚΄ 3 239 fits into 6 words but it actually uses 7 now ο‚΄ We can properly align the powers of three ο‚΄ Costs: several shifts by 52 bits

  21. SIDH friendly primes 20 ο‚΄ Conditions for our search 1. π‘ž ∈ 3,5,7,11,13,17,19 2. 384 ≀ 𝑦 < 450 and 2 300 < π‘ž 𝑧 < 2 450 3. 2 740 < 2 𝑦 π‘ž 𝑧 Β± 1 < 2 768 4. 2 𝑦 βˆ’ π‘ž 𝑧 < 2 40 5. 2 𝑦 π‘ž 𝑧 + 1 or 2 𝑦 π‘ž 𝑧 βˆ’ 1 is prime

  22. New prime suggestions 21 Prime Security πŸ‘ πŸ’πŸ—πŸ” πŸ’ πŸ‘πŸ‘πŸ– βˆ’ 𝟐 120 2 394 5 154 + 1 119 2 394 5 155 βˆ’ 1 120 2 396 7 131 + 1 123 2 393 17 91 + 1 124 πŸ‘ πŸ’πŸ˜πŸ 𝟐𝟘 πŸ—πŸ— βˆ’ 𝟐 125

  23. Benchmarking results 22

  24. Questions? 23 https://github.com/sidh-arith/

  25. References 24 1. https://www.technologyreview.com/s/602283/googles-quantum-dream- may-be-just-around-the-corner/ 2. https://bits.blogs.nytimes.com/2013/05/16/google-buys-a-quantum- computer/?_r=0 3. https://www.esat.kuleuven.be/cosic/elliptic-curves-are-quantum-dead- long-live-elliptic-curves/

Recommend


More recommend