Cryptanalysis of the Legendre PRF and Generalizations W. Beullens 1 - - PowerPoint PPT Presentation

cryptanalysis of the legendre prf and generalizations
SMART_READER_LITE
LIVE PREVIEW

Cryptanalysis of the Legendre PRF and Generalizations W. Beullens 1 - - PowerPoint PPT Presentation

Cryptanalysis of the Legendre PRF and Generalizations W. Beullens 1 T. Beyne 1 A. Udovenko 2 G. Vitto 2 1 imec-COSIC, ESAT, KULeuven 2 SnT, University of Luxembourg November 13, 2020 COSIC Legendre symbol Early 1900s: equidistribution results


slide-1
SLIDE 1

Cryptanalysis of the Legendre PRF and Generalizations

  • W. Beullens1
  • T. Beyne1
  • A. Udovenko2
  • G. Vitto2

1imec-COSIC, ESAT, KULeuven 2SnT, University of Luxembourg

November 13, 2020

COSIC

slide-2
SLIDE 2

Legendre symbol

◮ Legendre symbol of a ∈ Fp (prime p > 2): a p

  • =

     1 if a = b2 for some b ∈ F×

p ,

if a = 0, −1

  • therwise.

Early 1900s: equidistribution results Jacobsthal (1906) and Davenport (1931) Damgård (1990) conjectures pseudorandomness of k p k p

2

slide-3
SLIDE 3

Legendre symbol

◮ Legendre symbol of a ∈ Fp (prime p > 2): a p

  • =

     1 if a = b2 for some b ∈ F×

p ,

if a = 0, −1

  • therwise.

◮ Early 1900s: equidistribution results Jacobsthal (1906) and Davenport (1931) ◮ Damgård (1990) conjectures pseudorandomness of k p

  • ,

k + 1 p

  • , . . .

2

slide-4
SLIDE 4

Legendre PRF

◮ Pseudorandom function proposed by Grassi et al. (2016): Lk(x) = x + k p

  • ∈ {−1, 0, 1}

◮ MPC-friendly ◮ Applications

– Ethereum 2.0 proof-of-custody – LegRoast signatures Beullens et al. (2020)

3

slide-5
SLIDE 5

Cryptanalysis of the Legendre PRF

Overview

24/07

  • O(p/M)

Khovratovich (2019)

20/08

Bounties announced

09/10

Challenges announced (M = 220)

https://legendreprf.org/

  • O(p/M2)

this work (Time complexities for M <

4

√p.)

4

slide-6
SLIDE 6

Cryptanalysis of the Legendre PRF

Overview

24/07

  • O(p/M)

Khovratovich (2019)

20/08

Bounties announced

09/10

Challenges announced (M = 220)

https://legendreprf.org/

  • O(p/M2)

this work (Time complexities for M <

4

√p.)

4

slide-7
SLIDE 7

Cryptanalysis of the Legendre PRF

Overview

24/07

  • O(p/M)

Khovratovich (2019)

20/08

Bounties announced

09/10

Challenges announced (M = 220)

https://legendreprf.org/

14/10

64-bit challenge solved

21/10

74-bit challenge solved

  • O(p/M2)

this work

30/11

84-bit challenge solved log p improvement by Kaluđerović et al. (2020) (Time complexities for M <

4

√p.)

4

slide-8
SLIDE 8

Cryptanalysis of the Legendre PRF

Khovratovich (2019)

◮ Notation: Lk(x + [m]) = (Lk(x), Lk(x + 1), . . . , Lk(x + m − 1)) Observation: Lk x m L k x m . . . a . . . Lk a m . . . . . . . . .

  • 1. Query Lk M
  • 2. Extract M

m sequences

  • f the form Lk a

m

○ Sample L

c m until collision if m log p then probably c k a Cost: M p M operations M memory

5

slide-9
SLIDE 9

Cryptanalysis of the Legendre PRF

