Skip to content

Feat: Core AEAD Cipher Split - #120

Open
officialfrancismendoza wants to merge 28 commits into
bcgit:feature/symmetric-cipherfrom
officialfrancismendoza:feature/officialfrancismendoza/119-core-aead-cipher
Open

officialfrancismendoza wants to merge 28 commits into
bcgit:feature/symmetric-cipherfrom
officialfrancismendoza:feature/officialfrancismendoza/119-core-aead-cipher

Conversation

@officialfrancismendoza

Copy link
Copy Markdown
Contributor

Implements core AEAD cipher split (#119), built off of bcgit/feature/symmetric-cipher. Implements AEADCipherEncryptor and AEADCipherDecryptor, as well as cherry-picks commits from ASCON (#22) so that ASCON is compatible.

@officialfrancismendoza officialfrancismendoza self-assigned this Sep 8, 2026
@officialfrancismendoza
officialfrancismendoza changed the base branch from main to release/0.1.3alpha September 8, 2026 11:59
@ounsworth
ounsworth self-requested a review September 8, 2026 17:03
ounsworth

This comment was marked as outdated.

@ounsworth ounsworth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holy crap. This is a 13,000 line PR. That's an insane amount of code to review.

It looks like this PR is bringing (at least) to other PRs with it? What is the actual change here?

I suggest that you either change the merge target to point to another currently-open PR so that the diff to review is smaller (and we can merge this into the other PR), or maybe hold off on this for now and we should focus out effort on reviewing and merging the other PRs first?

@officialfrancismendoza
officialfrancismendoza changed the base branch from release/0.1.3alpha to feature/symmetric-cipher September 8, 2026 17:07
@officialfrancismendoza
officialfrancismendoza changed the base branch from feature/symmetric-cipher to feature/officialfrancismendoza/ascon September 8, 2026 17:07
@officialfrancismendoza
officialfrancismendoza force-pushed the feature/officialfrancismendoza/119-core-aead-cipher branch from 7471ef2 to 01c3e6f Compare September 9, 2026 08:35
@dghgit
dghgit changed the base branch from feature/officialfrancismendoza/ascon to feature/symmetric-cipher September 9, 2026 11:14
@officialfrancismendoza
officialfrancismendoza force-pushed the feature/officialfrancismendoza/119-core-aead-cipher branch from 01c3e6f to aa209a9 Compare September 9, 2026 17:24
@dghgit

dghgit commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Yes, github failed to base it correctly. It's now just the split and ASCON.

Note: ASCON includes an XOF/Digest as well, so #118 is also relevant here - this PR will be blocked from merging by #118.

@ounsworth
ounsworth marked this pull request as draft September 16, 2026 02:54
dghgit and others added 15 commits September 16, 2026 14:37
…a parameter set can derive MAX_SECURITY_STRENGTH from a const generic instead of naming a variant by hand; no behaviour change, and the following commit is the first caller that needs it

Assisted-by: Claude:claude-opus-5

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…a hash for, not just the two approved truncations, so the IV Generation Function regains the one- and two-digit decimal branches that b11f8f6 dropped as unreachable -- writing a fixed three digits gives the "0256" spelling the section forbids, and hence the wrong IV, for every t below 100; t is checked against the section's own rule (positive, below 512, not 384) plus this crate's multiple-of-8 requirement, which BC Java's SHA512tDigest also imposes, and the unapproved truncations carry SHA512tParams::FIPS_APPROVED = false which SHA512Internal::new asserts in an inline const, so reaching one takes new_allow_unapproved_t() the way an encrypting mode takes ENCRYPTION_APPROVED; ALG_NAME, OUTPUT_LEN and MAX_SECURITY_STRENGTH are now derived from t and pinned to their old values for t = 224 and t = 256; new sha512t_tests.rs cross-checks eight truncations spanning all three digit branches against BC Java, and of the file's 259 mutants 180 are caught, 5 die on timeout and the 5 missed are the XOR/OR equivalences already documented at their sites

Assisted-by: Claude:claude-opus-5

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…tions and the commit message style in CLAUDE.md
… KMAC against the sample values, plus KMAC's key-type and buffer-length checks; kills the 88 mutants the SP 800-185 suites had missed
dghgit and others added 12 commits September 16, 2026 16:47
…al suite against the SHAKE types; of 29 missed mutants only the equivalent default_128_bit one survives
…orked and finished several ways from one absorbed prefix; the SP 800-185 types and the factory enums derive it, the sha2 and sha3 params traits require it, and the framework hash and XOF suites check a clone finishes like its original and diverges on different input
…E overrides them, XofOutput is renamed XOFOutput to match the spec capitalisation used everywhere else, Hash::output_len documents that a XOF's length is nominal rather than part of the function, and the BC Java asides come out of the Hash and XOF docs
…sh suite covering short, exact and over-long output buffers, for the implementors that take constructor arguments and so cannot reach test_hash
… than output_len instead of truncating, and neither they nor KMAC zeroized past the digest as the Hash and MAC contracts require; the two suites that had pinned the old behaviour are corrected and all three types now run the framework's buffer-length checks
… overrode and nothing outside their own tests called; a squeeze has nothing to finalize, so ending the stream is dropping the value, and the XOF suite now checks do_output_out zeroizes the buffer where it had checked the alias agreed with do_final
…he XOF squeezing vocabulary, so XOFOutput becomes XOFSqueezer with SHAKEOutput and XOFFactoryOutput following it, XOF::Output becomes XOF::Squeezer, into_output and into_output_partial_bits become into_squeezer and into_squeezer_partial_bits, and the one-shots hash_xof and hash_xof_out become xof and xof_out; mechanical throughout, with no behaviour change
…ut length, so XOFSqueezer gains do_final and do_final_out, KMACXOF, TupleHashXOF and ParallelHashXOF defer their right_encode(L) to the first read through a new LengthBoundSqueezer and compute the fixed-length function of SP 800-185 s. 4.3, 5.3 and 6.3 whenever do_final or a one-shot is that read, and the Hash view of every XOF, SHAKE and cSHAKE included, becomes a final read at output_len that zeroes the rest of the caller's buffer
…a bare run examines only the root package and finds nothing, the checked-in config's examine_globs silently overrides -f, crates whose mutants die in another crate's tests need --test-workspace, and without the /tmp/bc-test-data symlink the vector suites pass vacuously and their mutants all read as missed
…in update_out_len and a FINAL_LEN final buffer so a buffering cipher or an inline ciphertext||tag layout can be expressed; TaggedEncryptor/TaggedDecryptor adapt any FINAL_LEN=0 pair to the SimpleCipherEncryptor/SimpleCipherDecryptor ciphertext||tag shape; the block, simple-cipher and AEAD strength sweeps assert they are not vacuous, and the AEAD streaming suite gains a genuinely-buffering toy plus undersized-buffer and std-one-shot coverage
…XOF128/CXOF128) implementing AEADCipherEncryptor/AEADCipherDecryptor via AsconAead128Encryptor/AsconAead128Decryptor, with HashFactory/XOFFactory registration and CLI wiring including a TaggedDecryptor-based decrypt stream
…OF/XOFSqueezer API and updated factory/CLI/tests/benches to compile against the new API (bcgit#119)
@officialfrancismendoza
officialfrancismendoza force-pushed the feature/officialfrancismendoza/119-core-aead-cipher branch from 5ba4350 to 2c479f4 Compare September 17, 2026 13:38
@officialfrancismendoza

Copy link
Copy Markdown
Contributor Author

As per @dghgit request, retargeting to merge into #118, rebased on that branch, and updated code accordingly. This PR contains the most recent form of ASCON that utilizes the new AEADCipherEncryptor/Decryptor. Hence, #22 will be closed in favor of this one.

@officialfrancismendoza
officialfrancismendoza marked this pull request as ready for review September 17, 2026 13:46
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.

3 participants