security of pseudo-random number generators with input · security of pseudo-random number...

57
Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng April, 30th 2017 (with Yevgeniy Dodis, David Pointcheval, Sylvain Ruhault & Daniel Wichs) Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 1 / 36

Upload: others

Post on 10-Apr-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Security of Pseudo-RandomNumber Generators With Input

Damien Vergnaud

École normale supérieure – INRIA – PSL

wr0ngApril, 30th 2017

(with Yevgeniy Dodis, David Pointcheval, Sylvain Ruhault & Daniel Wichs)

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 1 / 36

Page 2: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

About this Talk

examine randomness generation for cryptography

giveI security definitions

I a construction meeting the formalized requirements.

analyzeI a previous construction proposed by Barak and Halevi in 2005

I Linux random generators /dev/random and /dev/urandom

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 2 / 36

Page 3: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Contents

1 Pseudorandom Generators

2 Security ModelsBarak-Halevi Security ModelDodis et al. Security ModelOn the Security of Barak-Halevi Construction

3 A Provably Secure Construction

4 Linux PRNG /dev/random and /dev/urandom

5 Conclusion

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 3 / 36

Page 4: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

True Random Number GeneratorsNatural randomness in real world previous talks

Find a regular but random event and monitor

but, need special hardware to do this

but, often slow

but, problems of bias or uneven distribution

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 4 / 36

Page 5: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

True Random Number GeneratorsNatural randomness in real world previous talks

Find a regular but random event and monitor

but, need special hardware to do this

but, often slow

but, problems of bias or uneven distribution

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 4 / 36

Page 6: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Random Sources and Extractors

What kinds of random sources are useful ?I impredictable must have sufficient entropyI in cryptography: use min-entropy:

H∞(X ) = minx $←X{− log Pr[X = x ]}

Build deterministic extractor ?I f : {0,1}n → {0,1},

s.t. for X over {0,1}n with H∞(X ) ≥ n − 1, Pr[f (X ) = 0] = 1/2I cannot exist

Randomness extractorsI use a small family of functionsI parametrized by a seedI in cryptography: public or private ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 5 / 36

Page 7: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Random Sources and Extractors

What kinds of random sources are useful ?I impredictable must have sufficient entropyI in cryptography: use min-entropy:

H∞(X ) = minx $←X{− log Pr[X = x ]}

Build deterministic extractor ?I f : {0,1}n → {0,1},

s.t. for X over {0,1}n with H∞(X ) ≥ n − 1, Pr[f (X ) = 0] = 1/2I cannot exist

Randomness extractorsI use a small family of functionsI parametrized by a seedI in cryptography: public or private ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 5 / 36

Page 8: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Random Sources and Extractors

What kinds of random sources are useful ?I impredictable must have sufficient entropyI in cryptography: use min-entropy:

H∞(X ) = minx $←X{− log Pr[X = x ]}

Build deterministic extractor ?I f : {0,1}n → {0,1},

s.t. for X over {0,1}n with H∞(X ) ≥ n − 1, Pr[f (X ) = 0] = 1/2I cannot exist

Randomness extractorsI use a small family of functionsI parametrized by a seedI in cryptography: public or private ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 5 / 36

Page 9: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

(Deterministic) Pseudorandom Number Generators0110100100101001010110010

01100010111101001010101111110101111010000101110. . .

output determined by a secret initial valueoutput approximates the properties of random numbersfast and reproducible

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 6 / 36

Page 10: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Security of a PRNG

0110001011110100101010111111010111101000010111. . .

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 7 / 36

Page 11: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Security of a PRNG

0110001011110100101010111111010111101000010111. . .

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 7 / 36

Page 12: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Security of a PRNG

0110001011110100101010111111010111101000010111. . .

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 7 / 36

Page 13: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Security of a PRNG

0110001011110100101010111111010111101000010111. . .

What if the key is compromised ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 7 / 36

Page 14: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Pseudorandom Number Generators with Inputs

0110100100101001010110010

01100010111101001010101111110101111010000101110. . .

Examples:I Linux RNG : /dev/random, Yarrow, Fortuna, Havege, . . .

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 8 / 36

Page 15: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Pseudorandom Number Generators with Inputs

