Skip to main content

Module crypto

Module crypto 

Source
Expand description

AES-128-CFB8 stream cipher used after the login encryption handshake.

Key and IV are both the 16-byte shared secret (negotiated by ghast-auth). Both directions are independent streams; Cfb8Encryptor and Cfb8Decryptor keep the running state between calls, so data can be processed in arbitrary pieces.

Encryption is inherently serial in CFB8 (each output byte feeds the next block). The decryptor exploits that every keystream block depends only on ciphertext, which is all known up front: it batches many AES block encryptions per call so the hardware AES pipeline (AES-NI, ARMv8 crypto extensions — runtime-detected by the aes crate) stays full. See the decrypt benchmark for the speedup over a serial implementation.

Structs§

Cfb8Decryptor
Streaming AES-128-CFB8 decryptor with batched (pipelined) AES.
Cfb8Encryptor
Streaming AES-128-CFB8 encryptor.
CipherPair
A matched pair of stream ciphers for one connection.