EasyCrypt and Jasmin tutorial in Šibenik
This page is meant as an index to the helper material for the Summer School lecture on Machine-Checked Cryptography with EasyCrypt and Jasmin, which will take place on June 16th.
Contributors: Manuel Barbosa, François Dupressoir, Benjamin Grégoire, Vincent Laporte, Pierre-Yves Strub, Tiago Oliveira
Documentation
doc/slides.pdfcontains the presentation which explains the example and exercisesdoc/cheatsheet.pdfcontains a new EasyCrypt cheat sheetdoc/jasmin.jazzis a Jasmin file recalling the main syntactic features of the languagedoc/regptr.jazzanddoc/regptr.sexplain the newreg ptrfeature that permits passing around references to stack regions.
Jasmin Files
src/example/NbAESEnc.jazzis a Jasmin implementation of AES-based NbPRFEnc with register-based calling conventionsrc/example/NbAESEnc_mem.jazzis a Jasmin implementation of AES-based NbPRFEnc with memory-based calling conventionsrc/aeslib/aes.jincis reusable code for AES-NI in Jasminsrc/aeslib/aes.jazzis the export interface for AES-NI in Jasmin
EasyCrypt Files
Folder proof/example contains the EasyCrypt specs and proofs for the example:
.dir-locals.el: Emacs EasyCrypt mode configuration file to extend include pathPRFth.eca: formalization of pseudorandom functionNbEnc.eca: formalization of syntax, correctness and security of nonce-based encryptionNbPRFEnc.ec: nonce-based encryption from a PRF (the main example)NbAESEnc_proof.ec: Correctness and security proof for Jasmin implementation with register calling convention wrt toNbPRFEnc.ecNbAESEnc_ct_proof.ec: Constant-time proof for Jasmin implementation with register calling conventionNbAESEnc_mem_proof.ec: Correctness proof for Jasmin implementation with memory calling convention wrt toNbPRFEnc.ecNbAESEnc_mem_ct_proof.ec: Constant-time proof for Jasmin implementation with memory calling conventionRPth.eca: formalization of a random permutation (for exercises)PRPth.eca: formalization of pseudorandom permutation and RF/RP switching lemma (for exercises)
Folder proof/aeslib contains the EasyCrypt specs and proofs for AES-NI:
.dir-locals.el: Emacs EasyCrypt mode configuration file to extend include pathAES_spec.ec: AES specification in both functional and imperative style, equivalence between the twoAES_proof.ec: Correctness proof for Jasmin implementation of AES wrt toAES_spec.ecAES_ct_proof.ec: Constant-time proof for Jasmin implementation of AES
Folder extraction contains the EasyCrypt code that is automatically generated from the Jasmin souces (the correctness and constant-time proofs then import these files):
extraction/example/NbAESEnc_jazz.ec: EasyCrypt code extracted fromsrc/example/NbAESEnc.jazzextraction/example/NbAESEnc_jazz_ct.ec: EasyCrypt code extracted fromsrc/example/NbAESEnc.jazzfor constant-time proofextraction/example/NbAESEnc_mem_jazz.ec: EasyCrypt code extracted fromsrc/example/NbAESEnc.jazzextraction/example/NbAESEnc_mem_jazz_ct.ec: EasyCrypt code extracted fromsrc/example/NbAESEnc.jazzfor constant-time proofextraction/aeslib/AES_jazz.ec: EasyCrypt code extracted fromsrc/aeslib/aes.jazzextraction/aeslib/AES_jazz_ct.ec: EasyCrypt code extracted fromsrc/aeslib/aes.jazzfor constant-time proof- Additional files generated by the Jasmin compilers for array types also appear in this folder.
Folder test contains the wrapper C files for executing the Jasmin examples:
test_NbAESEnc.c: C program to testNbAESEnc.sgenerated fromsrc/example/NbAESEnc.jazztest_NbAESEnc_mem.c: C program to testNbAESEnc_mem.sgenerated fromsrc/example/NbAESEnc_mem.jazztest_aes.c: C program to testaes.sgenerated fromsrc/aeslib/aes.jazz
Folder installation constains Docker and shell scripts to set up your own EasyCrypt and Jasmin environments.
A pre-built Docker image with only the command-line tools can also be found here.
How-to
Make sure to edit the Makefile so that it can find easycrypt and jasminc.
Then, from root directory:
make cleanremoves olds filesmake allbuilds tests and extracts EasyCrypt codemake safetychecks Jasmin code for safetymake testexecutes the testsmake proofsuses EasyCrypt to check all proofsmake checkrunssafety,testandproofsin one go
Calling Jasmin libraries from other programming languages
- From C: examples in the
testdirectory, compilation instructions in theMakefile - From Rust: example and compilation instructions in the
bindings/rustdirectory - From Python 3: example and compilation instructions in the
bindings/pythondirectory - From OCaml: example and compilation instructions in the
bindings/ocamldirectory
Fun Stuff
- Folder
qproofincludes the same example proof extended to cover quantum adversaries. These scripts can be checked using EasyCrypt branchdeploy-quantum. Can you spot the differences?
Getting support
The Formosa Zulip Server is the place to go. There is already a significant Q\&A back-log and your questions usually get answers in a short time.
Background reading
- Introduction to Hoare Logic by Umang Mathur
- Introduction to Provable Security by Michel Abdalla
Prior editions of the tutorial
- SAC 2021
- Indocrypt 2020 - Here is the accompanying video