0110100100101001010110010

01100010111101001010101111110101111010000101110. . .

Examples:I Linux RNG : /dev/random, Yarrow, Fortuna, Havege, . . .

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 8 / 36

Page 16: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Expected Security Properties

Resilience: output looks random w/o knowledge of internal state

I Unknown/Known/Chosen input attacks

Security After State CompromiseI Forward security: earlier output looks random with knowledge of current state

I Backward security: future output looks random with knowledge of current state

How to formalize these security notions ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 9 / 36

Page 17: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Expected Security Properties

Resilience: output looks random w/o knowledge of internal state

I Unknown/Known/Chosen input attacks

Security After State CompromiseI Forward security: earlier output looks random with knowledge of current state

I Backward security: future output looks random with knowledge of current state

How to formalize these security notions ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 9 / 36

Page 18: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Expected Security Properties

Resilience: output looks random w/o knowledge of internal state

I Unknown/Known/Chosen input attacks

Security After State CompromiseI Forward security: earlier output looks random with knowledge of current state

I Backward security: future output looks random with knowledge of current state

How to formalize these security notions ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 9 / 36

Page 19: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Contents

1 Pseudorandom Generators

2 Security ModelsBarak-Halevi Security ModelDodis et al. Security ModelOn the Security of Barak-Halevi Construction

3 A Provably Secure Construction

4 Linux PRNG /dev/random and /dev/urandom

5 Conclusion

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 10 / 36

Page 20: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Barak-Halevi Security Model (2005)G = (refresh,next) is a PRNG with input

I refresh(S, I) = S′ ∈ {0,1}n.I next(S) = (S′,R) ∈ {0,1}n × {0,1}`

Security notion: Robustness

G1 proc. good-refresh(D) proc. bad-refresh(x) proc. set-state(S′) proc. next-ror()

x $← D S ← refresh(S, x) OUTPUT S (R,S′)← next(S)S ← refresh(S, x) S ← S′ S ← S′

OUTPUT R

G2 proc. good-refresh(D) proc. bad-refresh(x) proc. set-state(S′) proc. next-ror()

x $← D S ← refresh(S, x) IF corrupt (R,S′)← next(S)S ← refresh(S, x) OUTPUT S S ← S′corrupt← false ELSE IF corrupt

OUTPUT$← {0, 1}m OUTPUT R

S ← S′ ELSE

corrupt← true OUTPUT$← {0, 1}`

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 11 / 36

Page 21: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Barak-Halevi Security Model (2005)G = (refresh,next) is a PRNG with input

I refresh(S, I) = S′ ∈ {0,1}n.I next(S) = (S′,R) ∈ {0,1}n × {0,1}`

Security notion: Robustness

G1 proc. good-refresh(D) proc. bad-refresh(x) proc. set-state(S′) proc. next-ror()

x $← D S ← refresh(S, x) OUTPUT S (R,S′)← next(S)S ← refresh(S, x) S ← S′ S ← S′

OUTPUT R

G2 proc. good-refresh(D) proc. bad-refresh(x) proc. set-state(S′) proc. next-ror()

x $← D S ← refresh(S, x) IF corrupt (R,S′)← next(S)S ← refresh(S, x) OUTPUT S S ← S′corrupt← false ELSE IF corrupt

OUTPUT$← {0, 1}m OUTPUT R

S ← S′ ELSE

corrupt← true OUTPUT$← {0, 1}`

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 11 / 36

Page 22: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Defects in Barak-Halevi Model

Entropy accumulationnull or high entropy inputs,but, entropy could be accumulated slowly in S.a PRNG should recover from state compromise(if the amount of accumulated entropy crosses some threshold)

Need for a setup proceduredeterministic randomness extractors do not exist!Two options:

I restrict the family of permitted high-entropy distributions.

I add a setup procedure which outputs some public parameters(used by next and refresh)

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 12 / 36

Page 23: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Defects in Barak-Halevi Model

Entropy accumulationnull or high entropy inputs,but, entropy could be accumulated slowly in S.a PRNG should recover from state compromise(if the amount of accumulated entropy crosses some threshold)