Khovratovich (2019)

◮ Notation: Lk(x + [m]) = (Lk(x), Lk(x + 1), . . . , Lk(x + m − 1)) ◮ Observation: Lk(x + [m]) = L0(k + x + [m]) . . . a . . . Lk(a + [m]) . . . . . . . . .

  • 1. Query Lk([M])
  • 2. Extract M − m sequences
  • f the form Lk(a + [m])

○ Sample L0(c + [m]) until collision

if m = Ω(log p) then probably c = k + a Cost: O(M + p/M) operations

  • O(M) memory

5

slide-10
SLIDE 10

Cryptanalysis of the Legendre PRF

Khovratovich (2019)

◮ Notation: Lk(x + [m]) = (Lk(x), Lk(x + 1), . . . , Lk(x + m − 1)) ◮ Observation: Lk(x + [m]) = L0(k + x + [m]) . . . a . . . Lk(a + [m]) . . . . . . . . .

  • 1. Query Lk([M])
  • 2. Extract M − m sequences
  • f the form Lk(a + [m])

○ Sample L0(c + [m]) until collision

if m = Ω(log p) then probably c = k + a Cost: O(M + p/M) operations

  • O(M) memory

5

slide-11
SLIDE 11

Cryptanalysis of the Legendre PRF

Our attack: idea

◮ Multiplicativity of the Legendre symbol: ab p

  • =

a p b p

  • =

⇒ L0(b) Lk/b(a/b+[m]) = Lk(a+b[m]) . . . a b . . . Lk b a b m . . . . . . . . .

  • 1. Query Lk M
  • 2. Extract

M m sequences

  • f the form Lk b a b

m

○ Sample L

c m until collision if m log p then probably c k a b Cost: M p M

  • perations

M memory

6

slide-12
SLIDE 12

Cryptanalysis of the Legendre PRF

Our attack: idea

◮ Multiplicativity of the Legendre symbol: ab p

  • =

a p b p

  • =

⇒ L0(b) Lk/b(a/b+[m]) = Lk(a+b[m]) . . . a, b . . . Lk/b(a/b + [m]) . . . . . . . . .

  • 1. Query Lk([M])
  • 2. Extract ∼ M2/m sequences
  • f the form Lk/b(a/b + [m])

○ Sample L0(c + [m]) until collision

if m = Ω(log p) then probably c = (k + a)/b Cost: O(M2 + p/M2) operations O(M2) memory

6

slide-13
SLIDE 13

Cryptanalysis of the Legendre PRF

Our attack: idea

◮ Multiplicativity of the Legendre symbol: ab p

  • =

a p b p

  • =

⇒ L0(b) Lk/b(a/b+[m]) = Lk(a+b[m]) . . . a, b . . . Lk/b(a/b + [m]) . . . . . . . . .

  • 1. Query Lk([M])
  • 2. Extract ∼ M2/m sequences
  • f the form Lk/b(a/b + [m])

○ Sample L0(c + [m]) until collision

if m = Ω(log p) then probably c = (k + a)/b Cost: O(M2 + p/M2) operations O(M2) memory

6

slide-14
SLIDE 14

Cryptanalysis of the Legendre PRF

Our attack: optimizations

◮ Use consecutive samples in offmine phase:

  • 1. Compute L0(c + [w]) for some w > m
  • 2. Extract ∼ w2/m sequences of the form L0(c/d + [m])

Caveat: sequences in the table are not random Advantages:

– Amortizes Legendre symbol computation Cost dominated by sequence extraction and table lookups – Only store sequences with a b

Cost: M p log p M time M log p memory

7

slide-15
SLIDE 15

Cryptanalysis of the Legendre PRF

Our attack: optimizations

◮ Use consecutive samples in offmine phase:

  • 1. Compute L0(c + [w]) for some w > m
  • 2. Extract ∼ w2/m sequences of the form L0(c/d + [m])

