Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

C Documentation

Tony Arcieri edited this page Dec 29, 2017 · 6 revisions

No implementation of Miscreant in C is presently available, however the Rust implementation of Miscreant exposes a C ABI which can be used in conjunction with C/C++ projects:

https://github.com/miscreant/miscreant/tree/master/rust

This guide will take you through installing Rust, building the Rust implementation of Miscreant as a static library, and provide an overview of the C API/ABI.

Installing Rust

You will need the Rust nightly toolchain. This can be installed with:

$ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly

For more information on installing Rust, please see https://rustup.rs/

Building a Miscreant static library

After installing Rust, clone the Miscreant repo:

$ git clone [email protected]:miscreant/miscreant.git

Inside of the rust/ subdirectory of this repo, run the following command to build libmiscreant.a:

cargo build --no-default-features --features=staticlib --release

This will create target/release/libmiscreant.a which exposes a C ABI and has no runtime dependencies. Link it as you normally would any static library, e.g.

cc -o myprog myprog.c libmiscreant.a

The Miscreant Rust FFI tests include an example Makefile for a Miscreant C project.

Clone this wiki locally