Need for a setup proceduredeterministic randomness extractors do not exist!Two options:

I restrict the family of permitted high-entropy distributions.

I add a setup procedure which outputs some public parameters(used by next and refresh)

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 12 / 36

Page 24: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Defects in Barak-Halevi Model

State PseudorandomnessBH model ensures that S is indistinguishable from random

But technical parameters do not need to be random(e.g. Linux contains (predictable) entropy estimators).

Pseudorandomness of the state is not actually a requirement

Only pseudorandomness of the output is !

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 13 / 36

Page 25: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

New Model Description

G = (setup, refresh,next) is a PRNG with inputI setup output public parameters seedI refresh(S, I) = S′ ∈ {0,1}n.I next(S) = (S′,R) ∈ {0,1}n × {0,1}`

Adversary divided into two parts (A,D)

D : σ → (σ′, I, γ, z) is a legitimate distribution samplerI σ = state of D.I I = next input for refreshI γ = entropy estimation of II z = leakage about I given to AI H∞(Ij | I1, . . . , Ij−1, Ij+1, . . . , IqD , z1, . . . , zqD , γ1, . . . , γqD ) ≥ γj

seed is not passed to D but is given to A

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 14 / 36

Page 26: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Security Games

proc. initialize

seed $← setup; σ ← 0; S $← {0, 1}n;

c ← n; corrupt← false; b $← {0, 1}OUTPUT seed

proc. finalize(b∗)IF b = b∗ RETURN 1ELSE RETURN 0

proc. D-refresh

(σ, I, γ, z) $← D(σ)S ← refresh(S, I)c ← c + γIF c ≥ γ∗,

corrupt← falseOUTPUT (γ, z)

proc. next-ror(S,R0)← next(S)

R1$← {0, 1}`

IF corrupt = true,c ← 0, RETURN R0

ELSE RETURN Rb

proc. get-next(S,R)← next(S)IF corrupt = true,

c ← 0OUTPUT R

proc. get-statec ← 0, corrupt← trueOUTPUT S

proc. set-state(S∗)c ← 0, corrupt← trueS ← S∗

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 15 / 36

Page 27: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Security Games

proc. initialize

seed $← setup; σ ← 0; S $← {0, 1}n;

c ← n; corrupt← false; b $← {0, 1}OUTPUT seed

proc. finalize(b∗)IF b = b∗ RETURN 1ELSE RETURN 0

proc. D-refresh

(σ, I, γ, z) $← D(σ)S ← refresh(S, I)c ← c + γIF c ≥ γ∗,

corrupt← falseOUTPUT (γ, z)

proc. next-ror(S,R0)← next(S)

R1$← {0, 1}`

IF corrupt = true,c ← 0, RETURN R0

ELSE RETURN Rb

proc. get-next(S,R)← next(S)IF corrupt = true,

c ← 0OUTPUT R

proc. get-statec ← 0, corrupt← trueOUTPUT S

proc. set-state(S∗)c ← 0, corrupt← trueS ← S∗

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 15 / 36

Page 28: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Resilience

proc. initialize

seed $← setup; σ ← 0; S $← {0, 1}n;

c ← n; corrupt← false; b $← {0, 1}OUTPUT seed

proc. finalize(b∗)IF b = b∗ RETURN 1ELSE RETURN 0

proc. D-refresh

(σ, I, γ, z) $← D(σ)S ← refresh(S, I)c ← c + γIF c ≥ γ∗,

corrupt← falseOUTPUT (γ, z)

proc. next-ror(S,R0)← next(S)

R1$← {0, 1}`

IF corrupt = true,c ← 0, RETURN R0

ELSE RETURN Rb

proc. get-next(S,R)← next(S)IF corrupt = true,

c ← 0OUTPUT R

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 16 / 36

Page 29: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Backward Security

proc. initialize

seed $← setup; σ ← 0; S $← {0, 1}n;

c ← n; corrupt← false; b $← {0, 1}OUTPUT seed

proc. finalize(b∗)IF b = b∗ RETURN 1ELSE RETURN 0

proc. D-refresh

(σ, I, γ, z) $← D(σ)S ← refresh(S, I)c ← c + γIF c ≥ γ∗,

