Code Monkey home page Code Monkey logo

easycrypt's Introduction

EasyCrypt: Computer-Aided Cryptographic Proofs

Build Status

EasyCrypt is a toolset for reasoning about relational properties of probabilistic computations with adversarial code. Its main application is the construction and verification of game-based cryptographic proofs.

Table of Contents

Installation requirements

EasyCrypt uses the following third-party tools/libraries:

On POSIX/Win32 systems (GNU/Linux, *BSD, OS-X), we recommend that users install EasyCrypt and all its dependencies via opam.

Installing OPAM (POSIX systems)

Opam can be easily installed from source or via your packages manager:

  • On Ubuntu and derivatives:

    $> add-apt-repository ppa:avsm/ppa
    $> apt-get update
    $> apt-get install ocaml ocaml-native-compilers camlp4-extra opam
    
  • On Fedora/OpenSUSE:

    $> sudo dnf update
    $> sudo dnf install ocaml ocaml-docs ocaml-camlp4-devel opam
    
  • On MacOSX using brew:

    $> brew install ocaml opam
    

Once opam and ocaml has been successfully installed run the following:

$> opam init
$> eval $(opam env)

For any issues encountered installing opam see:

To install opam on non-POSIX systems see the section below.

Installing requirements using OPAM 2 (POSIX systems)

You can install all the needed dependencies via the opam OCaml packages manager.

  1. Optionally, switch to a dedicated compiler for EasyCrypt:

    $> opam switch create easycrypt $OVERSION
    

    where $OVERSION is a valid OCaml version (e.g. ocaml-base-compiler.4.07.0)

  2. Add the EasyCrypt repository:

    $> opam repository add easycrypt git://github.com/EasyCrypt/opam.git
    $> opam update
    
  3. Optionally, select the EasyCrypt (git) branch you want to use:

    $> opam pin -n add easycrypt https://github.com/EasyCrypt/easycrypt.git#branch
    

    where branch is the branch name you want to use (e.g. aprhl).

    In that case, we advise you to create a dedicated opam switch (see first step above).

  4. Optionally, use opam to install the system dependencies:

    $> opam install depext
    $> opam depext easycrypt
    
  5. Add the EasyCrypt meta-packages:

    $> opam install --deps-only easycrypt
    $> opam install ec-provers
    

    Provers may require external dependencies. You can install then directly using opam:

    $> opam install depext       # if not already done
    $> opam depext ec-provers
    

    If you get errors about ocamlbuild failing because it's already installed, the check can be skipped with the following:

    CHECK_IF_PREINSTALLED=false opam install --deps-only easycrypt
    

Installing requirements using OPAM (non-POSIX systems)

You can install all the needed dependencies via the opam OCaml packages manager.

  1. Install the opam Ocaml packages manager, following the instructions at:

    https://fdopen.github.io/opam-repository-mingw/installation/

  2. Add the EasyCrypt repository:

    $> opam repository add easycrypt git://github.com/EasyCrypt/opam.git
    $> opam update
    
  3. Optionally, select the EasyCrypt (git) branch you want to use:

    $> opam pin -n add easycrypt https://github.com/EasyCrypt/easycrypt.git#branch
    

    where branch is the branch name you want to use (e.g. aprhl).

  4. Use opam to install the system dependencies:

    $> opam install depext depext-cygwinports
    $> opam depext easycrypt
    
  5. Add the EasyCrypt meta-packages:

    $> opam install --deps-only easycrypt
    $> opam install alt-ergo
    
  6. You can download extra provers at the following URLs:

Configuring Why3

Before running EasyCrypt and after the installation/removal/update of an SMT prover, you need to (re)configure Why3.

$> why3 config --detect

EasyCrypt is using the default Why3 location, i.e. ~/.why3.conf. If you have several versions of Why3 installed, it may be impossible to share the same configuration file among them. EasyCrypt via the option -why3, allows you to load a Why3 configuration file from a custom location. For instance:

$> why3 config --detect -C $WHY3CONF.conf
$> ./ec.native -why3 $WHY3CONF.conf

where $WHY3CONF must be replaced by some custom location.

Installing/Compiling EasyCrypt

If installing from source, running

$> make
$> make install

builds and install EasyCrypt (under the binary named easycrypt), assuming that all dependencies have been successfully installed. If you choose not to install EasyCrypt system wide, you can use the binary ec.native that is located at the root of the source tree.

It is possible to change the installation prefix by setting the environment variable PREFIX:

$> make PREFIX=/my/prefix install

EasyCrypt comes also with an opam package. Running

$> opam install easycrypt

installs EasyCrypt and its dependencies via opam. In that case, the EasyCrypt binary is named easycrypt.

Proof General Front-End

Installing using opam

If you installed the EasyCrypt dependencies using opam, you can install ProofGeneral via opam too. Running

$> opam install proofgeneral

installs ProofGeneral along with its EasyCrypt mode. You still have to tweak your emacs configuration file (~/.emacs) to load ProofGeneral by adding the following line to it

(load-file "$proof-general-home/generic/proof-site.el")

where $proof-general-home should be replaced by

$prefix/share/proofgeneral

with $prefix being set to the output of

$> opam config var prefix

Installing from sources

EasyCrypt mode has been integrated upstream. Please, go to https://github.com/ProofGeneral/PG and follow the instructions.

easycrypt's People

Contributors

strub avatar bgregoir avatar fdupress avatar coonz avatar jmcrespo avatar martinceresa avatar beschmi avatar s-zanella avatar alleystoughton avatar davyg2 avatar gbarthe avatar antoinesere avatar ruette avatar gramosg avatar asifmallik avatar akoutsos avatar cohencyril avatar lordqwerty avatar vbgl avatar nitrogl avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.