24 lines
1 KiB
Text
24 lines
1 KiB
Text
/* Zupt — AES-256-CTR 4-Block Pipeline via AES-NI (Jasmin)
|
||
* Copyright (c) 2026 Cristian Cezar Moisés — MIT License
|
||
*
|
||
* CT-REQUIRED: AES-NI has no data-dependent timing.
|
||
*
|
||
* Interleaves 4 independent counter blocks through the AES round
|
||
* pipeline. AES-NI has 4-cycle latency, 1-cycle throughput — so
|
||
* 4 independent blocks saturate the pipeline for ~4× throughput.
|
||
*
|
||
* Expected: ~3.5 GB/s AES-256-CTR on modern x86-64 (Zen3/Alder Lake).
|
||
*
|
||
* Interface:
|
||
* zupt_aes256_ctr4(out, in, key, ctr, nblocks)
|
||
* Encrypts nblocks×16 bytes. Counter is incremented in the last 8 bytes
|
||
* (big-endian) after each block. Processes 4 blocks per iteration;
|
||
* remaining 1-3 blocks fall back to zupt_aes256_blk.
|
||
*
|
||
* NOTE: This is the Jasmin source for documentation. The actual linked
|
||
* assembly is in zupt_aes_ctr4.s (hand-written to match this logic).
|
||
*/
|
||
|
||
/* See zupt_aes_ctr4.s for the production assembly.
|
||
* This .jazz file documents the algorithm but is not compiled
|
||
* (jasminc is not required at build time). */
|