Revision 2e3a61867b06283c10486a4864aa5f624b1cfd47 authored by Benjamin Gregoire on 04 September 2019, 13:31:51 UTC, committed by Benjamin Gregoire on 04 September 2019, 13:31:51 UTC
1 parent 84dc271
CCA.eca
(* --------------------------------------------------------------------
* Copyright (c) - 2012--2016 - IMDEA Software Institute
* Copyright (c) - 2012--2018 - Inria
* Copyright (c) - 2012--2018 - Ecole Polytechnique
*
* Distributed under the terms of the CeCILL-B-V1 license
* -------------------------------------------------------------------- *)
require import Bool Core FSet.
require (*--*) DBool NewSKE.
clone include NewSKE.
module type CCA = {
proc enc(p: plain): cipher option
proc dec(c: cipher): plain option
}.
module type Adv_CCA (O : CCA) = {
proc choose(): plain * plain
proc guess(c: cipher): bool
}.
module IND_CCA ( S : SKE, A : Adv_CCA) = {
module O = Wrap(S)
module A = A(O)
proc main(): bool = {
var b, b', c, p0, p1, p;
O.init();
(p0,p1) = A.choose();
b = ${0,1};
p = b ? p1 : p0; (* FIXME: need to check whether plaintexts are both valid or both invalid *)
c = O.enc(p);
b' = A.guess(oget c);
return (b = b' /\ !mem Wrap.dqs (oget c)); (* Penalty-style *)
}
}.
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...