corrupt← falseOUTPUT (γ, z)

proc. next-ror(S,R0)← next(S)

R1$← {0, 1}`

IF corrupt = true,c ← 0, RETURN R0

ELSE RETURN Rb

proc. get-next(S,R)← next(S)IF corrupt = true,

c ← 0OUTPUT R

proc. set-state(S∗) (single first call)c ← 0, corrupt← trueS ← S∗

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 17 / 36

Page 30: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Forward Security

proc. initialize

seed $← setup; σ ← 0; S $← {0, 1}n;

c ← n; corrupt← false; b $← {0, 1}OUTPUT seed

proc. finalize(b∗)IF b = b∗ RETURN 1ELSE RETURN 0

proc. D-refresh

(σ, I, γ, z) $← D(σ)S ← refresh(S, I)c ← c + γIF c ≥ γ∗,

corrupt← falseOUTPUT (γ, z)

proc. next-ror(S,R0)← next(S)

R1$← {0, 1}`

IF corrupt = true,c ← 0, RETURN R0

ELSE RETURN Rb

proc. get-next(S,R)← next(S)IF corrupt = true,

c ← 0OUTPUT R

proc. get-state (single last call)c ← 0, corrupt← trueOUTPUT S

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 18 / 36

Page 31: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Robustness

proc. initialize

seed $← setup; σ ← 0; S $← {0, 1}n;

c ← n; corrupt← false; b $← {0, 1}OUTPUT seed

proc. finalize(b∗)IF b = b∗ RETURN 1ELSE RETURN 0

proc. D-refresh

(σ, I, γ, z) $← D(σ)S ← refresh(S, I)c ← c + γIF c ≥ γ∗,

corrupt← falseOUTPUT (γ, z)

proc. next-ror(S,R0)← next(S)

R1$← {0, 1}`

IF corrupt = true,c ← 0, RETURN R0

ELSE RETURN Rb

proc. get-next(S,R)← next(S)IF corrupt = true,

c ← 0OUTPUT R

proc. get-statec ← 0, corrupt← trueOUTPUT S

proc. set-state(S∗)c ← 0, corrupt← trueS ← S∗

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 19 / 36

Page 32: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Barak-Halevi Construction

Extract : {0,1}p −→ {0,1}n a randomness extractorG : {0,1}n −→ {0,1}n+` a (deterministic) PRNG

Barak-Halevi Constructionrefresh(S, I) = [G(S ⊕ Extract(I))]n1next(S) = G(S)

robust in BH model

Simplified Barak-Halevi Constructionrefresh(S, I) = S ⊕ Extract(I)next(S) = G(S)

robust in BH model (if one drops state pseudorandomness)

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 20 / 36

Page 33: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Barak-Halevi Construction

Extract : {0,1}p −→ {0,1}n a randomness extractorG : {0,1}n −→ {0,1}n+` a (deterministic) PRNG

Barak-Halevi Constructionrefresh(S, I) = [G(S ⊕ Extract(I))]n1next(S) = G(S)

robust in BH model

Simplified Barak-Halevi Constructionrefresh(S, I) = S ⊕ Extract(I)next(S) = G(S)

robust in BH model (if one drops state pseudorandomness)

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 20 / 36

Page 34: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Barak-Halevi ConstructionSimplified Barak-Halevi Construction

refresh(S, I) = S ⊕ Extract(I)next(S) = G(S)

robust in BH model (if one drops state pseudorandomness)

but, does not accumulate entropy!is not backward secure in [DPRVW13] model

D : σ = ∅ → (σ′, I, γ, z) = (∅,bp,1, ∅) with b $← {0,1}is a (stateless) legitimate distribution samplerA

I calls set-state(0n) (S0 = 0n),I makes γ∗ calls to D-refresh (Sj = D-refresh(Sj−1,bp))I makes many calls to next-ror.

Y (b) = Extract(bp) S2j ∈ {0n,Y (0)⊕ Y (1)} and S2j+1 ∈ {Y (0),Y (1)}

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 21 / 36

Page 35: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Barak-Halevi ConstructionSimplified Barak-Halevi Construction

refresh(S, I) = S ⊕ Extract(I)next(S) = G(S)

robust in BH model (if one drops state pseudorandomness)

but, does not accumulate entropy!is not backward secure in [DPRVW13] model

D : σ = ∅ → (σ′, I, γ, z) = (∅,bp,1, ∅) with b $← {0,1}is a (stateless) legitimate distribution samplerA

I calls set-state(0n) (S0 = 0n),I makes γ∗ calls to D-refresh (Sj = D-refresh(Sj−1,bp))I makes many calls to next-ror.

Y (b) = Extract(bp) S2j ∈ {0n,Y (0)⊕ Y (1)} and S2j+1 ∈ {Y (0),Y (1)}

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 21 / 36

Page 36: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Contents

1 Pseudorandom Generators

2 Security ModelsBarak-Halevi Security ModelDodis et al. Security ModelOn the Security of Barak-Halevi Construction

3 A Provably Secure Construction

4 Linux PRNG /dev/random and /dev/urandom

5 Conclusion

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 22 / 36

Page 37: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

A Provably Secure Construction

G : {0,1}m −→ {0,1}n+` a (deterministic) PRNG

