Jasmin
Time:
9:00 — 12:30, Wednesday, September 4, 2024
Location:
Ballroom Level — 503
Speaker:
Miguel Quaresma
Abstract:
Jasmin is a programming language designed to implement low-level, high-speed, high-assurance cryptography. It provides a high degree of control over the generated assembly, allowing fine-grained optimization while still being suitable for verification and automatic analysis. It supports different target architectures, such as x86_64 and ARMVv7 (experimental), with ongoing work focused on adding support for more architectures.
Several cryptographic primitives, such as SHA3, poly1305, chacha20, salsa20, Kyber512, and Kyber768, have been implemented using Jasmin. By using the Jasmin compiler to extract EasyCrypt models of these implementations, we can formally prove security and functional correctness of the very assembly that gets executed. The Jasmin compiler includes several features that aid in developing secure cryptographic code by avoiding common pitfalls. For example, it includes a safety checker to ensure that array accesses are in bounds and that there are no divisions by zero. Additionally, it provides a cryptographic constant time checker that calculates the timing side-channel leakage of a program, even under speculative execution. Furthermore, if a program is constant time at the source (Jasmin) level, the compiler is proven not to apply any optimizations or modifications that would introduce timing side-channels. The compiler is formally verified in Coq, which means that the functional correctness properties of Jasmin programs also hold in the assembly. This tutorial will give an overview of the Jasmin environment: how the language, compiler, EasyCrypt proof assistant, and the safety and CCT checkers work together and what guarantees they provide.
To do this, we will go through examples to see how:
- the abstractions in Jasmin provide flexibility and structure to assembly programming;
- the low-level aspects of Jasmin ensure we donāt compromise on efficiency or security;
- the safety checker ensures memory safety and the absence of arithmetic errors automatically, and the compiler preserves these properties;
- the constant time checker extracts the side-channel leakage of a program, using different models of leakage (just branches, cache, operators) and execution (sequential and different variants of speculation);
- Jasmin allows applying low-level mitigations such as Selective Speculative Load Hardening cohesively and in a principled manner;
- EasyCrypt relates implementations with their abstract mathematic specifications and can check proofs of arbitrary security properties. We conclude by briefly examining Libjade, a library of cryptographic primitives written in Jasmin. Libjade contains reference and vectorized (i.e., AVX2) implementations of several cryptographic primitives.
Requirements/Prerequisites:
Attendees are expected to be familiar with the C programming language.
Additionally, in order to speed up the setup process, Docker should be installed prior to the tutorial1 and the following (Docker) image pulled: miguelmirq/jasmin101.
1 On ARM-based Macbooks, make sure the following options are set in the Docker settings: