Implement verified x86-64 Triple DES ECB - #504
Closed
reaperhulk wants to merge 17 commits into
Closed
reaperhulk wants to merge 17 commits into
reaperhulk wants to merge 17 commits into
Conversation
reaperhulk
force-pushed
the
codex/3des-ecb-x86-64
branch
from
October 1, 2026 19:52
c16c998 to
d8e8ece
Compare
reaperhulk
force-pushed
the
codex/3des-ecb-x86-64
branch
from
October 1, 2026 21:40
d8e8ece to
fa6b742
Compare
reaperhulk
force-pushed
the
codex/3des-ecb-x86-64
branch
from
October 1, 2026 21:50
81c539b to
ff7ae5a
Compare
alex
reviewed
Oct 1, 2026
|
|
||
| impl TripleDesEcb { | ||
| /// Initializes ECB with a 16- or 24-byte key and the chosen direction. | ||
| pub fn init(key: &[u8], direction: Direction) -> Result<Self, Error> { |
reaperhulk
force-pushed
the
codex/3des-ecb-x86-64
branch
6 times, most recently
from
October 1, 2026 22:22
2925d54 to
1f31a8c
Compare
reaperhulk
force-pushed
the
codex/3des-ecb-x86-64
branch
from
October 2, 2026 00:52
1f31a8c to
cfc436b
Compare
reaperhulk
added this pull request to stack #551
October 2, 2026 00:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds complete baseline x86-64 Triple DES ECB: verified key expansion, single-block encryption/decryption, and multi-block ECB encryption/decryption, with generated assembly and an allocation-free, in-place Rust API. Accepts 16- and 24-byte keys, ignores parity bits, and rejects buffers with incomplete blocks without padding. Uses the specification merged in #459; no
Spec/orTCB/changes.The scalar implementation shares IP/FP across the three DES passes and keeps Feistel halves in registers. I reviewed OpenSSL's scalar DES and AWS-LC's DES. Their secret-indexed round/key tables cannot meet this repository's constant-time contract, so this version uses Boolean S-box circuits synthesized from the merged specification and fixed key permutations. All five entry points have functional, frame, ABI and constant-time proofs against the shared contracts. Removes the standalone design prose added in #459, following review feedback.
Validation: full
lake build, emitter generation and--check(standard-axiom and compiler audits); all six repository check scripts; formatting and clippy; full Rust tests with Wycheproof, both normal andVG_CPU_FEATURES=none; all 500 published NIST ECB vectors in both directions, block-aligned splits, key parity and invalid lengths.Benchmarks cover both directions and key sizes alongside OpenSSL. Earlier measurements used the original streaming API and need to be rerun for the revised in-place API before quoting throughput here.
Review feedback addressed:
TripleDesEcb::new(key)expands a reusable key;encryptanddecrypttransform complete blocks in place. No allocation, direction stored in the context, buffering, or finalization. Invalid lengths leave the buffer unchanged. All 500 NIST cases pass with default features enabled and disabled, and formatting, architecture gates and root/benchmark clippy pass.