Introduction July 16, 2013 Welcome Acknowledgements: Benjamin - - PowerPoint PPT Presentation

introduction
SMART_READER_LITE
LIVE PREVIEW

Introduction July 16, 2013 Welcome Acknowledgements: Benjamin - - PowerPoint PPT Presentation

Introduction July 16, 2013 Welcome Acknowledgements: Benjamin Pierce, Andr Scedrov, U Penn support team Office of Naval Research EasyCrypt users Organization: Lectures: overview of key components Labs: hands-on experience


slide-1
SLIDE 1

Introduction

July 16, 2013

slide-2
SLIDE 2

Welcome

Acknowledgements:

◮ Benjamin Pierce, André Scedrov, U Penn support team ◮ Office of Naval Research ◮ EasyCrypt users

Organization:

◮ Lectures: overview of key components ◮ Labs: hands-on experience ◮ Workshop (Friday)

School web page: http://www.easycrypt.info/school.html

slide-3
SLIDE 3

EasyCrypt in a nusthell

◮ EasyCrypt is a tool-assisted platform for proving security of

cryptographic constructions in the computational model

◮ Views cryptographic proofs as relational verification of

  • pen parametric probabilistic programs

◮ Leverage PL and PV techniques for cryptographic proofs ◮ Be accessible to cryptographers (choice of PL) ◮ Support high-level reasoning principles (still ongoing) ◮ Provide reasonable level of automation ◮ Reuse off-the-shelf verification tools (we use Why3)

slide-4
SLIDE 4

EasyCrypt usage

◮ EasyCrypt is generic: no restriction on

☞ primitives and protocols ☞ security notions and assumptions

◮ Can be used interactively or as a certifying back-end

☞ for cryptographic compilers (ZK) ☞ for domain-specific (computational or symbolic) logics

◮ Can verify implementations

☞ C-mode ☞ CompCert as a certifying back-end

slide-5
SLIDE 5

Evolution

Started in 2009. One older brother (CertiCrypt), started 2006.

◮ At first, mostly automated proofs ◮ v0.2 Interactive proofs in pRHL ◮ v1.0 Modular proofs, all layers explicit and with support for

interactive proofs

Warning

v1.0 not yet finalized. Still needs to work on

◮ increasing automation ◮ high-level proof steps ◮ small(er) TCB ◮ . . .

slide-6
SLIDE 6

EasyCrypt: Languages

Typed imperative language C ::= skip skip | V = E assignment | V = $D random sampling | C; C sequence | if E then C else C conditional | while E do C while loop | V = F(E, . . . , E) procedure call Expression language:

◮ features first-class distributions α distr ◮ allows higher-order expressions ◮ is extensible

slide-7
SLIDE 7

Semantics of programs

Discrete sub-distribution transformers c : M → M distr Probability of an event Pr [c, m : E] = cm E Losslessness Pr [c, m : ⊤] = 1

slide-8
SLIDE 8

EasyCrypt: Logics

◮ Ambient higher-order logic ◮ Hoare Logic c : P =

⇒ Q

◮ Probabilistic Hoare Logic (behind compute in v0.2)

[c : P = ⇒ Q] ≤ δ [c : P = ⇒ Q] = δ [c : P = ⇒ Q] ≥ δ

◮ Probabilistic Relational Hoare Logic c1 ∼ c2 : P =

⇒ Q ☞ Logics serve complementary purposes ☞ Some overlaps, many interplays ☞ HL, pHL, pRHL embedded in ambient logic

slide-9
SLIDE 9

PRHL: intuition and preview

Judgment c1 ∼ c2 : P = ⇒ Q is valid iff for all memories m1 and m2 P m1 m2 ⇒ Q# c1m1 c2m2 Valid judgments allow deriving probability claims; eg if P m1 m2 and c1 ∼ c2 : P = ⇒ Q and Q ⇒ A1 ⇔ B2 then Pr [c1, m1 : A] = Pr [c2, m2 : B] Example rule:

c1 ∼ c : P ∧ e1 = ⇒ Q c2 ∼ c : P ∧ ¬e1 = ⇒ Q if e then c1 else c2 ∼ c : P = ⇒ Q P ⇒ e1=e′2 c1 ∼ c′

1 : P ∧ e1 =

⇒ Q c2 ∼ c′

2 : P ∧ ¬e1 =

⇒ Q if e then c1 else c2 ∼ if e′ then c′

1 else c′ 2 : P =

⇒ Q

slide-10
SLIDE 10

EasyCrypt: modules and theories

Modules (beware memory model)

◮ Instantiating generic transformations (simplified syntax)

forall &m (A <: AdvCCA), exists (B <: AdvCPA), Pr[CCA(FO(S),A) @ &m : b’ = b ] <= Pr[CPA(S,B) @ &m : b’ = b] + ....

◮ Supporting high-level reasoning steps

Theories

◮ Supports code reuse ◮ “Polymorphism” via abstract types ◮ “Quantification” via abstract operators

Plans to implement datatypes and type classes

slide-11
SLIDE 11

Provable security

Scheme

slide-12
SLIDE 12

Provable security

Scheme Primitive

slide-13
SLIDE 13

Provable security

Scheme Primitive

Generic construction

slide-14
SLIDE 14

Provable security

Scheme Primitive

Generic construction

Attack

slide-15
SLIDE 15

Provable security

Scheme Primitive

Generic construction

Attack Attack

slide-16
SLIDE 16

Provable security

Scheme Primitive

Generic construction

Attack Attack

Black-box reduction

slide-17
SLIDE 17

Provable security

Scheme Primitive

Generic construction

Attack Attack

Black-box reduction

Ideally attacks have similar execution times

slide-18
SLIDE 18

Public-key encryption

Algorithms (K, E, D), s.t.:

◮ E takes as inputs a public key and a message, and outputs

a ciphertext

◮ D takes as inputs a secret key and a ciphertext, and

  • utputs a plaintext; D may be partial

◮ if (sk, pk) is a valid key pair, Dsk(Epk(m)) = m

module type Scheme = { fun kg() : pkey ∗ skey fun enc(pk:pkey, m:plaintext) : ciphertext fun dec(sk:skey, c:ciphertext) : plaintext option }.

slide-19
SLIDE 19

Correctness

module Correct (S:Scheme) = { fun main(m:plaintext) : bool = { var pk : pkey; var sk : skey; var c : ciphertext; var m’ : plaintext option; (pk, sk) = S.kg(); c = S.enc(pk, m); m’ = S.dec(sk, c); return (m’ = Some m); } }.

[Correctness(S, I) : ⊤ = ⇒ m’=Some m] = 1

slide-20
SLIDE 20

Indistinguishability

slide-21
SLIDE 21

Indistinguishability

m0 m1

slide-22
SLIDE 22

Indistinguishability

m0 m1 $ b

slide-23
SLIDE 23

Indistinguishability

m0 m1 $ b mb

slide-24
SLIDE 24

Indistinguishability

m0 m1 $ b mb Epk c∗

slide-25
SLIDE 25

Indistinguishability

m0 m1 $ b mb Epk c∗ c∗

slide-26
SLIDE 26

Indistinguishability

m0 m1 $ b mb Epk c∗ c∗ b′

slide-27
SLIDE 27

Indistinguishability

m0 m1 $ b mb Epk c∗ c∗ b′

?

=

slide-28
SLIDE 28

Indistinguishability

m0 m1 $ b mb Epk c∗ c∗ b′

?

=

  • Pr
  • IND-CCA(A) : b′ = b
  • − 1

2

  • small
slide-29
SLIDE 29

Indistinguishability

module CPA (S:Scheme, A:Adversary) = { fun main() : bool = { var pk : pkey; var sk : skey; var m0, m1 : plaintext; var c : ciphertext; var b, b’ : bool; (pk, sk) = S.kg(); (m0, m1) = A.choose(pk); b = ${0,1}; c = S.enc(pk, b ? m1 : m0); b’ = A.guess(c); return (b’ = b); } }.

slide-30
SLIDE 30

One-way trapdoor permutations

slide-31
SLIDE 31

One-way trapdoor permutations

$

x

slide-32
SLIDE 32

One-way trapdoor permutations

$

x fpk y ⋆

slide-33
SLIDE 33

One-way trapdoor permutations

$

x fpk y ⋆ y ⋆

slide-34
SLIDE 34

One-way trapdoor permutations

$

x fpk y ⋆ y ⋆ x′

slide-35
SLIDE 35

