Skip to content
KreMLin is a tool for extracting low-level F* programs to readable C code
OCaml F* C Makefile JavaScript C++ Other
Branch: master
Clone or download

Latest commit

Latest commit a174685 May 31, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
.docker/build try to fix the build May 19, 2020
book Try refreshing hints Apr 8, 2020
include Relax uint128 auto-detection following suggestion from @glandium May 6, 2020
kremlib Support for the secure zeroing primitive in WASM, too May 11, 2020
lib Fix build for OCaml 4.04.0 Oct 17, 2019
misc Allow a set of blacklisted files for Makefile.basic Apr 14, 2020
parser New rename-prefix option Jan 28, 2020
runtime Support for the secure zeroing primitive in WASM, too May 11, 2020
src Missed a case in one recursive descent -- important because this pass… May 31, 2020
test Merge remote-tracking branch 'origin/vdum_ctypes_fixes' May 8, 2020
.clang-format Finish implementation of FStar_Bytes Nov 20, 2017
.gitattributes Don't show hints in diffs Jul 9, 2019
.gitignore Check in the introduction for the tutorial Apr 24, 2018
.gitmodules Update README Oct 14, 2016
.merlin Merge branch 'master' of into vdum_ctypes Jul 12, 2019
.odocl Fix the build? Jun 8, 2017 New rename-prefix option Jan 28, 2020 Expand Feb 10, 2017
LICENSE Nits about license Oct 13, 2016
Makefile Compiles Jan 27, 2020 Update wasm package version Apr 30, 2020
_tags Fixup a few things related to tests Mar 13, 2020
build_local.ps1 Add build local powershell to build on windows client Mar 12, 2019 Fix and simplify; partially fixes VSTS bug 81 Jun 19, 2019 Prototype of in-memory struct allocation for the WASM backend... curr… Jun 9, 2017


Linux Windows
Linux Windows

KreMLin is a tool that extracts an F* program to readable C code. If the F* program verifies against a low-level memory model that talks about the stack and the heap; if it is first-order; if it obeys certain restrictions (e.g. non-recursive data types) then KreMLin will turn it into C.

The best way to learn about KreMLin is its work-in-progress tutorial. Pull requests and feedback are welcome!

  • has a technical overview of the different transformation passes performed by KreMLin, and is slightly out of date.

This work has been formalized on paper. We state that the compilation of such F* programs to C preserves semantics. We start from Low*, a subset of F*, and relate its semantics to CompCert's Clight.

  • the ICFP 2017 Paper provides an overview of KreMLin as well as a paper formalization of our compilation toolchain

We have written 20,000 lines of low-level F* code, implementing the TLS 1.3 record layer. As such, KreMLin is a key component of Project Everest.

  • HACL*, our High Assurance Crypto Library, provides numerous cryptographic primitives written in F*; these primitives enjoy memory safety, functional correctness, and some degree of side-channel resistance -- they extract to C via KreMLin.

Trying out KreMLin

KreMLin requires OCaml (>= 4.05.0, < 4.10.0), OPAM, and a recent version of GNU make.

Regarding GNU make: On OSX, this may require you to install a recent GNU make via homebrew, and invoke gmake instead of make.

Regarding OCaml: Install OPAM via your package manager, then:

$ opam install ppx_deriving_yojson zarith pprint menhir sedlex process fix wasm.1.0.1 visitors ctypes-foreign ctypes

Next, make sure you have an up-to-date F*, and that you ran make in the ulib/ml directory of F*. The fstar.exe executable should be on your PATH and FSTAR_HOME should point to the directory where F* is installed.

To build just run make from this directory.

Note: on OSX, KreMLin is happier if you have greadlink installed (brew install coreutils).

If you have the right version of F* and fstar.exe is in your PATH then you can run the KreMLin test suite by doing make test.

File a bug if things don't work!


The --help flag contains a substantial amount of information.

$ ./krml --help


Kremlin is released under the Apache 2.0 license; see LICENSE for more details.

You can’t perform that action at this time.