Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
47b5607
passes local tests
karthikbhargavan Apr 19, 2025
d221782
gcm portable
karthikbhargavan Apr 20, 2025
6356396
gcm portable
karthikbhargavan Apr 20, 2025
6986f02
benching
karthikbhargavan Apr 20, 2025
5ccd52b
wip
karthikbhargavan Apr 23, 2025
632735d
fixes for portability
karthikbhargavan Apr 23, 2025
1d77af8
rcon generic
karthikbhargavan Apr 27, 2025
169cadd
intel
karthikbhargavan Apr 28, 2025
e21bb4f
intel-ni
karthikbhargavan Apr 28, 2025
749f32d
flags
karthikbhargavan Apr 28, 2025
4e06964
fixed for arm
karthikbhargavan Apr 28, 2025
c8da11e
fmt
karthikbhargavan Apr 28, 2025
f7d8fe2
fixups
franziskuskiefer Jun 4, 2025
b1f5e81
move aesgmc
franziskuskiefer Jun 6, 2025
f39fcbc
cleanup
franziskuskiefer Jun 6, 2025
242edc4
aesgcm: fixup intrinsics version
franziskuskiefer Jun 19, 2025
a5a3c0f
cleanup
franziskuskiefer Jul 4, 2025
0083c94
towards aes256
franziskuskiefer Jul 8, 2025
174ac2a
wip
franziskuskiefer Sep 3, 2025
f8a8e69
aes256 fix
karthikbhargavan Sep 19, 2025
e200882
no_std
franziskuskiefer Sep 19, 2025
ed96011
cleanup
franziskuskiefer Sep 20, 2025
c8da23c
less code duplication, but ugly
franziskuskiefer Sep 20, 2025
f1c55f1
forgot a file
franziskuskiefer Sep 20, 2025
5cd727e
fixup x64
franziskuskiefer Sep 21, 2025
97cf135
make gf128 x64 a little faster
franziskuskiefer Sep 21, 2025
7c5b857
more cleanup
franziskuskiefer Sep 21, 2025
2631ea7
fixup neon
franziskuskiefer Sep 22, 2025
214e81e
simple aes fuzz
franziskuskiefer Sep 22, 2025
2ca8e7c
fixup
franziskuskiefer Sep 22, 2025
20c0510
addressing review comments
franziskuskiefer Sep 24, 2025
af194e9
fix x64; add ci
franziskuskiefer Sep 24, 2025
b123be0
rustfmt
franziskuskiefer Sep 24, 2025
a6c25e3
fixup x64 again
franziskuskiefer Sep 24, 2025
1b462cf
x64 fixup
franziskuskiefer Sep 24, 2025
a882d90
aarch64 test fixup
franziskuskiefer Sep 24, 2025
1c98186
Extend core models by AES & related intrinsics
jschneider-bensch Sep 24, 2025
0004188
implement `libcrux_traits` `typed_owned` and `typed_refs` `Aead` traits
wysiwys Sep 24, 2025
87156ab
add tests
wysiwys Sep 24, 2025
c539950
implement slice trait
wysiwys Sep 24, 2025
9456055
derive `Eq` for algorithm structs
wysiwys Sep 24, 2025
de0f1d1
move tests
wysiwys Sep 24, 2025
c509b34
move trait implementations to own modules
wysiwys Sep 24, 2025
3265cae
Merge pull request #1175 from cryspen/wysiwys/aes-gcm-traits-api
wysiwys Sep 25, 2025
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
169 changes: 169 additions & 0 deletions .github/workflows/aes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: AES-GCM

on:
merge_group:
pull_request:
branches: ["main", "dev", "*"]
paths:
- "aesgcm/**"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
fail-fast: false
matrix:
bits: [32, 64]
os:
- macos-latest # macos-15 on apple silicon
- ubuntu-latest
- windows-latest
exclude:
- bits: 32
os: "macos-latest"

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: aesgcm

steps:
- uses: actions/checkout@v5
- uses: taiki-e/install-action@cargo-hack

- name: Update dependencies
run: cargo update

- run: echo "RUST_TARGET_FLAG=" > $GITHUB_ENV
if: ${{ matrix.bits == 64 }}

- run: echo 'EXCLUDE_FEATURES=--exclude-features simd256' > $GITHUB_ENV
if: ${{ matrix.os == 'macos-latest' }}

