2 1
play

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