Expand description
§AES-GCM
This crate implements AES-GCM-128 and AES-GCM-256. The crate provides optimized implementations for ARM and x86_64 platforms with support for AES hardware acceleration, as well as a bit-sliced portable implementation.
For general use, we provide a platform-multiplexing API via the
AesGcm128Key and AesGcm256Key structs, which selects the most
performant implementation at runtime.
Usage example:
// Multiplexed owned API
use libcrux_aesgcm::AeadConsts as _;
use libcrux_aesgcm::{AesGcm128, AesGcm128Key, AesGcm128Nonce, AesGcm128Tag, NONCE_LEN, TAG_LEN};
let k: AesGcm128Key = [0; AesGcm128::KEY_LEN].into();
let nonce: AesGcm128Nonce = [0; NONCE_LEN].into();
let mut tag: AesGcm128Tag = [0; TAG_LEN].into();
let pt = b"the quick brown fox jumps over the lazy dog";
let mut ct = [0; 43];
let mut pt_out = [0; 43];
k.encrypt(&mut ct, &mut tag, &nonce, b"", pt).unwrap();
k.decrypt(&mut pt_out, &nonce, b"", &ct, &tag).unwrap();
assert_eq!(pt, &pt_out);We also provide access to lower-level AEAD
APIs for the platform-multiplexing
implementation with the AesGcm128 and AesGcm256 structs.
Users who want to use a platform-specific implementation directly can
access them in the submodules aes_gcm_128::{portable, x64, neon}.
Modules§
- aes_
gcm_ 128 - Implementations of AES-GCM 128
- aes_
gcm_ 256 - Implementations of AES-GCM 256
Structs§
- AesGcm128
- Access to lower-level AEAD APIs for platform-multiplexed AES-GCM 128.
- AesGcm256
- Access to lower-level AEAD APIs for platform-multiplexed AES-GCM 256.
- KeyGen
Error - An error occurred during key generation
Enums§
- Decrypt
Error - Error that can occur during decryption.
- Encrypt
Error - Error that can occur during encryption.
Constants§
- AESGC
M128_ KEY_ LEN - AES-GCM 128 key length.
- AESGC
M256_ KEY_ LEN - AES-GCM 256 key length.
- NONCE_
LEN - Nonce length.
- TAG_LEN
- Tag length.
Traits§
- Aead
- An Authenticated Encryption with Associated Data (AEAD) scheme. This trait is low-level and is mostly used for implementing other, more usable APIs.
- Aead
Consts - This trait captures the lengths of keys, tags and nonces used by an AEAD.
Type Aliases§
- AesGcm128
Key - An owned key for AES-GCM 128.
- AesGcm128
Nonce - An owned nonce for AES-GCM 128.
- AesGcm128
Tag - An owned tag for AES-GCM 128.
- AesGcm256
Key - An owned key for AES-GCM 256.
- AesGcm256
Nonce - An owned nonce for AES-GCM 256.
- AesGcm256
Tag - An owned tag for AES-GCM 256.