- run: echo 'EXCLUDE_FEATURES=--exclude-features simd128' > $GITHUB_ENV
if: ${{ matrix.os != 'macos-latest' }}

- name: 🛠️ Setup Rust Nightly
run: rustup toolchain install nightly

- name: 🛠️ Setup Ubuntu x86
if: ${{ matrix.bits == 32 && matrix.os == 'ubuntu-latest' }}
run: |
rustup target add i686-unknown-linux-gnu
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib

# Set up 32 bit systems

- name: 🛠️ Config Windows x86
run: echo "RUST_TARGET_FLAG=--target=i686-pc-windows-msvc" > $GITHUB_ENV
if: ${{ matrix.bits == 32 && matrix.os == 'windows-latest' }}

- name: 🛠️ Config Linux x86
run: |
echo "RUST_TARGET_FLAG=--target=i686-unknown-linux-gnu" > $GITHUB_ENV
if: ${{ matrix.bits == 32 && matrix.os == 'ubuntu-latest' }}

# Build ...

- name: 🔨 Build
run: |
rustc --print=cfg
cargo build --verbose $RUST_TARGET_FLAG

- name: 🔨 Build Release
run: cargo build --verbose --release $RUST_TARGET_FLAG

- name: 🏃🏻 Asan MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: RUSTDOCFLAGS=-Zsanitizer=address RUSTFLAGS=-Zsanitizer=address cargo +nightly test --release --target aarch64-apple-darwin

# Test ...

- name: 🏃🏻‍♀️ Test
run: |
cargo clean
cargo test --verbose $RUST_TARGET_FLAG

- name: 🏃🏻‍♀️ Test Release
run: |
cargo clean
cargo test --verbose --release $RUST_TARGET_FLAG

- name: 🏃🏻‍♀️ Test Portable
run: |
cargo clean
LIBCRUX_DISABLE_SIMD128=1 LIBCRUX_DISABLE_SIMD256=1 cargo test --verbose $RUST_TARGET_FLAG

- name: 🏃🏻‍♀️ Test Portable Release
run: |
cargo clean
LIBCRUX_DISABLE_SIMD128=1 LIBCRUX_DISABLE_SIMD256=1 cargo test --verbose --release $RUST_TARGET_FLAG

- name: 🏃🏻‍♀️ Test Kyber
run: |
cargo clean
cargo test ,kyber --verbose $RUST_TARGET_FLAG

- name: 🏃🏻‍♀️ Cargo Test Features
if: ${{ matrix.bits == 64 }}
run: |
cargo clean
cargo hack test --each-feature $EXCLUDE_FEATURES --verbose $RUST_TARGET_FLAG

build-intel-macos:
runs-on: macos-13
defaults:
run:
shell: bash
working-directory: aesgcm

steps:
- uses: actions/checkout@v5

- name: Update dependencies
run: cargo update

- name: 🔨 Build
run: |
rustc --print=cfg
cargo build --verbose

fuzz:
strategy:
fail-fast: false
matrix:
os:
- macos-latest # macos-15
- ubuntu-latest

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: aesgcm

steps:
- uses: actions/checkout@v5

- name: 🛠️ Setup Rust Nightly
run: |
rustup toolchain install nightly
cargo install cargo-fuzz

- name: 🛠️ Update dependencies
run: cargo update

- name: 🏃🏻‍♀️ Encrypt256
run: CARGO_PROFILE_RELEASE_LTO=false cargo +nightly fuzz run encrypt128 -- -runs=100000