◮ Caveat: sequences in the table are not random ◮ Advantages:

– Amortizes Legendre symbol computation → Cost dominated by sequence extraction and table lookups – Only store sequences with |a| < |b|

◮ Cost: O(M2 + p log2 p/M2) time O(M2/ log p) memory

7

slide-16
SLIDE 16

Cryptanalysis of the Legendre PRF

Our attack: implementation results

◮ First M = 220 consecutive PRF outputs Lk([M]) were given ◮ Bottleneck: table lookups (0.08µs) p Time (core-hours) Memory / thread (GB) 240 − 87 < 0.001 < 1 264 − 59 1.5 3 274 − 35 1500 3 ◮ Dell C6420 server; two Intel Xeon Gold 6132 CPUs (2.6 GHz) 128 GB of RAM

https://github.com/cryptolu/LegendrePRF 8

slide-17
SLIDE 17

Generalizations of the Legendre PRF

Overview

◮ Higher-degree Legendre PRF First analysis by Khovratovich (2019) ◮ Jacobi symbols ◮ Power-residue symbols Damgård (1990)

9

slide-18
SLIDE 18

Generalizations of the Legendre PRF

Higher-degree Legendre PRF

◮ Degree-1 Legendre PRF: Lk(x) = x + k p

  • ,

k ∈ Fp Attacks (d ):

– Khovratovich (2019): pd time – This work: p pd using sequence extraction – Kaluđerović et al. (2020): p pd – Weak keys (next slides)

10

slide-19
SLIDE 19

Generalizations of the Legendre PRF

Higher-degree Legendre PRF

◮ Degree-d Legendre PRF: Lk(x) = xd + kd−1xd−1 + . . . + k1x + k0 p

  • ,

k ∈ Fd

p

Attacks (d ):

– Khovratovich (2019): pd time – This work: p pd using sequence extraction – Kaluđerović et al. (2020): p pd – Weak keys (next slides)

10

slide-20
SLIDE 20

Generalizations of the Legendre PRF

Higher-degree Legendre PRF

◮ Degree-d Legendre PRF: Lk(x) = xd + kd−1xd−1 + . . . + k1x + k0 p

  • ,

k ∈ Fd

p

◮ Attacks (d ≥ 2):

– Khovratovich (2019): O(pd−1) time – This work: O(p2 + pd−2) using sequence extraction – Kaluđerović et al. (2020): O(p3 + pd−3) – Weak keys (next slides)

10

slide-21
SLIDE 21

Generalizations of the Legendre PRF

Higher-degree Legendre PRF

◮ Example: xd + kd−1xd−1 + . . . + k1x + k0 = d

i=1(x − αi)

with α1, . . . , αd ∈ Fp distinct Lα1 Lα2 Lα3 · · · Lαd x × Security?

11

slide-22
SLIDE 22

Generalizations of the Legendre PRF

Higher-degree Legendre PRF

◮ Example: xd + kd−1xd−1 + . . . + k1x + k0 = d

i=1(x − αi)

with α1, . . . , αd ∈ Fp distinct Lα1 Lα2 Lα3 · · · Lαd x × Security? O(p⌈d/2⌉) attack

11

slide-23
SLIDE 23

Generalizations of the Legendre PRF

Higher-degree Legendre PRF

◮ Weak key when xd + kd−1xd−1 + . . . + k1x + k0 is reducible ◮ Worst case: two factors of equal degree Lk(x) = Lk1(x)Lk2(x) with k1, k2 ∈ Fd/2

p

◮ Attack: fjnd collision between Lk([m])Lk1([m]) and Lk2([m])

5 10 15 20 25 30 degree 5 10 15 20 25 30 attack complexity Fraction of keys 20% 50% 70% 90% 100% 12

slide-24
SLIDE 24

Generalizations of the Legendre PRF

Jacobi PRF

