Skip to content

Add constant-time bit-sliced AES engine (TAesBitSlicedEngine) - #158

Merged
Xor-el merged 1 commit into
masterfrom
feature/aes-bitsliced-engine
Jul 22, 2026
Merged

Add constant-time bit-sliced AES engine (TAesBitSlicedEngine)#158
Xor-el merged 1 commit into
masterfrom
feature/aes-bitsliced-engine

Conversation

@Xor-el

@Xor-el Xor-el commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Add a table-free, constant-time software AES engine that drops into the existing IBlockCipher/IAesEngine seam alongside the table-based TAesEngine.

The engine holds the AES state as eight bit-sliced UInt64 words and realises the S-box as a Boyar-Peralta Boolean circuit, so it performs no data- or key-dependent memory lookups and takes no secret-dependent branch - closing the cache-timing side channel inherent to the table engine. The key schedule is table-free and constant-time as well. Both directions are implemented and are bit-exact with TAesEngine for 128/192/256-bit keys; word rotations go through TBitOperations. The engine is opt-in by construction and is not registered as a default anywhere; paired with the branchless TBasicGcmMultiplier it composes into a constant-time software AES-GCM stack.

Tests (TTestAesBitSliced): inherits the standard AES engine battery (known vectors, 10k-iteration Monte Carlo, bad-parameter rejection) and adds FIPS-197 KATs both directions, byte-for-byte parity against TAesEngine over random keys/blocks, encrypt/decrypt round-trips, a CBC round-trip through the mode, and end-to-end AES-GCM through the manual composition.

Add a table-free, constant-time software AES engine that drops into the
existing IBlockCipher/IAesEngine seam alongside the table-based TAesEngine.

The engine holds the AES state as eight bit-sliced UInt64 words and realises
the S-box as a Boyar-Peralta Boolean circuit, so it performs no data- or
key-dependent memory lookups and takes no secret-dependent branch - closing
the cache-timing side channel inherent to the table engine. The key schedule
is table-free and constant-time as well. Both directions are implemented and
are bit-exact with TAesEngine for 128/192/256-bit keys; word rotations go
through TBitOperations. The engine is opt-in by construction and is not
registered as a default anywhere; paired with the branchless TBasicGcmMultiplier
it composes into a constant-time software AES-GCM stack.

Tests (TTestAesBitSliced): inherits the standard AES engine battery (known
vectors, 10k-iteration Monte Carlo, bad-parameter rejection) and adds
FIPS-197 KATs both directions, byte-for-byte parity against TAesEngine over
random keys/blocks, encrypt/decrypt round-trips, a CBC round-trip through the
mode, and end-to-end AES-GCM through the manual composition.
@Xor-el
Xor-el merged commit 2799f76 into master Jul 22, 2026
24 checks passed
@Xor-el
Xor-el deleted the feature/aes-bitsliced-engine branch July 22, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant