diff --git a/libcrux-ml-kem/pqcp/.gitignore b/libcrux-ml-kem/pqcp/.gitignore new file mode 100644 index 000000000..72f092ff8 --- /dev/null +++ b/libcrux-ml-kem/pqcp/.gitignore @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 +# (TODO customize .gitignore for project) + +.vscode +.idea +/target +Cargo.lock diff --git a/libcrux-ml-kem/pqcp/Cargo.toml b/libcrux-ml-kem/pqcp/Cargo.toml new file mode 100644 index 000000000..e23a5f4da --- /dev/null +++ b/libcrux-ml-kem/pqcp/Cargo.toml @@ -0,0 +1,45 @@ +[package] +name = "libcrux-ml-kem" +version = "0.0.2-pre.2" +authors = ["Cryspen"] +license = "Apache-2.0" +homepage = "https://github.com/cryspen/libcrux" +edition = "2021" +repository = "https://github.com/cryspen/libcrux" +readme = "Readme.md" +exclude = ["/tests", "/implementation_notes.pdf"] + +[dependencies] +rand_core = { version = "0.6" } +libcrux-platform = { git = "https://github.com/cryspen/libcrux", version = "0.0.2-pre.2", branch = "dev" } +libcrux-sha3 = { git = "https://github.com/cryspen/libcrux", version = "0.0.2-pre.2", branch = "dev" } +libcrux-intrinsics = { git = "https://github.com/cryspen/libcrux", version = "0.0.2-pre.2", branch = "dev" } + +# This is only required for verification. +# The hax config is set by the hax toolchain. +[target.'cfg(hax)'.dependencies] +hax-lib = { git = "https://github.com/hacspec/hax/" } + +[features] +default = ["std"] +simd128 = ["libcrux-sha3/simd128"] +simd256 = ["libcrux-sha3/simd256"] +tests = [] # Test utilities. DO NOT USE. +std = [] + +[dev-dependencies] +rand = { version = "0.8" } +serde_json = { version = "1.0" } +serde = { version = "1.0", features = ["derive"] } +hex = { version = "0.4.3", features = ["serde"] } +criterion = "0.5" +libcrux-ml-kem = { path = ".", features = ["tests"] } + +[[bench]] +name = "ml-kem" +harness = false + +[profile.release] +lto = "fat" +codegen-units = 1 +panic = "abort" diff --git a/libcrux-ml-kem/pqcp/allowlist.txt b/libcrux-ml-kem/pqcp/allowlist.txt new file mode 100644 index 000000000..1ffdbd5e4 --- /dev/null +++ b/libcrux-ml-kem/pqcp/allowlist.txt @@ -0,0 +1,7 @@ +build.rs +examples +src +tests +benches +pqcp/Cargo.toml +pqcp/.gitignore diff --git a/libcrux-ml-kem/update-pqcp.sh b/libcrux-ml-kem/update-pqcp.sh new file mode 100755 index 000000000..d5b6b84a9 --- /dev/null +++ b/libcrux-ml-kem/update-pqcp.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# +# This script copies files to be included in the `mlkem-rust-libcrux` +# crate for the PQ code package. Files and directories to be copied +# are listed, one per line, in a file at `ALLOWLIST` and copied to +# `TARGET_DIR`, which should be the `mlkem-rust-libcrux` git +# repository. The copied files include custom Cargo.toml and +# .gitignore files for mlkem-rust-libcrux. On successful completion of +# `cargo test`, a signed-off commit is created in the target +# repository. + + + +set -e +set -o pipefail + +ALLOWLIST="pqcp/allowlist.txt" + +if [[ -z "$TARGET_DIRECTORY" ]]; then + echo "Please set TARGET_DIRECTORY to the libcrux-ml-kem PQ code packages repository" + exit 1 +fi + +while read -r item; do + cp -r "$item" "$TARGET_DIRECTORY" +done < "$ALLOWLIST" + +cd "$TARGET_DIRECTORY" +cargo test +cargo clean + +git add . +git commit -sm "mlkem-rust-libcrux PQ code packages update ($(date))"