Construction

setup(·) = seed = (X ,X ′) $← {0,1}2n.refresh(S, I) = S · X + I ∈ F2n .next(S) = G([X ′ · S]m1 ).

it preserves securityit accumulates entropy robust in [DPRVW13] model !

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 23 / 36

Page 38: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

A Provably Secure Construction

Lemma 1This construction preserves security.

if the state S0 starts uniformly random and uncompromised,and is refreshed with (adversarial) samples I1, . . . , Id Sd ,(S′,R) = next(Sd )

then R looks indistinguishable from uniform

Proof.Sd := S · X d + Id−1 · X d−1 + · · ·+ I1 · X + I0.

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 24 / 36

Page 39: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

A Provably Secure Construction

Lemma 1This construction preserves security.

if the state S0 starts uniformly random and uncompromised,and is refreshed with (adversarial) samples I1, . . . , Id Sd ,(S′,R) = next(Sd )

then R looks indistinguishable from uniform

Proof.Sd := S · X d + Id−1 · X d−1 + · · ·+ I1 · X + I0.

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 24 / 36

Page 40: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

A Provably Secure Construction

Lemma 2This construction accumulates entropy.

if the state S0 starts is compromised to some arbitrary valueand is refreshed with D-refresh samples I1, . . . , Id Sd ,(S′,R) = next(Sd )

then R looks indistinguishable from uniform

Proof.

h∗X ,X ′ (̄I) :=

X ′ ·d−1∑j=0

Ij · X j

m

1

.

is 2−m(1 + d · 2m−n)-universal.

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 25 / 36

Page 41: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

A Provably Secure Construction

Lemma 2This construction accumulates entropy.

if the state S0 starts is compromised to some arbitrary valueand is refreshed with D-refresh samples I1, . . . , Id Sd ,(S′,R) = next(Sd )

then R looks indistinguishable from uniform

Proof.

h∗X ,X ′ (̄I) :=

X ′ ·d−1∑j=0

Ij · X j

m

1

.

is 2−m(1 + d · 2m−n)-universal.

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 25 / 36

Page 42: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Contents

1 Pseudorandom Generators

2 Security ModelsBarak-Halevi Security ModelDodis et al. Security ModelOn the Security of Barak-Halevi Construction

3 A Provably Secure Construction

4 Linux PRNG /dev/random and /dev/urandom

5 Conclusion

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 26 / 36

Page 43: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

The Linux Random Number Generator

part of the Linux kernel since 1994from Theodore Ts’o and Matt Mackall

only definition in the code (with comments) :I About 1700 lines

Previous Analysis:I Barak-Halevi, 2005: almost no mentioning of the Linux RNGI Gutterman-Pinkas-Reinman, 2006: some weaknessesI Lacharme-Röck-Strubel-Videau, 2012: detailed description

Two different versions :I /dev/random: limits the number of bits by the estimated entropyI /dev/urandom: generates as many bits as the user asks for

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 27 / 36

Page 44: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

The Linux Random Number Generator

part of the Linux kernel since 1994from Theodore Ts’o and Matt Mackall

