Module aes_gcm

Module aes_gcm 

Source

Enums§

GcmBlockMulEnhancement
Block multiplication enhancement variants used for GHASH calculation. Which in turn used for calculation of authentication tag. https://luca-giuzzi.unibs.it/corsi/Support/papers-cryptography/gcm-spec.pdf None - regular multiplication. Requires just 16B (aes cipher key) per session, i.e. cca 67M sessions per 1GB of memory worst throughput M0TableAndRTable - cca 3.7 times faster then regular multiplication. Needs 4096Bytes per key, i.e. cca 262K key per 1GB of memory. M4BitTables - cca 6.9 times faster then regular multiplication. Needs 8192Bytes per key, i.e. cca 131K keys per 1GB of memory. MTables - cca 9 times faster then regular multiplication. Needs 65535Bytes per key, i.e. cca 16,4K keys per 1GB of memory.

Constants§

TABLE_R

Functions§

block_mul
block_mul_with_4bit_tables
block_mul_with_m0_r
block_mul_with_tables
calculate_4bit_table_m
calculate_table_m
h - hash sub-key. u128::from_be_bytes((h as &u8).try_into().unwrap())
calculate_table_r
calculates R-table for faster multiplication using M0 and R https://luca-giuzzi.unibs.it/corsi/Support/papers-cryptography/gcm-spec.pdf
define_block_s
gcm_aes_decrypt
Decrypts cipher_text to plain text by XOR’ing with AES-encrypted “Counter block”. “Counter block” is initialized by “Initialization Vector” and incremented for each input block i.e. each 16 bytes of plain text. Cipher text then gets concatenated with “additional authenticated data” to produce GHASH which in turn XOR’ed with first AES-encrypted counter block to produce “Authentication tag”
gcm_aes_encrypt
Encrypts plain_text to cipher text by XOR’ing with AES-encrypted “Counter block”. “Counter block” is initialized by “Initialization Vector” and incremented for each input block i.e. each 16 bytes of plain text. Cipher text then gets concatenated with “additional authenticated data” to produce GHASH which in turn XOR’ed with first AES-encrypted counter block to produce “Authentication tag”
gctr
increment_32_least_bits
iv2pre_counter_block
xor_full_blocks
a and b should be 16 bytes long

Type Aliases§

GcmBlockMulFn