1
Leakage Resilient Masking Schemes Sebastian Faust Ruhr University - - PowerPoint PPT Presentation
Leakage Resilient Masking Schemes Sebastian Faust Ruhr University - - PowerPoint PPT Presentation
Leakage Resilient Masking Schemes Sebastian Faust Ruhr University Bochum 1 Modern cryptography Until 1970s: Design crypto algorithm secure against one attack Find attack C Find attack B Crypto Crypto algorithm A algorithm B secure against
¡ ¡
2
Modern cryptography
Until 1970s: Design crypto algorithm secure against one attack
secure against attack A secure against attack B
…
Find attack B
Modern crypto: Stop cat-and-mouse game
Find attack C Find attack B
Main tool: security proofs
Crypto algorithm A Crypto algorithm B
Cat and mouse game between designer and attacker
Secure against all attacks within a model
Black-box Model
3 3
¡ ¡Provable secure in black-box model ≈ unbreakable?
Crypto algorithms Attack algorithm Key
Adversaries in Black-box Model
4 4 Crypto algorithms Attack algorithm Key
Adversaries in Black-box Model
Weaknesses outside of Black-box Model
No! C
- ! Crypto
rypto im imple plementa ntations tions g get br t brok
- ken
Crypto implementation
Smart Cards broken by side-channel attacks Much more efficient than traditional attacks on the algorithm May reveal secret key k
Power analysis exploits leakage
Side-channel attacks
5
The Problem
Extend the Black-box model Design algorithms with better security at implementation-level
Cat and mouse game at implementation level
…
Find weakness Find weakness
Crypto implementation A Crypto implementation B
Goal of leakage resilient crypto
6
Rest of this talk:
Example for using proofs to design better countermeasures
Masking countermeasure
7
Masking countermeasure
8
Masking
Important countermeasure
9
Masking: ¡Protect ¡all ¡intermediate ¡values ¡of ¡computa4on ¡ with ¡randomized ¡encoding ¡Enc ¡
¡
¡
Descrip4on ¡as, ¡ e.g., ¡circuit ¡ Computes ¡algorithm ¡
- n ¡encoded ¡values ¡
Harder ¡to ¡exploit ¡leakage ¡ from ¡protected ¡algorithm ¡
Robust ¡encoding ¡func4on ¡
Two ¡ingredients ¡of ¡a ¡masking ¡scheme ¡
Leaks ¡less ¡about ¡K ¡
K ¡ Enc(K) ¡
Crypto algorithms Protected algorithm
Circuit ¡compiler ¡(think ¡of ¡it ¡as ¡ fabrica4on ¡of ¡the ¡chip) ¡
Important countermeasure
10
Masking: ¡Protect ¡all ¡intermediate ¡values ¡of ¡computa4on ¡ with ¡randomized ¡encoding ¡Enc ¡
¡
¡
Descrip4on ¡as, ¡ e.g., ¡circuit ¡ Computes ¡algorithm ¡
- n ¡encoded ¡values ¡
Harder ¡to ¡exploit ¡leakage ¡ from ¡protected ¡algorithm ¡
Robust ¡encoding ¡func4on ¡
Two ¡ingredients ¡of ¡a ¡masking ¡scheme ¡
Crypto algorithms Protected algorithm
Opera4ons ¡compu4ng ¡with ¡encoded ¡values ¡
Enc(X) ¡ Enc(Y) ¡ Enc(X*Y) ¡ Compute ¡on ¡encoded ¡values ¡
Masking countermeasure
11
Security definition
Real:
12
X Y
What does security mean?
X, f indis4nguishable ¡
- utput
Repeat many times
Continuous leakage: many observations are possible Ideal:
Adversary learns no more than by black-box access
What does it mean? For unbounded adversary: MI(Key ; f(.), ... f(.)) < negl Even more: It is as secure as in the black-box world!
Crypto algorithms
In other words: leakage is „useless“ to the adversary
Protected algorithm Y, f(state)
- utput
What function can the leakage f be?
Masking countermeasure
13
Common: Bounded leakage models
n-Probing adversary [ISW03]*
Adversary gets t intermediate values of computation è L = { values on t adversarial chosen wires } t-probing attack formalization of t-variate attacks
14
Basic ingredient: Boolean masking
K ¡:= ¡(K1…Kn) ¡s.t. ¡K=K1+...+ ¡Kn ¡ K ¡
Encode
C ¡
M
- ¡
+ ¡
- ¡
…
Learns nothing if t < n Drawback: leakage oblivious of many wires!
*Ishai, Sahai, Wagner (CRYPTO-03)
Bounded independent leakages [DF12]*
input ¡
- utput ¡
L ¡ R ¡
Assumption: Processors leak independently!
f(L,T) g(R,T) T
Processors can communicate with each other –
Think of it as a 2-party protocol!
Circuit ¡C’ ¡
è Everything that is touched on a processor leaks!
Additive masking? Insecure: learn parities of L & R
Realistic? Includes many functions, e.g. weighted sums
15
m bits
f
- Arbitrary efficient functions
- Ony restriction: input shrinking, i.e., t < m
t bits
Bounded leakage function:
*Dziembowski-F(TCC-12) inspired from Dziembowski-Pietrzak (FOCS-08) for stream ciphers
16
Inner Product Masking
Sample L,R uniformly in {0,1}n s.t. S= <L,R> = Σ Li*Ri and store parts separately on two processors
n ¡ n ¡
R ¡ L ¡
f(L) ¡ g(R) ¡ ?
Thm [DDV10]*: if leakage is bounded in total to t bits then adversary learns nothing about S
L ¡ R ¡
Extract ¡
̴ ¡uniform ¡
High min-entropy and independent sources
*Davi-Dziembowski-Venturi (SCN-12)
17
We know how to encode! Next: How to compute!
High level idea of compiler
18
- 1. Memory:
A bit s Encoded with coding scheme, i.e., S = (S1…Sn) such that s = Dec(S1, …,Sn)
Crypto algorithms Protected algorithm
a ¡ s ¡ s’ ¡ and ¡ and ¡ and ¡
- utput ¡
neg ¡ A ¡ S ¡ S’ ¡ and ¡ C ¡s.t. ¡Dec(C)=a∧s ¡ C ¡s.t.Dec(C)=s∧s’ ¡
Dec ¡ Enc ¡ a ¡
- utput ¡
and ¡ D ¡ and ¡ neg ¡
K’ C’ C K
a ¡ s ¡ s’ ¡ and ¡ and ¡ and ¡
- utput ¡
neg ¡ A ¡ S ¡ S’ ¡ and ¡ C ¡s.t. ¡Dec(C)=a∧s ¡ C ¡s.t.Dec(C)=s∧s’ ¡
Dec ¡ Enc ¡ a ¡
- utput ¡
and ¡ D ¡ and ¡ neg ¡
19
- 2. Wires:
Each wire w = a ∧ ! !b Wire bundle carrying encoding C such that w = Dec(C) Main challenge: computing on encoded inputs!
High level idea of compiler
a ¡ s ¡ s’ ¡ and ¡ and ¡ and ¡
- utput ¡
neg ¡ A ¡ S ¡ S’ ¡ and ¡ C ¡s.t. ¡Dec(C)=a∧s ¡ C ¡s.t.Dec(C)=s∧s’ ¡
Dec ¡ Enc ¡ a ¡
- utput ¡
and ¡ D ¡ and ¡ neg ¡
20
- 3. Gates:
Gadgets built from standard gates operating on encodings Main challenge: algorithm to securely compute AND!
* High level idea of compiler
Theorem [ISW03]: A compiler that makes any C resilient
to adversary that probes up to t < n wires in C’
Compiler results
Blow-up in size: O(n2) for each AND gate in C Leakage bounded per
- bservation: t ¡< ¡n ¡wires ¡
21
Algorithm C
Protected algorithm C’
Theorem [ISW03]: A compiler that makes any C resilient
to adversary that probes up to t < n wires in C’
Compiler results
22
Blow-up in size: O(n2) for each AND gate in C Leakage bounded per exec.: t ¡bits ¡from ¡each ¡processor ¡
Theorem [DF12]: A compiler that makes any C resilient to
adversary that learns bounded independent leakage from C’
Algorithm C
Protected algorithm C’
Boolean vs. IP masking in practice?
Masking countermeasure
23
Implementations?
24
Boolean vs. IP? (BFGV12, BFG15)*
Analyzed for small security parameter n – Security outperforms Boolean masking Main reason: Higher algebraic complexity
Mutual information between HW leakage and secret
Weaker dependency between leakage & secret for IP masking
x
Black ¡curve: ¡Boolean ¡masking ¡ with ¡2 ¡random ¡shares ¡in ¡GF(28) ¡ Red ¡curve: ¡IP ¡masking ¡with ¡2 ¡ random ¡shares ¡in ¡GF(28) ¡
Performance: Full AES implementation for n=2
- IP masking: 300k clock cycles
- Boolean masking: 100k clock cycles
*Balasch-F-Gierlichs-Verbauwhede (ASIACRYPT-12), Balasch-F-Gierlichs (EUROCRYPT-15)
Masking countermeasure
25
Noisy leakages
Bounded leakage?
26
Models do not match with my engineering experience Leakages are not quantitatively bounded
Beautiful theory! Q: Does it match practice?
Physical leakages are inherently noisy
Difficulty in many attacks: how to eliminate the noise?
Noisy leakages [CJRR99]
No quantitative bound on leakage, but leakage is noisy
b1 ¡ b2 ¡
… ¡ ... ¡
bn ¡
For bit b: Enc(b)
...
Leakage is bi + Gaussian noise
27
Chari et al. only consider security of a single masked bit p-noisy functions N(.): More general noise distribution [PR13] X0, X1
uniform
- 2. N(Xb)
N(X0), X0, X1 N(X1), X0, X1
- 1. bç {0,1}
≈
N is p-noisy if statistical distance < p
*Chari-Jutla-Rao-Rohatgi (CRYPTO-99), Prouff-Rivain (EUROCRYPT-13)
28
Pr[Noise(x)=y] Noise(x)=y
è Adv. learns Noise(x): full knowledge about x
Some examples ( F = GF(2) )
No noise p ≈ 1: very informative leakage
Pr[Noise(1)=y] y Pr[Noise(0)=y] y
è Adv. learns Noise(x): no knowledge about x
High noise p = 0: non-informative leakage
Noise(0) Noise(1)
29
Pr[Noise(x)=y] Noise(x)=y
Some examples ( F = GF(2) )
Interesting case: „some noise“
è Adv. learns Noise(x): some knowledge about x
Some noise p < 1: information depends on p Can we construct compilers for noisy leakages?
(for interesting values of p)
Compilers for noisy leakage
Compiler of ISW03 Adversary obtains p-noisy version
- f each wire: N(wi) (for non-trivial p)
Two proof techniques:
- 1. Direct proof [PR13]: very technical proof, only
random message security
- 2. Leakage reductions [DDF14, DFS15]*: simpler
proofs, full simulation-based security
30
No quantitative bound on amount of leakage
Algorithm C
Protected algorithm C’
*Duc-Dziembowski-F (EUROCRYPT-14), Dziembowski-F-Skorski (EUROCRYPT-15)
Main observation [DDF14]
31 secret Leakage
Noisy leakage Probing leakage
equivalent ¡ C ¡
M
- ¡
+ ¡
- ¡
Simpler model than bounded leakage Preferred model in practice
Main technique: leakage reduction
32
What is a leakage reduction?
¡X ¡is ¡secure ¡in ¡ model ¡A ¡ implies ¡ ¡X ¡is ¡secure ¡in ¡ model ¡B ¡
We want to show that model A is „stronger“ than a model B More precisely: for all crypto schemes X
(for certain parameters p and q) C1 ¡ C2 ¡
… ¡ ... ¡
Cn+1 ¡
f(Ci) = Ci with prob. q < 1;
- therwise f(Ci) = „?“
...
f(C1) f(C2) f(Cn+1)
DDF14 shows:
¡X ¡is ¡secure ¡in ¡ ¡ q-‑random ¡probing ¡model ¡ implies ¡ ¡X ¡is ¡secure ¡in ¡ ¡p-‑noisy ¡model ¡
33
What is a leakage reduction?
¡X ¡is ¡secure ¡in ¡ probing ¡model ¡ implies ¡
Chernoff bound
¡X ¡is ¡secure ¡in ¡ model ¡A ¡ implies ¡ ¡X ¡is ¡secure ¡in ¡ model ¡B ¡
We want to show that model A is „stronger“ than a model B More precisely: for all crypto schemes X
(for certain parameters p and q)
DDF14 shows:
¡X ¡is ¡secure ¡in ¡ ¡ q-‑random ¡probing ¡model ¡ implies ¡ ¡X ¡is ¡secure ¡in ¡ ¡p-‑noisy ¡model ¡
Proof outline
34
For any x and Noise(.) there exists Noise‘(.) such that Noise(x) = Noise‘(f(x)) q-Random probing è p-noisy leakage First extreme case: “no noise” (p≈1)
Noise(0) ¡ Noise(1) ¡
No way to “simulate” this noise except with random probing where q=1 (i.e., reveals everything).
Proof outline
35
For any x and Noise(.) there exists Noise‘(.) such that Noise(x) = Noise‘(f(x)) Second extreme case: “full noise” (p=0)
Set Noise‘ = Noise: Simulation is possible without even probing: q = 0 (i.e., reveals nothing)
Noise(0) ¡and ¡Noise(1) ¡ are ¡iden4cal ¡ ¡
q-Random probing è p-noisy leakage
Proof outline
36
Interesting case: “some noise”
If ¡f(x) ¡= ¡? ¡è è ¡sample ¡y ¡according ¡to ¡ ¡ min(Pr[N(0)=y], ¡Pr[N(1)=y]) ¡(normalized) ¡ If ¡f(x) ¡=1 ¡ ¡ (similar) ¡
Noise(0) ¡ Noise(1) ¡
If ¡f(x) ¡=0 ¡è è ¡Pr[N(0) ¡=y] ¡– ¡ Pr[N(1)=y] ¡(normalized) ¡ We show that simulation of Noise(.) with random probing is good when probability q is exactly Δ(Noise(0),Noise(1)) (proof is essentially a simple „averaging argument“)
Noise parameters?
37
It depends on the tightness of the reduction!
q/|F|-‑noisy ¡leakage ¡ secure ¡ ¡ q-‑random ¡ probing ¡secure ¡
implies ¡
DDF14:
Better reduction?
q-‑noisy ¡leakage ¡ secure ¡ ¡ q-‑average ¡random ¡ probing ¡secure ¡
implies ¡
DFS15: Allows to derive asymptotically optimal bound for ISW Adversary obtains O(d-1)-noisy leakage
Protected algorithm C’
Masking countermeasure
38
Better efficiency?
Better efficiency?
39
* ¡
Main bottleneck: masked multiplication
* ¡
Complexity & randomness blow-up O(n2)
- 1. Approach: Use techniques from the MPC
Packed-secret sharing gives us quasi-linear complexity
- 2. Approach: Secure specialized crypto schemes
LowMC cipher etc. (minimizes number of multiplications) Re-keying schemes
40
Basic idea goes back to a patent of Kocher
BC ¡
Re-keying function
Re-keying schemes
F
r sk m r msk Some crypto primitive, e.g., block cipher
F
BC-‑1 ¡
sk msk C m
41
Basic idea goes back to a patent of Kocher
BC ¡
Secure against many observations
Re-keying schemes
F
r sk m r msk Secure against
- ne observation
We want
F
BC-‑1 ¡
sk msk C m
42
Basic idea goes back to a patent of Kocher
BC ¡
Secure against many observations
Re-keying schemes
F
r sk m r msk Secure against
- ne observation
Idea: Use masking to protect F [MSGR10, FGM10]*
r F1 F2 Fn
msk1 msk2
r r r
mskn
Combine
sk1 sk2 sk3
sk …
F
BC-‑1 ¡
sk msk C m
*Medwed, Standaert, Großschädl, Regazzoni (Africacrypt-10) & Fischer, Gammel, Mangard (US patent)
43
The approach of [MSGR10, FGM10]:
How to instantiate F
Ring multiplication: ski = r * mski
r F1 F2 Fn
msk1 msk2
r r r
mskn
Combine
sk1 sk2 sk3
sk …
44
The approach of [MSGR10, FGM10]:
How to instantiate F
r F1 F2 Fn
msk1 msk2
r r r
mskn sk1 sk2 sk3
sk …
ski
∑
45
The approach of [MSGR10, FGM10]:
How to instantiate F
r F1 F2 Fn
msk1 msk2
r r r
mskn sk1 sk2 sk3
sk …
Security?
- 1. Fi is masked è hard to attack (proof in probing model trivial)
ski
∑
46
The approach of [MSGR10, FGM10]:
How to instantiate F
r F1 F2 Fn
msk1 msk2
r r r
mskn sk1 sk2 sk3
sk …
Security?
- 1. Fi is masked è hard to attack (proof in probing model trivial)
- 2. The values ski? Harder…
a) MSGR10: if individual bits of ski and sk learned can be broken b) BCFGKP15*: if adversary obtains low-noisy version of sk
How to protect the ski and sk values?
ski
∑
*Belaid, Coron, Fouque, Gerard, Kammerer, Prouff (CHES-15)
47
The approach of [DFHMS15]*
No physical noise needed
No noise Noisy case
Tool: Key homomorphic wPRF based on learning with rounding
Combine
sk1 sk2 sk3
Gaussian noisy leakage from ski Combine
Tool: The LPL assumption
(reduction to Learning with parity)
Secure even if entire computation leaks
These schemes are practical & and security relies on proofs!
*Dziembowski, Faust, Herold, Masny, Standaert 2015 sk1 sk2 sk3
Masking countermeasure
48
Conclusion
Conclusion
49
è Proofs in n-probing model to check for n-th order flaws
Why proofs for masking?
Systematic analysis to avoid flaws New ideas and schemes Formal requirements on hardware
è IP masking an alternative for additive masking? è How much noise do I need to use masking?
Schemes that are easier to mask?
è Outperform general purpose masking schemes for larger
- rders
Conclusion
50
Automated security proofs [BBDFGS15],...
Many more works...
Threshold implementations [NRR06],...
Many open questions Better models Better efficiency
Dependency, glitches, better bounds... O(n) complexity for general circuits New theory models with applications beyond SCA [MV13],..
*Nikova, Rechberger, Rijmen (ICIS06), Barthe, Belaid, Dupressoir, Fouque, Gregoire, Strub (EUROCRYPT15)
Beyond leakage
How to protect against faults