One-way trapdoor permutations

$

x fpk y ⋆ y ⋆ x′

?

=

slide-36
SLIDE 36

One-way trapdoor permutations

$

x fpk y ⋆ y ⋆ x′

?

=

Pr

  • OW(I) : x′ = x
  • small
slide-37
SLIDE 37

One-way trapdoor permutations

module type Inverter = { fun i(pk : pkey, y : randomness) : randomness }. module OW(I :Inverter) ={ fun main() : bool ={ var x : randomness; var x’ : randomness; var pk : pkey; var sk : skey; x = $uniform_rand; (pk,sk) = $keypairs; x’ = I.i(pk,(f pk x)); return (x’ = x); } }.

slide-38
SLIDE 38

Random oracles (excerpts, and a bit of cheating)

module type Oracle = { fun init():unit fun o(x:from):to }. module type O_ext = { fun o(x:from):to }. theory ROM. module RO:Oracle = { var m : (from, to) map fun o(x:from) : to = { var y : to; y = $dsample; if (!in_dom x m) m.[x] = y; return (m.[x]); } }.

slide-39
SLIDE 39

Example: Bellare and Rogaway 1993 encryption

◮ plaintext is the type {0, 1}n of bitstrings of length n ◮ randomness is the type {0, 1}k of bitstrings of length k ◮ ciphertext is the type {0, 1}n+k of bitstrings of length n + k

fun enc(pk:pkey, m:plaintext): ciphertext = { var h, s : plaintext; var r : randomness; r = ${0, 1}k; h = H.o(r); s = m ⊕ h; return ((f pk r) || s); }

slide-40
SLIDE 40

Security

For every IND-CPA adversary A, there exists an inverter I st

  • Pr
  • IND-CPA(A) : b′ = b
  • − 1

2

  • ≤ Pr
  • OW(I) : x′ = x
  • Formal statement (omitting side conditions, simplified syntax)

forall &m (A <: Adv), exists (I <: Inverter), |Pr[CPA(BR,A).main() @ &m : b’ = b ] − (1%r / 2%r)| <= Pr[OW(I).main() @ &m : x’ = x].

slide-41
SLIDE 41

Proof

Game hopping technique

Game INDCPA : (sk, pk) = K(); (m0, m1) = A1(pk); b = ${0, 1}; c∗ = Epk (mb); b′ = A2(c∗); return (b′ = b); Encryption Epk (m) : r = ${0, 1}ℓ; h = H(r); s = h ⊕ m; c = fpk (r) s; return c; Game G : (sk, pk) = K(); (m0, m1) = A1(pk); b = ${0, 1}; c∗ = Epk (mb); b′ = A2(c∗); return (b′ = b); Encryption Epk (m) : r = ${0, 1}ℓ; h = ${0, 1}k ; s = h ⊕ m; c = fpk (r) s; return c; Game G′ : (sk, pk) = K(); (m0, m1) = A1(pk); b = ${0, 1}; c∗ = Epk (mb); b′ = A2(c∗); return (b′ = b); Encryption Epk (m) : r = ${0, 1}ℓ; s = ${0, 1}k ; h = s ⊕ m; c = fpk (r) s; return c; Game OW : (sk, pk) = K(); y = ${0, 1}ℓ; y′ = I(fpk (y)); return (y′ = y); Adversary I(x) : (m0, m1) = A1(pk); s = ${0, 1}k ; c∗ = x s; b′ = A2(c∗); y′ = [z∈LA

H |fpk (z)=x];

return y′

  • 1. For each hop

◮ prove validity of pRHL judgment ◮ derive probability claim(s)

  • 2. Obtain security bound by combining claims
  • 3. Check execution time of constructed adversary
slide-42
SLIDE 42

Conditional equivalence

Epk(m) : r = ${0, 1}ℓ; h = H(r); s = h ⊕ m; c = fpk(r) s; return c;

  • Epk(m) :

r = ${0, 1}ℓ; h = ${0, 1}k; s = h ⊕ m; c = fpk(r) s; return c; IND-CPA ∼ G : ⊤ = ⇒ (¬r ∈ LA

H)2 ⇒ ≡

  • Pr
  • IND-CPA : b′ = b
  • − Pr
  • G : b′ = b
  • ≤ Pr
  • G : r ∈ LA