only definition in the code (with comments) :I About 1700 lines

Previous Analysis:I Barak-Halevi, 2005: almost no mentioning of the Linux RNGI Gutterman-Pinkas-Reinman, 2006: some weaknessesI Lacharme-Röck-Strubel-Videau, 2012: detailed description

Two different versions :I /dev/random: limits the number of bits by the estimated entropyI /dev/urandom: generates as many bits as the user asks for

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 27 / 36

Page 45: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

General Overview of LINUX PRNG

dev/urandom

dev/random

Non BlockingOuput Pool

BlockingOuput Pool

Input

PoolInput

|I| = 96, |S| = 6144, |R| = 80refresh and next uses a Mixing function and a Hash functionall transfers between pools rely on Entropy Estimators

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 28 / 36

Page 46: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

dev/urandom Output Request

Input

Pool

dev/urandom

Is there enough entropy in Non Blocking Output Pool ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 29 / 36

Page 47: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

dev/urandom Output Request

Input

Pool

00110101101

Is there enough entropy in output pool ?Yes, output the requested bytes !

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 29 / 36

Page 48: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

dev/urandom Output Request

dev/urandom

Is there enough entropy in output pool ?No, ask the input pool !

I Is there enough entropy in input pool ?

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 29 / 36

Page 49: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

dev/urandom Output Request

00110101101

Is there enough entropy in output pool ?No, ask the input pool !

I Is there enough entropy in input pool ?I Yes, transfer from input pool to output pool and generate!

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 29 / 36

Page 50: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

dev/urandom Output Request

0011010110

Is there enough entropy in output pool ?No, ask the input pool !

I Is there enough entropy in input pool ?I No, generate output anyway !

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 29 / 36

Page 51: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Difference with dev/random

dev/random

Is there enough entropy in output pool ?No, ask the input pool !

I Is there enough entropy in input pool ?I No, do not generate output and wait !

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 30 / 36

Page 52: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Defects of LINUX PRNG

if input pool contains enoughentropy, don’t refresh(before [DPRVW13])

there exists D0, H∞(D0) = 0,that LINUX estimates high

there exists D1, H∞(D1) = 64,that LINUX estimates 0

there exists D2, H∞(D2) = 1,for which LINUX does notaccumulate

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 31 / 36

Page 53: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

dev/random was not Robust

first step : get-state

D-refresh with D0 (H∞ = 0),until input pool is full

D-refresh with D1 (H∞ = 64),which are ignored

next: H∞(R) = 0 0011010110

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 32 / 36

Page 54: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

dev/urandom was not Robust

first step : get-state

D-refresh with D1 (H∞ = 64),which are not transfered

next : H∞(R) = 0 0011010110

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 33 / 36

Page 55: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Contents

1 Pseudorandom Generators

2 Security ModelsBarak-Halevi Security ModelDodis et al. Security ModelOn the Security of Barak-Halevi Construction

3 A Provably Secure Construction

4 Linux PRNG /dev/random and /dev/urandom

5 Conclusion

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 34 / 36

Page 56: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Follow-up WorksOther Attacks(Cornejo-Ruhault – ACM CCS 2014)

Security against Premature Next(Dodis, Shamir, Stephens-Davidowitz, Wichs – Crypto 2014)

Analysis of Intel’s Secure Key RNG(Shrimpton, Terashima – Eurocrypt 2015)

Backdoored PRNGs(Degabriele, Paterson, Schuldt, Woodage – Crypto 2016)Kenny’s talk . . .

Sponge-Based PRNGs(Gaži, Tessaro – Eurocrypt 2016)see next talk . . .

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 35 / 36

Page 57: Security of Pseudo-Random Number Generators With Input · Security of Pseudo-Random Number Generators With Input Damien Vergnaud École normale supérieure – INRIA – PSL wr0ng

Conclusion

Generation of random numbers is too important to be left to chance . . .

Analysis of BH model and construction.

DPRVW13 security model for PRNG with input.

Attacks on LINUX PRNGsI using entropy estimatorI using mixing function (see paper)

Construction provably secure and efficient.

Damien Vergnaud (ENS) Security of PRNG with Input April, 30th 2017 36 / 36