◮ Let p, q > 2 be primes. Jacobi symbol of a ∈ Z/(pq)Z: a pq

  • =

a p a q

  • Observation

k px pq k p k px q k p p q k p x q Attack:

  • 1. Use attack on Legendre PRF to obtain k mod q
  • 2. Use attack on Legendre PRF to obtain k mod p
  • 3. Apply the Chinese Remainder Theorem

13

slide-25
SLIDE 25

Generalizations of the Legendre PRF

Jacobi PRF

◮ Let p, q > 2 be primes. Jacobi symbol of a ∈ Z/(pq)Z: a pq

  • =

a p a q

  • ◮ Observation

k + px pq

  • =

k p k + px q

  • =

k p p q k/p + x q

  • ◮ Attack:
  • 1. Use attack on Legendre PRF to obtain k mod q
  • 2. Use attack on Legendre PRF to obtain k mod p
  • 3. Apply the Chinese Remainder Theorem

13

slide-26
SLIDE 26

Generalizations of the Legendre PRF

Power-residue PRF

◮ Let p be a prime such that r | (p − 1) ◮ The r-th power residue symbol of x is x p

  • r

= x(p−1)/r ◮ Applications

– Extract more output-bits – PorcRoast signatures Beullens et al. (2020)

Basic attack generalizes: M p M time M memory For large r: M p Mr time M memory (see paper)

14

slide-27
SLIDE 27

Generalizations of the Legendre PRF

Power-residue PRF

◮ Let p be a prime such that r | (p − 1) ◮ The r-th power residue symbol of x is x p

  • r

= x(p−1)/r ◮ Applications

– Extract more output-bits – PorcRoast signatures Beullens et al. (2020)

◮ Basic attack generalizes: O(M2 + p/M2) time

  • O(M2) memory

◮ For large r: O(M + p/(Mr)) time O(M) memory (see paper)

14

slide-28
SLIDE 28

Conclusions

◮ Improved attack on the Legendre PRF

– Relevant in the low-data setting: O(p/M2) for M <

4

√p – Solution to concrete challenges (64 and 74 bit)

◮ Improved attacks on the higher-degree variant ◮ First evaluation of two other variants from Damgård (1990)

– Jacobi symbols – Power-residue symbols

  • https://github.com/cryptolu/LegendrePRF

15

slide-29
SLIDE 29

References I

Jacobsthal, Ernst Erich (1906). “Anwendungen einer Formel aus der Theorie der quadratischen Reste”. PhD thesis. Friedrich-Wilhelms Universität zu Berlin. Chap. 3. Davenport, Harold (1931). “On the distribution of quadratic residues (mod p)”. In: Journal of the London Mathematical Society 1.1, pp. 49–54. Damgård, Ivan (Aug. 1990). “On the Randomness of Legendre and Jacobi Sequences”. In: CRYPTO’88. Ed. by Shafj Goldwasser.

  • Vol. 403. LNCS. Springer, Heidelberg, pp. 163–172. doi:

10.1007/0-387-34799-2_13. Grassi, Lorenzo et al. (Oct. 2016). “MPC-Friendly Symmetric Key Primitives”. In: ACM CCS 2016. Ed. by Edgar R. Weippl et al. ACM Press, pp. 430–443. doi: 10.1145/2976749.2978332. Beullens, Ward et al. (2020). LegRoast: Effjcient post-quantum signatures from the Legendre PRF. Cryptology ePrint Archive, Report 2020/128. https://eprint.iacr.org/2020/128.

15

slide-30
SLIDE 30

References II

Khovratovich, Dmitry (2019). Key recovery attacks on the Legendre PRFs within the birthday bound. Cryptology ePrint Archive, Report 2019/862. https://eprint.iacr.org/2019/862. Kaluđerović, Novak et al. (2020). Improved key recovery on the Legendre PRF. Cryptology ePrint Archive, Report 2020/098. https://eprint.iacr.org/2020/098.

15