H

slide-43
SLIDE 43

Equivalence

Epk(m) : r = ${0, 1}ℓ; h = ${0, 1}k; s = h ⊕ m; c = fpk(r) s; return c;

  • Epk(m) :

r = ${0, 1}ℓ; s = ${0, 1}k; h = s ⊕ m; c = fpk(r) s; return c; G ∼ G′ : ⊤ = ⇒ ≡ Pr

  • G : r ∈ LA

H

  • = Pr
  • G′ : r ∈ LA

H

  • Pr [G : b′ = b] = Pr [G′ : b′ = b] = 1

2

slide-44
SLIDE 44

Equivalence

Epk(m) : r = ${0, 1}ℓ; h = ${0, 1}k; s = h ⊕ m; c = fpk(r) s; return c;

  • Epk(m) :

r = ${0, 1}ℓ; s = ${0, 1}k; h = s ⊕ m; c = fpk(r) s; return c; G ∼ G′ : ⊤ = ⇒ ≡

  • Pr [IND-CPA : b′ = b] − 1

2

  • ≤ Pr
  • G′ : r ∈ LA

H

slide-45
SLIDE 45

Reduction

Game INDCPA : (sk, pk) = K(); (m0, m1) = A1(pk); b = ${0, 1}; c∗ = Epk(mb); b′ = A2(c∗); return (b′ = b) Encryption Epk(m) : r = ${0, 1}ℓ; s = ${0, 1}k; c = fpk(r) s; return c; Game OW : (sk, pk) = K(); y = ${0, 1}ℓ; y ′ = I(fpk(y)); return (y ′ = y); Adversary I(x) : (m0, m1) = A1(pk); b = ${0, 1}; s = ${0, 1}k; c∗ = x s; b′ = A2(c∗); y ′ = [z ∈ LA

H | fpk(z) = x];

return y ′;

G′ ∼ OW : ⊤ = ⇒ (r ∈ LA

H)1 ⇒ (y′ = y)2

Pr

  • G′ : r ∈ LA

H

  • ≤ Pr [OW(I) : y′ = y]
slide-46
SLIDE 46

Reduction

Game INDCPA : (sk, pk) = K(); (m0, m1) = A1(pk); b = ${0, 1}; c∗ = Epk(mb); b′ = A2(c∗); return (b′ = b) Encryption Epk(m) : r = ${0, 1}ℓ; s = ${0, 1}k; c = fpk(r) s; return c; Game OW : (sk, pk) = K(); y = ${0, 1}ℓ; y ′ = I(fpk(y)); return (y ′ = y); Adversary I(x) : (m0, m1) = A1(pk); b = ${0, 1}; s = ${0, 1}k; c∗ = x s; b′ = A2(c∗); y ′ = [z ∈ LA

H | fpk(z) = x];

return y ′;

G′ ∼ OW : ⊤ = ⇒ (r ∈ LA

H)1 ⇒ (y′ = y)2

  • Pr [IND-CPA(A) : b′ = b] − 1

2

  • ≤ Pr [OW(I) : y′ = y]
slide-47
SLIDE 47

Remarks

◮ In EasyCrypt v0.2, reasoning principles are “embedded ” in

pRHL proofs for the concrete construction

◮ In EasyCrypt v1, one can

☞ prove high-level principles in an abstract setting ☞ instantiate principles Benefits: much easier! Also favours ☞ libraries of verified high-level principles ☞ better proofs (shorter, faster, more robust)

slide-48
SLIDE 48

Variations on IND-CPA

For every adversary A, there exists an adversary B st

  • Pr
  • IND-CPA(A) : b′ = b
  • − 1

2

  • = Pr
  • IND-CPA(B) : b′ = b
  • − 1

2 By case analysis on Pr [IND-CPA(A) : b′ = b] ≤ 1

2 ◮ If true, then B returns the result of A ◮ If false, then B returns the negation of the result of A

slide-49
SLIDE 49

Summary

Provable security as deductive relational verification

  • f (open and parametrized) probabilistic programs

◮ EasyCrypt v1.0 is more explicit than its predecessor ◮ EasyCrypt v1.0 supports modular reasoning ◮ Shift of perspective (more instantiation, less pRHL) ◮ Should make tool more accessible to cryptographers