24 lines
1.1 KiB
Text
24 lines
1.1 KiB
Text
/* ZUPT — AES-256-CTR 4-Block Pipeline via AES-NI (Jasmin)
|
||
* Copyright (c) 2026 Cristian Cezar Moisés
|
||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||
*
|
||
* CT-REQUIRED: designed without intended secret-dependent branches or memory
|
||
* access. Compiled and microarchitectural timing is not proven here.
|
||
*
|
||
* 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.
|
||
*
|
||
* 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). */
|