• Stars
    star
    197
  • Rank 197,722 (Top 4 %)
  • Language
    OCaml
  • License
    BSD 3-Clause "New...
  • Created about 8 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Flexible and Constant Time Programming Language

FaCT

This is the compiler for the Flexible and Constant Time cryptographic programming language. FaCT is a domain-specific language that aids you in writing constant-time code for cryptographic routines that need to be free from timing side channels.

Useful links:

Building

To build the compiler, you can either build from source or download a pre-built release. We recommend building from source if possible.

Virtual machine image

You can download a VM image pre-configured for building the FaCT compiler and case studies. The file fact.ova should have a SHA256 sum of 089398c85c5074d911c2f2b67ca22df453235e8733f1eb283c71717cf70f714c.

Using Docker

If you have docker installed, you can load our docker image with the build environment already installed:

cd docker/
./run.sh

Once inside the docker shell, run the following to finish setting up the environment:

cd FaCT/
eval $(opam config env)

Setting up the build environment

FaCT is developed using OCaml 4.06.0 and LLVM 6.0.

Using a local environment

Building FaCT has been tested on Ubuntu 16.04, 18.04, and macOS.

1. Install System Dependencies

Ubuntu (16.04 & 18.04)

sudo apt install llvm-6.0 clang-6.0 cmake libgmp-dev m4 pkg-config

macOS

These instructions require Homebrew

brew install cmake gmp m4 pkg-config
brew install llvm@6 --with-toolchain

Note: This does not put the proper version of clang on your PATH. You will need to run:

export PATH="$(brew --prefix llvm@6)/bin:$PATH"

2. Install OCaml + packages

We recommend installing the opam package manager to manage OCaml and package dependencies:

sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)

Then, install OCaml and the libraries:

opam init
eval $(opam config env)
opam switch create 4.06.0
eval $(opam config env)
opam switch import ocamlswitch.txt

Finally, make sure the Z3 lib is available to the OCaml compiler:

export LD_LIBRARY_PATH="$HOME/.opam/4.06.0/lib/z3:$LD_LIBRARY_PATH"

3. Configure Paths

The FaCT compiler depends on the LLVM 6.0 toolchain at runtime, and expects binaries with -6.0 suffixes. Ensure that clang-6.0 is in your PATH:

clang-6.0 --version

Compiling FaCT

You can now build the compiler:

oasis setup
make

This will produce the factc executable.

Usage

Basic Usage

Run ./factc <source files> to compile a FaCT program.

Link to a C library

FaCT is designed to be called from C code. Compiling FaCT source files will output an object file, which can then be linked to a C file. As an example:

cd example/
../factc -generate-header example.fact
clang-6.0 -c main.c
clang-6.0 -o final main.o example.o

You can then run the executable:

./final

Debugging

Many debugging options and intermediate data structures are available. Run ./factc -help for all options.

Acknowledgements

We thank the anonymous PLDI and PLDI AEC reviewers for their suggestions and insightful comments.

More Repositories

1

haybale

Symbolic execution of LLVM IR with an engine written in Rust
Rust
524
star
2

rlbox

RLBox sandboxing framework
C++
283
star
3

sys

Sys: A Static/Symbolic Tool for Finding Good Bugs in Good (Browser) Code
LLVM
220
star
4

veriwasm

SFI verifier of Wasm binaries
Rust
79
star
5

lio

Labeled IO Library
Haskell
54
star
6

haybale-pitchfork

Verifying constant-time code with symbolic execution
Rust
42
star
7

ct-wasm

Constant-Time WebAssembly
24
star
8

wave

Verified Wasm runtime
Rust
20
star
9

swivel

HTML
16
star
10

cargo-scan

A tool for auditing Rust crates
Rust
13
star
11

rlbox_lucet_sandbox

RLbox integration to leverage WASM sandboxes compiled lucet
C++
12
star
12

pitchfork-angr

Python
12
star
13

rlbox_wasm2c_sandbox

C++
11
star
14

vera

JavaScript
11
star
15

veriwasm-verification

Coq proof for Veriwasm
Coq
9
star
16

bindings

Exploits from the Finding and Preventing Bugs in JavaScript Bindings paper
JavaScript
9
star
17

blade

Benchmarks for the Blade paper
C
8
star
18

ms-wasm

MS-Wasm: Soundly Enforcing Memory-Safe Execution of Unsafe Code. Build and reproduce the results from the paper.
7
star
19

haskell-boolector

Haskell bindings for the Boolector SMT solver
Haskell
5
star
20

scooter

Rust
5
star
21

ct-wasm-ports

WebAssembly
5
star
22

hfi-root

C
4
star
23

rlbox-book

C++
3
star
24

go2wrk

a small heavy duty http/https benchmark tool written in go
Go
3
star
25

cse227-spring22

Makefile
2
star
26

cse291-fall16

CSE 291, Fall 2016
HTML
2
star
27

lucet-spectre

Rust
2
star
28

paper_template

A template deian doesn't like for papers
Python
2
star
29

inline-fact

Inline FaCT in Haskell
Haskell
2
star
30

zerocost_root

Root repo for zerocost testing
HTML
2
star
31

cse127-website

HTML
2
star
32

wasmtime-spectre

Rust
2
star
33

frankie

Simple well-typed Haskell webserver and routing framework
Haskell
1
star
34

rlbox_wamr_sandbox

RLBox integration to leverage WASM sandboxes compiled with WAMR
C++
1
star
35

CTFFI

Python FFI for FaCT
Python
1
star
36

simple_library_example

Small library example. Good example for porting to rlbox and testing features
C++
1
star
37

wasm2c_sandbox_compiler

The WebAssembly Binary Toolkit
C++
1
star
38

ct-wasm-chromium

Instructions and resources for building chromium with support for CT-Wasm
1
star
39

cse291-spring21

Makefile
1
star
40

wasm-beyond-the-browser

A site for the workshop at Berkeley
HTML
1
star
41

mswasm-llvm

LLVM fork for producing MS-Wasm
C++
1
star
42

tasty-gradescope

Generate GradeScope score summaries from Tasty tests
Haskell
1
star
43

cse130-winter17

CSE 130 Winter 2017 course repo
HTML
1
star
44

rustc-cet

Rust
1
star
45

node

Fork of node using the safe V8 API to address binding bugs
JavaScript
1
star
46

hostcall_instrumented_wasmtime

wasmtime instrumented with hw timers at the hostcall boundary to measure I/O latency
Rust
1
star
47

ct-wasm-proofs

Proofs about the soundness and timing properties of CT-Wasm
Isabelle
1
star