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

โ–ถ
2 1
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Fast Arithmetic Modulo 2๐‘ฆ๐‘ž๐‘ง ยฑ 1

Joppe W. Bos and Simon Friedberger

slide-2
SLIDE 2

Why these strange primes?

๏‚ด Quantum computers ๏‚ด NIST call for PQC standards [1] [2]

2

slide-3
SLIDE 3

Post-Quantum Cryptography

๏‚ด 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!

3

slide-4
SLIDE 4

ECC vs SIDH

ECC ๐‘œ ๐‘„ = ๐‘… SIDH ๐น2 = ฮฆ๐‘œ โˆ˜ โ‹ฏ โˆ˜ ฮฆ1(๐น1)

[3] [3]

4

slide-5
SLIDE 5

Key exchange

[3]

5

slide-6
SLIDE 6

#E(๐”พq2) = 2๐‘ฆ๐‘ž๐‘ง 2 q = 2xpy ยฑ 1

Fast Arithmethic modulo 2๐‘ฆ๐‘ž๐‘ง ยฑ 1

6

slide-7
SLIDE 7

#E(๐”พq2) = 2๐‘ฆ๐‘ž๐‘ง 2 q = 2xpy ยฑ 1

Fast Arithmethic modulo 2๐‘ฆ๐‘ž๐‘ง ยฑ 1

6

slide-8
SLIDE 8

Compared approaches

๏‚ด Montgomery reduction ๏‚ด Barrett division ๏‚ด Modular simplification ๏‚ด Shifting ๏‚ด Special radix ๏‚ด โ€ฆ

7

slide-9
SLIDE 9

Montgomery reduction

๏‚ด Calculate ฮค เทค ๐‘เทจ ๐‘ ๐‘† = ๐‘๐‘๐‘† ๐‘›๐‘๐‘’ ๐‘› ๏‚ด Montgomery multiplication

๐‘‘๐‘†โˆ’1 = ๐‘‘ + ๐œˆ๐‘๐‘ ๐‘›๐‘๐‘’ ๐‘† ๐‘› /๐‘† (๐‘›๐‘๐‘’ ๐‘›)

๏‚ด Prime shape optimizations: ๏‚ด ๐œˆ = โˆ’๐‘›โˆ’1 โ‰ก 1 for ๐‘› โ‰ก ยฑ1 ๏‚ด ๐‘ฆ๐‘› = ๐‘ฆ 2๐‘ฆ๐‘ž๐‘ง ยฑ 1 = ๐‘ฆ๐‘ž๐‘ง 2๐‘ฆ ยฑ ๐‘ฆ ๏‚ด Costs ๐‘œ2 + ๐‘œ optimized to ๐‘œ2

2 M

8

slide-10
SLIDE 10

Montgomery reduction

๏‚ด Calculate ฮค เทค ๐‘เทจ ๐‘ ๐‘† = ๐‘๐‘๐‘† ๐‘›๐‘๐‘’ ๐‘› ๏‚ด Montgomery multiplication

๐‘‘๐‘†โˆ’1 = ๐‘‘ + ๐œˆ๐‘๐‘ ๐‘›๐‘๐‘’ ๐‘† ๐‘› /๐‘† (๐‘›๐‘๐‘’ ๐‘›)

๏‚ด Prime shape optimizations: ๏‚ด ๐œˆ = โˆ’๐‘›โˆ’1 โ‰ก 1 for ๐‘› โ‰ก ยฑ1 ๏‚ด ๐‘ฆ๐‘› = ๐‘ฆ 2๐‘ฆ๐‘ž๐‘ง ยฑ 1 = ๐‘ฆ๐‘ž๐‘ง 2๐‘ฆ ยฑ ๐‘ฆ ๏‚ด Costs ๐‘œ2 + ๐‘œ optimized to ๐‘œ2

2 M

9

slide-11
SLIDE 11

Montgomery reduction

๏‚ด Calculate ฮค เทค ๐‘เทจ ๐‘ ๐‘† = ๐‘๐‘๐‘† ๐‘›๐‘๐‘’ ๐‘› ๏‚ด Montgomery multiplication

๐‘‘๐‘†โˆ’1 = ๐‘‘ + ๐œˆ๐‘๐‘ ๐‘›๐‘๐‘’ ๐‘† ๐‘› /๐‘† (๐‘›๐‘๐‘’ ๐‘›)

๏‚ด Prime shape optimizations: ๏‚ด ๐œˆ = โˆ’๐‘›โˆ’1 โ‰ก 1 for ๐‘› โ‰ก ยฑ1 ๏‚ด ๐‘ฆ๐‘› = ๐‘ฆ 2๐‘ฆ๐‘ž๐‘ง ยฑ 1 = ๐‘ฆ๐‘ž๐‘ง 2๐‘ฆ ยฑ ๐‘ฆ ๏‚ด Costs ๐‘œ2 + ๐‘œ optimized to ๐‘œ2

2 M

10

slide-12
SLIDE 12

