Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update C extraction tools to current main #809

Merged
merged 7 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .docker/c/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ ENV HACL_HOME=$HOME/hacl-star
ENV KRML_HOME=$HOME/karamel
ENV EURYDICE_HOME=$HOME/eurydice
ENV CHARON_HOME=$HOME/charon
ENV KRML_REV=97a06e07e7e423df192c40d5a88bf6c85fd4d278
ENV EURYDICE_REV=b8ea420ccde8db516ced5db9c097d77fa558fb94
ENV CHARON_REV=30cab88265206f4fa849736e704983e39a404d96
ENV KRML_REV=1d81d757d5d9e16dd6463ccc72324e587c707959
ENV EURYDICE_REV=788c5abefac3a9c7f79abae6a30fa8558e39764c
ENV CHARON_REV=a8f2211d1b95e0462a96382023b164a4116c7ca4
ENV PATH="${PATH}:$HOME/fstar/bin:$HOME/z3/bin"

# Setup & install.
Expand Down
25 changes: 25 additions & 0 deletions extract-c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -e

# Extract
sudo docker pull ghcr.io/cryspen/libcrux-c:unstable
sudo docker run -v $PWD:/home/user/libcrux \
--rm ghcr.io/cryspen/libcrux-c:unstable bash \
-c "cd libcrux/libcrux-ml-kem && ./boring.sh && cargo clean && ./c.sh && cd ../libcrux-ml-dsa && ./boring.sh"

# Build & test
cd libcrux-ml-kem/c
LIBCRUX_BENCHMARKS=1 CC=clang-18 CXX=clang++-18 cmake -B build -G "Ninja Multi-Config"
cmake --build build
./build/Debug/ml_kem_test

cd ../cg
LIBCRUX_BENCHMARKS=1 CC=clang-18 CXX=clang++-18 cmake -B build -G "Ninja Multi-Config"
cmake --build build
./build/Debug/ml_kem_test

cd ../../libcrux-ml-dsa/cg
CC=clang-18 CXX=clang++-18 cmake -B build -G "Ninja Multi-Config"
cmake --build build
./build/Debug/ml_dsa_test
8 changes: 4 additions & 4 deletions libcrux-ml-dsa/cg/code_gen.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This code was generated with the following revisions:
Charon: 30cab88265206f4fa849736e704983e39a404d96
Eurydice: b8ea420ccde8db516ced5db9c097d77fa558fb94
Karamel: 97a06e07e7e423df192c40d5a88bf6c85fd4d278
Charon: a8f2211d1b95e0462a96382023b164a4116c7ca4
Eurydice: 60f543ddc60a777138070968daaf7620ec48170d
Karamel: 1d81d757d5d9e16dd6463ccc72324e587c707959
F*: b0961063393215ca65927f017720cb365a193833-dirty
Libcrux: 15b22d1beea1cc7052b8a68b653b012241724664
Libcrux: 072dd6530cbd58bb23ba8e0fabab8141aa9de3b7
8 changes: 4 additions & 4 deletions libcrux-ml-dsa/cg/header.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* SPDX-License-Identifier: MIT or Apache-2.0
*
* This code was generated with the following revisions:
* Charon: 30cab88265206f4fa849736e704983e39a404d96
* Eurydice: b8ea420ccde8db516ced5db9c097d77fa558fb94
* Karamel: 97a06e07e7e423df192c40d5a88bf6c85fd4d278
* Charon: a8f2211d1b95e0462a96382023b164a4116c7ca4
* Eurydice: 60f543ddc60a777138070968daaf7620ec48170d
* Karamel: 1d81d757d5d9e16dd6463ccc72324e587c707959
* F*: b0961063393215ca65927f017720cb365a193833-dirty
* Libcrux: 15b22d1beea1cc7052b8a68b653b012241724664
* Libcrux: 072dd6530cbd58bb23ba8e0fabab8141aa9de3b7
*/
Loading
Loading