-
Notifications
You must be signed in to change notification settings - Fork 26
AES-GCM Initial Review #1167
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
Closed
Closed
AES-GCM Initial Review #1167
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
47b5607
passes local tests
karthikbhargavan d221782
gcm portable
karthikbhargavan 6356396
gcm portable
karthikbhargavan 6986f02
benching
karthikbhargavan 5ccd52b
wip
karthikbhargavan 632735d
fixes for portability
karthikbhargavan 1d77af8
rcon generic
karthikbhargavan 169cadd
intel
karthikbhargavan e21bb4f
intel-ni
karthikbhargavan 749f32d
flags
karthikbhargavan 4e06964
fixed for arm
karthikbhargavan c8da11e
fmt
karthikbhargavan f7d8fe2
fixups
franziskuskiefer b1f5e81
move aesgmc
franziskuskiefer f39fcbc
cleanup
franziskuskiefer 242edc4
aesgcm: fixup intrinsics version
franziskuskiefer a5a3c0f
cleanup
franziskuskiefer 0083c94
towards aes256
franziskuskiefer 174ac2a
wip
franziskuskiefer f8a8e69
aes256 fix
karthikbhargavan e200882
no_std
franziskuskiefer ed96011
cleanup
franziskuskiefer c8da23c
less code duplication, but ugly
franziskuskiefer f1c55f1
forgot a file
franziskuskiefer 5cd727e
fixup x64
franziskuskiefer 97cf135
make gf128 x64 a little faster
franziskuskiefer 7c5b857
more cleanup
franziskuskiefer 2631ea7
fixup neon
franziskuskiefer 214e81e
simple aes fuzz
franziskuskiefer 2ca8e7c
fixup
franziskuskiefer 20c0510
addressing review comments
franziskuskiefer af194e9
fix x64; add ci
franziskuskiefer b123be0
rustfmt
franziskuskiefer a6c25e3
fixup x64 again
franziskuskiefer 1b462cf
x64 fixup
franziskuskiefer a882d90
aarch64 test fixup
franziskuskiefer 1c98186
Extend core models by AES & related intrinsics
jschneider-bensch 0004188
implement `libcrux_traits` `typed_owned` and `typed_refs` `Aead` traits
wysiwys 87156ab
add tests
wysiwys c539950
implement slice trait
wysiwys 9456055
derive `Eq` for algorithm structs
wysiwys de0f1d1
move tests
wysiwys c509b34
move trait implementations to own modules
wysiwys 3265cae
Merge pull request #1175 from cryspen/wysiwys/aes-gcm-traits-api
wysiwys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| profile.json.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)'] } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik05IDEySDE1TTIwIDEyQzIwIDE2LjQ2MTEgMTQuNTQgMTkuNjkzNyAxMi42NDE0IDIwLjY4M0MxMi40MzYxIDIwLjc5IDEyLjMzMzQgMjAuODQzNSAxMi4xOTEgMjAuODcxMkMxMi4wOCAyMC44OTI4IDExLjkyIDIwLjg5MjggMTEuODA5IDIwLjg3MTJDMTEuNjY2NiAyMC44NDM1IDExLjU2MzkgMjAuNzkgMTEuMzU4NiAyMC42ODNDOS40NTk5NiAxOS42OTM3IDQgMTYuNDYxMSA0IDEyVjguMjE3NTlDNCA3LjQxODA4IDQgNy4wMTgzMyA0LjEzMDc2IDYuNjc0N0M0LjI0NjI3IDYuMzcxMTMgNC40MzM5OCA2LjEwMDI3IDQuNjc3NjYgNS44ODU1MkM0Ljk1MzUgNS42NDI0MyA1LjMyNzggNS41MDIwNyA2LjA3NjQgNS4yMjEzNEwxMS40MzgyIDMuMjEwNjdDMTEuNjQ2MSAzLjEzMjcxIDExLjc1IDMuMDkzNzMgMTEuODU3IDMuMDc4MjdDMTEuOTUxOCAzLjA2NDU3IDEyLjA0ODIgMy4wNjQ1NyAxMi4xNDMgMy4wNzgyN0MxMi4yNSAzLjA5MzczIDEyLjM1MzkgMy4xMzI3MSAxMi41NjE4IDMuMjEwNjdMMTcuOTIzNiA1LjIyMTM0QzE4LjY3MjIgNS41MDIwNyAxOS4wNDY1IDUuNjQyNDMgMTkuMzIyMyA1Ljg4NTUyQzE5LjU2NiA2LjEwMDI3IDE5Ljc1MzcgNi4zNzExMyAxOS44NjkyIDYuNjc0N0MyMCA3LjAxODMzIDIwIDcuNDE4MDggMjAgOC4yMTc1OVYxMloiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4NCjwvc3ZnPg== |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.