introduction
play

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


  1. Introduction July 16, 2013

  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

  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 open 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)

  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

  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 ◮ . . .

  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 procedure call | V = F ( E , . . . , E ) Expression language: ◮ features first-class distributions α distr ◮ allows higher-order expressions ◮ is extensible

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

  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 c 1 ∼ c 2 : P = ⇒ Q ☞ Logics serve complementary purposes ☞ Some overlaps, many interplays ☞ HL, pHL, pRHL embedded in ambient logic

  9. PRHL: intuition and preview Judgment c 1 ∼ c 2 : P = ⇒ Q is valid iff for all memories m 1 and m 2 P m 1 m 2 ⇒ Q # � c 1 � m 1 � c 2 � m 2 Valid judgments allow deriving probability claims; eg if P m 1 m 2 and c 1 ∼ c 2 : P = ⇒ Q and Q ⇒ A � 1 � ⇔ B � 2 � then Pr [ c 1 , m 1 : A ] = Pr [ c 2 , m 2 : B ] Example rule: c 1 ∼ c : P ∧ e � 1 � = ⇒ Q c 2 ∼ c : P ∧ ¬ e � 1 � = ⇒ Q if e then c 1 else c 2 ∼ c : P = ⇒ Q P ⇒ e � 1 � = e ′ � 2 � c 1 ∼ c ′ 1 : P ∧ e � 1 � = ⇒ Q c 2 ∼ c ′ 2 : P ∧ ¬ e � 1 � = ⇒ Q if e then c 1 else c 2 ∼ if e ′ then c ′ 1 else c ′ 2 : P = ⇒ Q

  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

  11. Provable security Scheme

  12. Provable security Primitive Scheme

  13. Provable security Primitive Generic construction Scheme

  14. Provable security Primitive Generic construction Scheme Attack

  15. Provable security Primitive Attack Generic construction Scheme Attack

  16. Provable security Primitive Attack Generic Black-box construction reduction Scheme Attack

  17. Provable security Primitive Attack Generic Black-box construction reduction Scheme Attack Ideally attacks have similar execution times

  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 outputs a plaintext; D may be partial ◮ if ( sk , pk ) is a valid key pair, D sk ( E pk ( m )) = m module type Scheme = { fun kg() : pkey ∗ skey fun enc(pk:pkey, m:plaintext) : ciphertext fun dec(sk:skey, c:ciphertext) : plaintext option }.

  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); } }. ⇒ m’=Some m ] = 1 [ Correctness ( S , I ) : ⊤ =

  20. Indistinguishability

  21. Indistinguishability m 0 m 1

  22. Indistinguishability $ b m 0 m 1

  23. Indistinguishability m b $ b m 0 m 1

  24. Indistinguishability m b E pk $ b c ∗ m 0 m 1

  25. Indistinguishability m b E pk $ b c ∗ m 0 c ∗ m 1

  26. Indistinguishability m b E pk $ b c ∗ m 0 b ′ c ∗ m 1

  27. Indistinguishability m b E pk $ b c ∗ ? = m 0 b ′ c ∗ m 1

  28. Indistinguishability m b E pk $ b c ∗ ? = m 0 b ′ c ∗ m 1 � − 1 � IND-CCA ( A ) : b ′ = b � � � � small � Pr � � 2 �

  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); } }.

  30. One-way trapdoor permutations

  31. One-way trapdoor permutations $ x

  32. One-way trapdoor permutations $ f pk y ⋆ x

  33. One-way trapdoor permutations $ f pk y ⋆ x y ⋆

  34. One-way trapdoor permutations $ f pk y ⋆ x y ⋆ x ′

  35. One-way trapdoor permutations $ f pk y ⋆ x ? = y ⋆ x ′

  36. One-way trapdoor permutations $ f pk y ⋆ x ? = y ⋆ x ′ OW ( I ) : x ′ = x � � small Pr

  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); } }.

  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]); } }.

  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); }

  40. Security For every IND-CPA adversary A , there exists an inverter I st � − 1 � IND-CPA ( A ) : b ′ = b OW ( I ) : x ′ = x � � � � � � � ≤ Pr � Pr � � 2 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].

  41. Proof Game hopping technique Game G ′ : Game OW : Game INDCPA : Game G : ( sk , pk ) = K (); ( sk , pk ) = K (); ( sk , pk ) = K (); ( sk , pk ) = K (); y = $ { 0 , 1 } ℓ ; ( m 0 , m 1 ) = A 1 ( pk ); ( m 0 , m 1 ) = A 1 ( pk ); ( m 0 , m 1 ) = A 1 ( pk ); y ′ = I ( f pk ( y )); b = $ { 0 , 1 } ; b = $ { 0 , 1 } ; b = $ { 0 , 1 } ; c ∗ = E pk ( m b ); c ∗ = E pk ( m b ); c ∗ = E pk ( m b ); return ( y ′ = y ); b ′ = A 2 ( c ∗ ); b ′ = A 2 ( c ∗ ); b ′ = A 2 ( c ∗ ); Adversary I ( x ) : return ( b ′ = b ); return ( b ′ = b ); return ( b ′ = b ); ( m 0 , m 1 ) = A 1 ( pk ); s = $ { 0 , 1 } k ; Encryption E pk ( m ) : Encryption E pk ( m ) : Encryption E pk ( m ) : c ∗ = x � s ; r = $ { 0 , 1 } ℓ ; r = $ { 0 , 1 } ℓ ; r = $ { 0 , 1 } ℓ ; b ′ = A 2 ( c ∗ ); h = $ { 0 , 1 } k ; s = $ { 0 , 1 } k ; h = H ( r ); y ′ = [ z ∈ L A s = h ⊕ m ; s = h ⊕ m ; h = s ⊕ m ; H | f pk ( z )= x ]; c = f pk ( r ) � s ; c = f pk ( r ) � s ; c = f pk ( r ) � s ; return y ′ return c ; return c ; return c ; 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

  42. Conditional equivalence E pk ( m ) : E pk ( m ) : r = $ { 0 , 1 } ℓ ; r = $ { 0 , 1 } ℓ ; h = H ( r ); h = $ { 0 , 1 } k ; � s = h ⊕ m ; s = h ⊕ m ; c = f pk ( r ) � s ; c = f pk ( r ) � s ; return c ; return c ; ⇒ ( ¬ r ∈ L A IND-CPA ∼ G : ⊤ = H ) � 2 � ⇒ ≡ IND-CPA : b ′ = b G : b ′ = b � � � ≤ Pr G : r ∈ L A � � � � �� − Pr � Pr H

Recommend


More recommend