Skip to content

WIP: AES-GCM #935

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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

WIP: AES-GCM #935

wants to merge 16 commits into from

Conversation

karthikbhargavan
Copy link
Contributor

@karthikbhargavan karthikbhargavan commented Apr 28, 2025

This is a Work-in-Progress PR that adds support for AES-GCM.
It is inspired by existing work in HACL* for this primitive.
The PR contains three implementations of AES and three implementations of GF128.

AES:

  • a bitsliced implementation that uses u16x8
  • an Intel implementation that uses AES-NI
  • an armv8 implementation that uses Neon AES

GF128:

  • a U128 implementation that eagerly reduces during multiplication (We assume that Rust/LLVM will know how to translate u128 operations to u16/u32 etc.)
  • an Intel implementation that uses clmul instructions for multiplication and a separate reduction algorithm
  • an Armv8 implementation that uses vmull_p64 instructions for multiplication and the same reduction algorithm as Intel

Many things remain to be done before this can be ready for a merge:

  • It needs to be comprehensively tested with the NIST KATs
  • We need to test the portable implementation on a small cortex M device
  • The bitsliced implementation of AES is consciously trying to use minimal memory, and so relies on u16s.
    However, it can be sped up by 30% or so if we use u32s and process 2 blocks at a time
  • The SIMD implementations process 1 block at a time, but could be sped up by 3X by processing 4 blocks at a time.
  • The Neon implementation is slightly less efficient in order to share code with the other implementations. We should evaluate whether this is worth improving.
  • We should apply the secret independence checks to this implementation
  • For proofs, we need a spec for AES to link all three implementations against

@karthikbhargavan karthikbhargavan requested a review from a team as a code owner April 28, 2025 10:05
@karthikbhargavan karthikbhargavan marked this pull request as draft April 28, 2025 10:05
@franziskuskiefer franziskuskiefer changed the title Karthik/last prim WIP: AES-GCM Apr 29, 2025
@franziskuskiefer franziskuskiefer linked an issue Apr 29, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AES-GCM
2 participants