Barrett division

๏‚ด Calculate ๐‘‘ ๐‘›๐‘๐‘’ ๐‘› as ๐‘‘ โˆ’ ๐‘‘/๐‘› ๐‘› ๏‚ด Approximate

๐‘‘ ๐‘› as ๐‘‘ ๐‘† ๐‘† ๐‘›

๏‚ด 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 ๐‘

11

slide-13
SLIDE 13

Barrett division

๏‚ด Calculate ๐‘‘ ๐‘›๐‘๐‘’ ๐‘› as ๐‘‘ โˆ’ ๐‘‘/๐‘› ๐‘› ๏‚ด Approximate

๐‘‘ ๐‘› as ๐‘‘ ๐‘† ๐‘† ๐‘›

๏‚ด 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 ๐‘

12

slide-14
SLIDE 14

Simplified Modulus

๏‚ด Pick ๐‘† = ๐‘› + 1 = 2๐‘ฆ๐‘ž๐‘ง ๏‚ด ๐‘‘ = ๐‘‘1๐‘† + ๐‘‘0 = ๐‘‘1๐‘› + ๐‘‘1 + ๐‘‘0 โ‰ก ๐‘‘1 + ๐‘‘0 ๏‚ด Need to divide ๐‘‘

๐‘† and suppose ๐‘† = 2๐‘ฆ๐‘†โ€ฒ

๏‚ด Idea: Use Barrett division with special modulus ๏‚ด If ๐‘‘ = ๐‘‘1

โ€ฒ2๐‘ฆ + ๐‘‘0 โ€ฒ and ๐‘‘1 โ€ฒ = ๐‘ฃ๐‘†โ€ฒ + ๐‘ค it follows that

๏‚ด ๐‘‘ = ๐‘ฃ2๐‘ฆ๐‘†โ€ฒ + ๐‘ค2๐‘ฆ + ๐‘‘0โ€ฒ ๏‚ด It follows that ๐‘ค2๐‘ฆ + ๐‘‘0

โ€ฒ = ๐‘‘0 and ๐‘ฃ = ๐‘‘1

๏‚ด Cost โ„ฌ

3 2 ๐‘œ, 1 2 ๐‘œ = 5 8 ๐‘œ2 + 13 4 ๐‘œ + 1 ๐‘

13

slide-15
SLIDE 15

Folding

๏‚ด 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 ๐‘

14

slide-16
SLIDE 16

Interleaved vs Non-interleaved

๏‚ด Interleave multiplication and reduction

๏‚ด Uses less memory

๏‚ด Multiply and reduce separately

๏‚ด Allows asymptotically fast multiplication algorithms

๏‚ด SIDH: Arithmetic in ๐”พq2

๏‚ด (๐‘ + ๐‘—๐‘)(๐‘‘ + ๐‘—๐‘’) ๏‚ด 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

15

slide-17
SLIDE 17

Modulus based Radix

๏‚ด 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

16

slide-18
SLIDE 18

Results (interleaved)

17

(Costs for multiplication and reduction)

slide-19
SLIDE 19

Results (non-interleaved)

18

(Costs for reduction only)

slide-20
SLIDE 20

Shifting

๏‚ด 23723239 โˆ’ 1 ๏‚ด 23723239 has 372 zero bits ๏‚ด 5 words of 64 bit and another 52 bits ๏‚ด 3239 fits into 6 words but it actually uses 7 now ๏‚ด We can properly align the powers of three ๏‚ด Costs: several shifts by 52 bits

19

slide-21
SLIDE 21

SIDH friendly primes

๏‚ด Conditions for our search

  • 1. ๐‘ž โˆˆ 3,5,7,11,13,17,19
  • 2. 384 โ‰ค ๐‘ฆ < 450 and 2300 < ๐‘ž๐‘ง < 2450
  • 3. 2740 < 2๐‘ฆ๐‘ž๐‘ง ยฑ 1 < 2768
  • 4. 2๐‘ฆ โˆ’ ๐‘ž๐‘ง < 240
  • 5. 2๐‘ฆ๐‘ž๐‘ง + 1 or 2๐‘ฆ๐‘ž๐‘ง โˆ’ 1 is prime

20

slide-22
SLIDE 22

New prime suggestions

Prime Security ๐Ÿ‘๐Ÿ’๐Ÿ—๐Ÿ”๐Ÿ’๐Ÿ‘๐Ÿ‘๐Ÿ– โˆ’ ๐Ÿ 120 23945154 + 1 119 23945155 โˆ’ 1 120 23967131 + 1 123 23931791 + 1 124 ๐Ÿ‘๐Ÿ’๐Ÿ˜๐Ÿ๐Ÿ๐Ÿ˜๐Ÿ—๐Ÿ— โˆ’ ๐Ÿ 125

21

slide-23
SLIDE 23

Benchmarking results

22

slide-24
SLIDE 24

Questions?

https://github.com/sidh-arith/

23

slide-25
SLIDE 25

References

  • 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/

24