- name: 🏃🏻‍♀️ Encrypt256
run: CARGO_PROFILE_RELEASE_LTO=false cargo +nightly fuzz run encrypt256 -- -runs=100000
44 changes: 32 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[workspace]
members = [
"aesgcm",
"aesgcm/fuzz",
"sys/hacl",
"sys/libjade",
"sys/platform",
Expand Down Expand Up @@ -49,6 +51,20 @@ allow-branch = ["main"]

[workspace.dependencies]
hax-lib = { version = "0.3.4" }
libcrux-intrinsics = { version = "=0.0.3", path = "libcrux-intrinsics" }
libcrux-aesgcm = { version = "=0.0.2", path = "aesgcm" }
libcrux-chacha20poly1305 = { version = "=0.0.3", path = "chacha20poly1305" }
libcrux-traits = { version = "=0.0.3", path = "traits" }
libcrux-hacl-rs = { version = "=0.0.3", path = "hacl-rs" }
libcrux-hacl = { version = "=0.0.2", path = "sys/hacl" }
libcrux-platform = { version = "=0.0.2", path = "sys/platform" }
libcrux-hkdf = { version = "=0.0.3", path = "libcrux-hkdf" }
libcrux-hmac = { version = "=0.0.3", path = "libcrux-hmac" }
libcrux-sha2 = { version = "=0.0.3", path = "sha2" }
libcrux-ed25519 = { version = "=0.0.3", path = "ed25519" }
libcrux-ecdh = { version = "=0.0.3", path = "libcrux-ecdh" }
libcrux-ml-kem = { version = "=0.0.3", path = "libcrux-ml-kem" }
libcrux-kem = { version = "=0.0.3", path = "libcrux-kem" }

[package]
name = "libcrux"
Expand Down Expand Up @@ -81,23 +97,27 @@ bench = false # so libtest doesn't eat the argumen
libcrux-platform = { version = "=0.0.2", path = "sys/platform" }

[dependencies]
libcrux-traits = { version = "=0.0.3", path = "traits" }
libcrux-chacha20poly1305 = { version = "=0.0.3", path = "chacha20poly1305" }
libcrux-hacl-rs = { version = "=0.0.3", path = "hacl-rs" }
libcrux-hacl = { version = "=0.0.2", path = "sys/hacl" }
libcrux-platform = { version = "=0.0.2", path = "sys/platform" }
libcrux-hkdf = { version = "=0.0.3", path = "libcrux-hkdf" }
libcrux-hmac = { version = "=0.0.3", path = "libcrux-hmac" }
libcrux-sha2 = { version = "=0.0.3", path = "sha2" }
libcrux-ed25519 = { version = "=0.0.3", path = "ed25519" }
libcrux-ecdh = { version = "=0.0.3", path = "libcrux-ecdh" }
libcrux-ml-kem = { version = "=0.0.3", path = "libcrux-ml-kem" }
libcrux-kem = { version = "=0.0.3", path = "libcrux-kem" }
libcrux-hacl-rs.workspace = true
libcrux-chacha20poly1305.workspace = true
libcrux-ml-kem.workspace = true
libcrux-traits.workspace = true
libcrux-hacl.workspace = true
libcrux-platform.workspace = true
libcrux-hkdf.workspace = true
libcrux-hmac.workspace = true
libcrux-sha2.workspace = true
libcrux-ed25519.workspace = true
libcrux-ecdh.workspace = true
libcrux-kem.workspace = true

rand = { version = "0.9" }
log = { version = "0.4", optional = true }

# WASM API
wasm-bindgen = { version = "0.2.87", optional = true }
getrandom = { version = "0.3", optional = true }

# Proofs
hax-lib.workspace = true

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions aesgcm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
profile.json.gz
45 changes: 45 additions & 0 deletions aesgcm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[package]
name = "libcrux_aesgcm"
version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
edition.workspace = true
repository.workspace = true
readme = "README.md"
description = "Libcrux AES-GCM implementation"
exclude = []

[lib]
bench = false # so libtest doesn't eat the arguments to criterion

[dependencies]
libcrux-platform.workspace = true
libcrux-intrinsics.workspace = true
libcrux-traits.workspace = true

rand = { version = "0.9", optional = true }

[features]
default = ["rand"] # XXX: remove rand here when cleaning up
simd128 = []
simd256 = []
rand = ["dep:rand"]
std = []

[[bench]]
name = "aesgcm"
harness = false

[dev-dependencies]
libcrux_aesgcm = { version = "*", features = ["std"], path = "." }
cavp = { version = "0.0.2", path = "../cavp" }
criterion = "0.5.1"
hex = "0.4.3"
pretty_env_logger = "0.5.0"
rand_core = { version = "0.6" }
aes-gcm = "0.10.3"
wycheproof = "0.6.0"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(hax)', 'cfg(eurydice)'] }
12 changes: 12 additions & 0 deletions aesgcm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AES-GCM

![pre-verification]

This crate implements AES-GCM 128 and 256

It provides
- a portable, bit-sliced implementation
- an x64 optimised implementation using AES-NI
- an Aarch64 optimised implementation using the AES instructions

[pre-verification]: https://img.shields.io/badge/pre_verification-orange.svg?style=for-the-badge&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik05IDEyS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