Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
379 commits
Select commit Hold shift + click to select a range
3d265ad
Merge remote-tracking branch 'origin/feature/xof-cshake' into feature…
dghgit Sep 20, 2026
6d849a1
cli, ascon: document the generated-nonce stream layout and the 8 MiB …
dghgit Sep 20, 2026
bbc04e3
release notes: the current bouncycastle-ascon mutation figures (#119)
dghgit Sep 20, 2026
2f7c32a
core, core-test-framework, ascon: delete the AEADCipher trait, supers…
dghgit Sep 20, 2026
80098c4
release notes: record the AEADCipher removal and re-measure the mutat…
dghgit Sep 20, 2026
702246a
core, core-test-framework, ascon, cli: carry the inline ciphertext||t…
dghgit Sep 20, 2026
c8190be
release notes: re-measure bouncycastle-ascon after the AEAD trait cha…
dghgit Sep 20, 2026
f376c14
core, core-test-framework: close the mutation gaps a scoped run found…
dghgit Sep 20, 2026
a1468a9
release notes: record the scoped mutation figures for the AEAD trait …
dghgit Sep 20, 2026
7357e86
core, modes, aes, padding: rename SimpleCipherEncryptor / SimpleCiphe…
dghgit Sep 21, 2026
f99bf72
core, padding, modes: rename SymmetricCipherError::IncorrectOutputBuf…
dghgit Sep 21, 2026
8a13369
Merge branch 'feature/simple-ciphers' into feature/xof-cshake
dghgit Sep 21, 2026
ac72292
Merge branch 'feature/xof-cshake' into feature/officialfrancismendoza…
dghgit Sep 21, 2026
62e6a2b
docs: fix contributing typos
officialfrancismendoza Sep 21, 2026
7535274
Re-adding the changes I had committed on this branch a few days ago, …
ounsworth Sep 22, 2026
dcec6b8
Some docs tweaks
ounsworth Sep 22, 2026
df43a87
aes, core: restore the FIPS 197 Appendix B known-answer values in the…
dghgit Sep 22, 2026
ed09ae0
Merge branch 'feature/simple-ciphers' into feature/xof-cshake
dghgit Sep 22, 2026
e18dd46
core, modes, aes, core-test-framework: make do_encrypt_init_rng panic…
dghgit Sep 22, 2026
cf78449
Merge branch 'feature/simple-ciphers' into feature/xof-cshake
dghgit Sep 22, 2026
336f9cb
core, core-test-framework, ascon, cli: make AEADCipherEncryptor/AEADC…
dghgit Sep 24, 2026
2eb7a99
ascon: add Ascon_AEAD128<Dir>, naming the AEAD pair by direction
dghgit Sep 24, 2026
c89663a
Merge remote-tracking branch 'origin/feature/xof-cshake' into trial/c…
dghgit Sep 24, 2026
570ae03
Initial add of AES lightweight CCM mode (#125)
officialfrancismendoza Sep 10, 2026
5d5cf5c
core, modes: document why AEADCipherEncryptor/Decryptor were not resh…
officialfrancismendoza Sep 14, 2026
3dd3266
cli: --nonce-file for CCM reads raw bytes only, never hex-decodes
officialfrancismendoza Sep 15, 2026
3be43fb
modes, core: zeroize CCM's CBC-MAC state, and make BUFFER_LEN vs the …
officialfrancismendoza Sep 15, 2026
e95a25b
modes: batch CCM's CTR half, and fix docs that claimed it was impossible
officialfrancismendoza Sep 15, 2026
9f437ab
cli: stop BlockModeAction's shared help from describing behaviour CCM…
officialfrancismendoza Sep 15, 2026
4282833
cli: process CCM input in place instead of allocating a second buffer
officialfrancismendoza Sep 15, 2026
ac13ce0
modes: dedupe CcmEncryptor/CcmDecryptor over a shared CcmBuffer, drop…
officialfrancismendoza Sep 15, 2026
e877a32
modes: add a Wycheproof AES-CCM suite, move/drop CCM unit tests that …
officialfrancismendoza Sep 15, 2026
1b593c5
modes: close the mutation-testing gaps the batching and buffer-bounda…
officialfrancismendoza Sep 15, 2026
afa2b3c
modes: adapt CCM buffer errors to the #120 API
officialfrancismendoza Sep 21, 2026
8a24373
Fixed formatting with cargo fmt (#125)
officialfrancismendoza Sep 21, 2026
24a646c
Remediated concerns. F1-F10 fixed except F9 (optional), which was lef…
officialfrancismendoza Sep 23, 2026
b8a217f
Style / docs refactors: renamed AES, AES_128, AES_192, AES_256 to AES…
ounsworth Sep 24, 2026
67a7b45
modes, aes, core-test-framework: port CcmEncryptor/CcmDecryptor to th…
dghgit Sep 24, 2026
7a6e2a4
Initial add of AES lightengine GCM mode (#124)
officialfrancismendoza Sep 14, 2026
6bd4ed7
modes, aes, cli: follow the base branch's API renames in AES-GCM (#124)
dghgit Sep 24, 2026
788fd06
modes, aes, cli: implement AEADCipherEncryptor/AEADCipherDecryptor fo…
dghgit Sep 24, 2026
9da20d3
cli, modes, mem_usage_benches, aes: finish the AES_128 / AES_192 / AE…
ounsworth Sep 24, 2026
334cd2b
core, aes, modes, core-test-framework: make ElectronicCodeBook's encr…
dghgit Sep 25, 2026
15c2fa5
Merge branch 'feature/simple-ciphers' into feature/xof-cshake
dghgit Sep 25, 2026
52e63bc
Merge branch 'feature/xof-cshake' into feature/officialfrancismendoza…
dghgit Sep 25, 2026
e691aed
Merge the updated CCM branch into feature/officialfrancismendoza/124-…
dghgit Sep 25, 2026
127dddf
* BIG CHANGE: refactored this from Pornin's 32-bit bitsliced impl to …
ounsworth Sep 25, 2026
a559934
Applied skills/memory-hygiene-in-rust/SKILL.md and shaved the AES imp…
ounsworth Sep 25, 2026
a57d7dd
Applied skills/memory-hygiene-in-rust/SKILL.md and shaved the AES imp…
ounsworth Sep 25, 2026
627f619
docs tweaks
ounsworth Sep 26, 2026
8823c7b
Refactor core: removed SecurityStrength and impls from traits.rs
ounsworth Sep 26, 2026
7002d4a
core: fix the three do_hazardous_operations doctests broken by 8823c7…
dghgit Sep 26, 2026
a06b83a
Merge PR #137 (secbug/mldsa87_wycheproof: ML-DSA missing reduce32 lea…
dghgit Sep 26, 2026
77edc43
Merge branch 'feature/simple-ciphers' into feature/xof-cshake
dghgit Sep 26, 2026
d05e50e
Merge remote-tracking branch 'bcgit/feature/xof-cshake' into feature/…
officialfrancismendoza Sep 27, 2026
dd4e5f6
Merge remote-tracking branch 'origin/feature/officialfrancismendoza/1…
officialfrancismendoza Sep 27, 2026
2161a04
Fix batched keystream left on stack (#125)
officialfrancismendoza Sep 27, 2026
16a4ba5
Merge remote-tracking branch 'bcgit/feature/xof-cshake' into feature/…
officialfrancismendoza Sep 27, 2026
8e23ced
Merge the CCM branch (2161a04) into feature/officialfrancismendoza/12…
dghgit Sep 27, 2026
985eb94
modes: zeroize CTR's batched and single-block keystream, as 2161a04 d…
dghgit Sep 27, 2026
6a061ed
modes: CCM review fixes -- decryptor nonce floor, one error variant f…
dghgit Sep 27, 2026
f527ac9
aes: AES_CCM_*_Encryptor docs -- the nonce floor applies to the decry…
dghgit Sep 27, 2026
5de0f7d
cli: aes*-ccm -- warn on a nonce file ending in a newline, and explai…
dghgit Sep 27, 2026
30b871b
mem_usage_benches: make the CCM harness measure the streaming path it…
dghgit Sep 27, 2026
68a8934
aes: drop the redundant explicit link targets in the CCM module docs
dghgit Sep 27, 2026
174563c
mem_usage_benches: state the CCM streaming figures against the baseli…
dghgit Sep 27, 2026
62afc19
Intermediate add for CI fix changes
officialfrancismendoza Sep 27, 2026
2c32883
Merge remote-tracking branch 'origin/feature/officialfrancismendoza/1…
officialfrancismendoza Sep 27, 2026
3cee19b
Remove .claude/settings.json (#124)
dghgit Sep 27, 2026
2ed6768
modes: update the crate docs for GCM (#124)
dghgit Sep 27, 2026
01d725e
modes: keep GCM's H, tag mask and computed tag out of unzeroized stac…
dghgit Sep 27, 2026
117f06b
cli: --aad-file for GCM reads raw bytes only, never hex-decodes (#124)
dghgit Sep 27, 2026
f8f7a2e
modes: Ctr keeps its keystream out of unzeroized stack arrays, refill…
dghgit Sep 27, 2026
8575ea7
Merge branch 'feature/simple-ciphers' into feature/xof-cshake
dghgit Sep 27, 2026
7e83f10
Merge remote-tracking branch 'origin/feature/xof-cshake' into feature…
dghgit Sep 27, 2026
840bf42
Merge remote-tracking branch 'origin/feature/xof-cshake' into feature…
dghgit Sep 27, 2026
7aa826d
Merge the CCM branch (840bf42) into feature/officialfrancismendoza/12…
dghgit Sep 27, 2026
013d806
Aesthetic changes to padded_block_cipher
ounsworth Sep 27, 2026
3d7c5a7
Removed an uncessary turbofish from test code
ounsworth Sep 27, 2026
3ecabfd
Merge PR #126 (feature/officialfrancismendoza/125-AES-lightengine-CCM…
dghgit Sep 28, 2026
f8400c3
Merge PR #132 (feature/officialfrancismendoza/124-AES-lightengine-GCM…
dghgit Sep 28, 2026
6705a3f
Merge branch 'feature/xof-cshake' into feature/simple-ciphers
dghgit Sep 28, 2026
793c7f1
docs tweaks to modes
ounsworth Sep 28, 2026
1689005
modes, padding, core: follow-ups to 793c7f1's modes docs restructure …
dghgit Sep 28, 2026
f62f107
Restructuring of the cipher modes docs
ounsworth Sep 28, 2026
67a6f65
modes: Ccm's inherent one-shots take the library's _out names -- encr…
dghgit Sep 28, 2026
2d4d038
modes: fix the two doctests f62f107 left failing -- cbc.rs's streamin…
dghgit Sep 28, 2026
5946992
gitignore: stop un-ignoring .claude/settings.json, so a contributor's…
dghgit Sep 28, 2026
eaff5a5
Renaming the acvp_gcm helper file to indicate that it's a helper.
ounsworth Sep 28, 2026
085d1d9
Adding tests for ccm mode, specifically one that demonstrates that th…
ounsworth Sep 28, 2026
baf16b9
Adding tests for ccm mode, specifically one that demonstrates that th…
ounsworth Sep 28, 2026
9d7b354
Renamed SymmetricCipher from do_update to do_encrypt / do_decrypt.
ounsworth Sep 28, 2026
603d1cd
core, core-test-framework, modes: rename BlockCipherEncryptor::encryp…
dghgit Sep 28, 2026
bd6b8c1
core, core-test-framework, modes, aes, cli, mem_usage_benches: Stream…
dghgit Sep 28, 2026
d32af54
cli: aes{128,192,256}-ccm take --aad-file, raw bytes and never hex-de…
dghgit Sep 28, 2026
93eb292
modes: remove test_large_payload_symmetric_cipher, which still fails …
dghgit Sep 29, 2026
0fb4e79
modes: pin CCM_MAX_BUFFER_LEN at 512 KiB and CcmKeyStream's absolute …
dghgit Sep 29, 2026
ee3d2f3
Did a pass over CFB and CFB8 docs.
ounsworth Sep 29, 2026
0da96c1
Added chacha20 crate (#145)
officialfrancismendoza Sep 29, 2026
2af82d2
Added poly1305 crate (#145)
officialfrancismendoza Sep 29, 2026
68091d2
Updated lib.rs and Cargo.toml to accommodate new crates (#145)
officialfrancismendoza Sep 29, 2026
17de3b0
Added chacha20-poly1305-aead composite crate (#145)
officialfrancismendoza Sep 29, 2026
ed7511f
Merge remote-tracking branch 'upstream/feature/simple-ciphers' into f…
officialfrancismendoza Sep 29, 2026
d48d2dd
Tweaked docs for gcm
ounsworth Sep 29, 2026
1cbc22e
Refactored the cli helpers into a helpers/ submod
ounsworth Sep 30, 2026
ef7f327
Merge remote-tracking branch 'upstream/feature/simple-ciphers' into f…
officialfrancismendoza Sep 30, 2026
ef48800
Update ChaCha20 for current cipher traits (#145)
officialfrancismendoza Sep 30, 2026
1791f3c
Added a release note about MLDSA / MLKEM memory optimization
ounsworth Sep 30, 2026
641ac54
Docs update to ctr mode
ounsworth Sep 30, 2026
4fd492b
Removed the AES dependency from the core (non-vector-based) modes tes…
ounsworth Sep 30, 2026
f71c2f4
Fable de-duplicated the AES vector tests
ounsworth Sep 30, 2026
941743b
Refactored to move all AES tests out of the modes crate into the aes …
ounsworth Sep 30, 2026
50f5505
Split the AEAD and block-cipher runners out of core-test-framework's …
ounsworth Sep 30, 2026
dc6f5af
Tweaked docs for AES_CBC
ounsworth Sep 30, 2026
64f3923
ascon: seal the direction projection and trim the public API
dghgit Sep 30, 2026
3d01899
Merge PR #131 (utils ct: volatile optimisation barrier for Condition …
ounsworth Sep 30, 2026
5d38f54
hex: decode_out no longer indexes past the end of an input ending in …
ounsworth Oct 1, 2026
af10fde
Merge branch 'feature/simple-ciphers' of git.bouncycastle.org:bc-rust…
ounsworth Oct 1, 2026
ed341fb
cli: rng no longer appends a newline to binary output -- `rng --len N…
ounsworth Oct 1, 2026
26af712
Converted cli/tests to be bash tests. Written entirely by claude/fabl…
ounsworth Oct 1, 2026
3e2a6b9
aes docs tweaks
ounsworth Oct 1, 2026
9219216
QUALITY_AND_STYLE: add Docs "Proportion" and "Release Notes" rules, w…
dghgit Oct 1, 2026
037c8f5
hazmat: a path-based notice for the raw primitives (#156)
dghgit Oct 1, 2026
160ac18
aes: project the padded aliases through core's sealed Direction::Select
dghgit Oct 1, 2026
fa3186d
Swapped around the AES_CCM convenience types to remove direction and …
ounsworth Oct 1, 2026
8dff255
BIG REFACTOR: folded crates bouncycastle-modes and bouncycastle-paddi…
ounsworth Oct 1, 2026
a27d9e6
cipher: move StreamCipher and the direction markers out of core
ounsworth Oct 1, 2026
7f985aa
Adding wycheproof test harnesses for AES_CBC and AES_GCM
ounsworth Oct 2, 2026
4c8179a
aes, cipher: doc fixes from the house-rules review, and the AESIntern…
ounsworth Oct 2, 2026
5ee8db0
utils, core: move suspendable_state out of core and into bouncycastle…
ounsworth Oct 2, 2026
28f6e34
Implemented SuspendableKeyed for AES
ounsworth Oct 2, 2026
71d1ae2
core, cipher, aes, ascon: put `_out` last in the AEAD one-shot and fi…
ounsworth Oct 2, 2026
67e6ac3
cipher, aes: suspend-and-resume round-trip tests for every mode, adap…
ounsworth Oct 2, 2026
ae09850
cipher, aes, core: CCM's trait adapters stream a fixed-length frame i…
ounsworth Oct 2, 2026
a3627b9
Merge remote-tracking branch 'upstream/feature/simple-ciphers' into f…
officialfrancismendoza Oct 2, 2026
1b70479
Merge branch 'feature/simple-ciphers' of git.bouncycastle.org:bc-rust…
ounsworth Oct 2, 2026
ca569ef
Adjusted header comment on hazmat mods
ounsworth Oct 2, 2026
bbbf333
Renamed AEADEncrypted to AEADEncryptedTuple
ounsworth Oct 2, 2026
85e39d4
Docs updates to core::traits::XOF, and updated the Security Considera…
ounsworth Oct 2, 2026
e54111c
tweaked release notes
ounsworth Oct 2, 2026
e02a11a
snipped the docstring on bench_ccm_mem_usage.rs
ounsworth Oct 5, 2026
2754e02
sm3 docs tweak
ounsworth Oct 5, 2026
6b39be5
tweak comment on utils::ct
ounsworth Oct 5, 2026
60634ad
Consistency pass over all the traits.rs to make sure than fn prefixes…
ounsworth Oct 5, 2026
539728e
Refactor / cleanup of cshake code
ounsworth Oct 6, 2026
c2fda0f
sha3: usage docs for the SP 800-185 functions -- cSHAKE, KMAC, TupleH…
dghgit Oct 6, 2026
4c79d6d
CLAUDE.md: point at the docs "Proportion" rule before committing docs…
dghgit Oct 6, 2026
05c73ae
sha3: record why KMAC's suspend/resume will be Suspendable rather tha…
dghgit Oct 6, 2026
8e455b3
sha3, mem_usage_benches: export LengthBoundSqueezer and add the SP 80…
dghgit Oct 6, 2026
05580f7
sha3: say that a suspended HMAC-SHA3 state can be inverted to the key…
dghgit Oct 6, 2026
4d632ee
sha3: ParallelHash absorbs each block into an inner SHAKE sponge as t…
dghgit Oct 6, 2026
d3e164d
sha3: Suspendable for the SP 800-185 functions -- cSHAKE, KMAC, KMACX…
dghgit Oct 6, 2026
5152be3
Re-organized SHA3 namespace (mainly for the derived functions). And s…
ounsworth Oct 6, 2026
edf4802
Refactored all bc-test-data (ACVP) and Wycheproof tests to use a cons…
ounsworth Oct 6, 2026
ea06a84
rustfmt
ounsworth Oct 6, 2026
a33d9d5
- Added dedicated Wycheproof test harnesses for ascon, cshake, gmac, …
ounsworth Oct 6, 2026
20b9051
Further consolidated test code so that all json test vectors (bc-test…
ounsworth Oct 6, 2026
cccc228
Updated comments in crypto/ascon/src/lib.rs to use verbatim language …
officialfrancismendoza Oct 7, 2026
5e2bb07
Merge branch 'feature/simple-ciphers' of ssh://git.bouncycastle.org/b…
officialfrancismendoza Oct 7, 2026
44682f2
Added ASCON memory benchas per Mike's request
officialfrancismendoza Oct 8, 2026
11eca5b
Match HTML render to SP 800-232 names
officialfrancismendoza Oct 8, 2026
44235b5
Refactor to not expose sub-modules and remove one level in import lines
officialfrancismendoza Oct 8, 2026
79c859d
Changed mode types to be unique by implementing a ModeNames trait. Th…
officialfrancismendoza Oct 8, 2026
0de70ae
Added an opt-in option for SymmetricCipherKey to bind to a specific a…
officialfrancismendoza Oct 9, 2026
bb7887c
Fixed comment descriptiveness in ascon_aead128.rs
officialfrancismendoza Oct 9, 2026
4cab1e3
Moved constants for AES to lib.rs, updated imports in schedule.rs, ha…
officialfrancismendoza Oct 9, 2026
3593670
CCM one-shots and a supplied-nonce path on the AEAD traits
dghgit Oct 10, 2026
9b12a7b
Rename Ccm to CcmPacket and give the AES_CCM_* aliases to the trait-i…
dghgit Oct 10, 2026
ee1c1a2
Rename the streaming finals do_{en,de}crypt_final_detachedtag[_out] t…
dghgit Oct 10, 2026
7eab424
core: FromKeyMaterial, the AEAD and MAC role pairs, and the hazmat mo…
dghgit Oct 8, 2026
10ea9c0
cipher: GCM mode type, GcmKeyState holding H, and Gcm constructors ov…
dghgit Oct 8, 2026
16f3343
aes: AESKey<P, M>, the mode-bound key with its GCM impls, tests and t…
dghgit Oct 8, 2026
85e5217
hmac: HmacKey<H> holding the two pad states, and a worker with no key…
dghgit Oct 8, 2026
1a4059c
hkdf: one HmacKey per PRK, a generator per output block (prototype)
dghgit Oct 8, 2026
1f0fcdc
core: in-place detached one-shots on the mode traits and the AEAD rol…
dghgit Oct 10, 2026
e35d6dc
cipher: CCM mode type and the from_perm constructors the key impls ne…
dghgit Oct 10, 2026
c530052
aes: CCM mode impls with the in-place one-shots overridden onto CcmPa…
dghgit Oct 10, 2026
9e837c4
core: share the provided one-shot bodies between the role keys and th…
dghgit Oct 10, 2026
a29d5da
core: supplied-nonce forms on the AEAD mode trait and encryption key …
dghgit Oct 10, 2026
1e86e7b
cipher: supplied-nonce constructors over a key state for the GCM and …
dghgit Oct 10, 2026
804812b
aes: encrypt_init_nonce on the GCM and CCM mode impls, CCM overriding…
dghgit Oct 10, 2026
31e95ee
cli: aes*-ccm through the key's in-place one-shots (prototype)
dghgit Oct 10, 2026
cf35698
cipher: CCM mode impls generic over the permutation, with MAX_PAYLOAD…
dghgit Oct 10, 2026
0f1e6b2
aes: drop the per-key-length CCM mode impls, now generic in cipher (p…
dghgit Oct 10, 2026
ba54227
cipher: the toy CCM tests over the mode's in-place one-shots and the …
dghgit Oct 10, 2026
c87e706
aes: the CCM tests and benches over the mode's in-place one-shots and…
dghgit Oct 10, 2026
843b4c3
mem_usage_benches: the CCM bench's direct path is the mode's in-place…
dghgit Oct 10, 2026
9e08ded
cipher: CcmPacket crate-private, with suspend/resume on CcmEncryptor …
dghgit Oct 10, 2026
227e5a4
aes: drop the AES_CCM_*_Packet aliases; docs over the pair and the mo…
dghgit Oct 10, 2026
95b1ded
cipher: the packet type's methods are crate-private like the type (pr…
dghgit Oct 10, 2026
7d72fab
core: worker traits and the packet role and mode traits that take the…
dghgit Oct 10, 2026
bf9d63c
cipher: CCM<N, T> on the packet mode traits, with CcmPacketEncryptor …
dghgit Oct 10, 2026
d0822c6
aes: AESKey forwards the packet roles; CCM key tests in their own fil…
dghgit Oct 10, 2026
fa6f741
cli: aes*-ccm keys are AES*Key<CCM<N, T>> on the packet roles (protot…
dghgit Oct 10, 2026
f020f13
mem_usage_benches: CCM<N, T> (prototype)
dghgit Oct 10, 2026
83fca27
core-test-framework: TestFrameworkMAC's weak-key check takes the leng…
dghgit Oct 10, 2026
0fd66e7
core: MacMode, the hazmat mode trait a MAC mode implements, which the…
dghgit Oct 10, 2026
e342343
cipher: Cmac over a CmacKeyState, with CMAC as the mode marker and CM…
dghgit Oct 10, 2026
c50f7d7
aes: AES_CMAC_128/192/256 and AES*Key<CMAC> on the MAC roles (prototype)
dghgit Oct 10, 2026
6a76e09
cipher: Gmac over a GcmKeyState, with GMAC as the mode marker and GMA…
dghgit Oct 10, 2026
de738a9
aes: AES_GMAC_128/192/256 and AES*Key<GMAC> with an inherent generato…
dghgit Oct 10, 2026
615865e
core: Mode::ALG_NAME, the mode's algorithm name over its permutation,…
dghgit Oct 11, 2026
db4fb65
aes: AES*Key checks the material's algorithm binding at construction …
dghgit Oct 11, 2026
83ccf4d
Merge branch 'release/0.1.3alpha' into feature/simple-ciphers
dghgit Oct 11, 2026
494d289
Merge remote-tracking branch 'origin/feature/simple-ciphers' into fea…
dghgit Oct 13, 2026
ddde0e3
ascon: AsconAead128<Dir>, the direction in the type rather than a sta…
dghgit Oct 16, 2026
50f5e00
Merge branch 'feature/simple-ciphers' into feature/key-rework
dghgit Oct 16, 2026
c807868
ascon: do_encrypt_inplace / do_decrypt_inplace, named for what they do
dghgit Oct 16, 2026
2a58ec4
Merge branch 'feature/simple-ciphers' into feature/key-rework
dghgit Oct 16, 2026
e4e254f
ascon: the AEAD trait pair is the whole public API; the cipher type i…
dghgit Oct 16, 2026
f137c31
Merge branch 'feature/simple-ciphers' into feature/key-rework
dghgit Oct 16, 2026
eec1039
ascon: AsconAEAD128<Dir> implements the traits itself; Ascon_AEAD128<…
dghgit Oct 16, 2026
a492a40
Merge branch 'feature/simple-ciphers' into feature/key-rework
dghgit Oct 16, 2026
a46c741
ascon: Ascon_AEAD128<Dir> is the struct; the alias goes
dghgit Oct 16, 2026
53a837b
CLAUDE.md: lessons from the Ascon-AEAD128 refactors
dghgit Oct 16, 2026
8a1bc15
Merge branch 'feature/simple-ciphers' into feature/key-rework
dghgit Oct 16, 2026
9320f48
cipher: CcmPacket::do_decrypt_inplace, named for what it does
dghgit Oct 16, 2026
a1cce55
cipher: CcmPacket::do_encrypt_inplace, to match the decrypt side
dghgit Oct 16, 2026
7084adb
cipher: gcm doc line caught by the CCM rename, restored
dghgit Oct 16, 2026
69e24ba
Merge branch 'feature/simple-ciphers' into feature/key-rework
dghgit Oct 16, 2026
61ea8c7
core: the symmetric, block and ECB key paths -- role pairs and mode p…
dghgit Oct 19, 2026
1e6e340
core-test-framework: key-generic runners and the construction suites …
dghgit Oct 19, 2026
521efaf
cipher: mode types for the symmetric, block and ECB paths, and CCMFra…
dghgit Oct 19, 2026
14da08b
core-test-framework: MAC suite entry point for fixed-length tags
officialfrancismendoza Oct 19, 2026
84ae477
core: KeyMaterial::from_rng caps the strength at the key length
dghgit Oct 19, 2026
63ddca3
cipher: tests onto the key path (prototype)
dghgit Oct 19, 2026
8ca666f
cipher: doc examples onto the mode-trait route (prototype)
dghgit Oct 19, 2026
ebf3a19
chacha20: ChaCha20KeyStream under hazmat, ChaCha20 as a StreamCipher …
officialfrancismendoza Oct 19, 2026
d33e773
chacha20-poly1305-aead: limit tests in a trailing mod tests, not a #[…
officialfrancismendoza Oct 19, 2026
7d0afb2
ascon: AsconAEAD128Key (prototype)
dghgit Oct 19, 2026
b962758
sha3: KMACKey (prototype)
dghgit Oct 19, 2026
9900c71
hmac: HmacKey::generate caps the strength at the key length
dghgit Oct 19, 2026
d1d4e06
factory: MACFactory builds the MAC key objects (prototype)
dghgit Oct 19, 2026
a680e92
poly1305: barrier the final select; precompute 5*r; run the MAC frame…
officialfrancismendoza Oct 19, 2026
1b9d213
core-test-framework, chacha20, poly1305, chacha20-poly1305-aead: one …
officialfrancismendoza Oct 19, 2026
d134374
cli: AEAD stream helpers generic over the AEAD traits, not over GCM's…
officialfrancismendoza Oct 19, 2026
7ec708d
factory, cli: Poly1305 in MACFactory; chacha20, chacha20-poly1305 and…
officialfrancismendoza Oct 19, 2026
42f9285
chacha20, poly1305, chacha20-poly1305-aead: benches, doc sections, no…
officialfrancismendoza Oct 19, 2026
986853f
aes: the symmetric, block and ECB roles on AESKey, and everything ont…
dghgit Oct 19, 2026
b73b75f
cli: the cipher commands build key objects (prototype)
dghgit Oct 19, 2026
9bed62b
core: the cipher and MAC traits lose their constructors and key-takin…
dghgit Oct 19, 2026
1086d4b
core, cipher: CCM_Packet names the fixed-frame CCM pair, and the decl…
dghgit Oct 20, 2026
1f1820b
core, cipher: workers borrow the key state instead of copying the sch…
dghgit Oct 19, 2026
7f7f477
core, cipher: BlockPermutation splits from ElectronicCodeBook; the ke…
dghgit Oct 19, 2026
2da34b2
hmac, ascon, factory: the HMAC worker borrows its key, and resume tak…
dghgit Oct 19, 2026
59c42df
hmac: HmacKey::inner_state and finish_out are doc(hidden) (prototype)
dghgit Oct 20, 2026
af15bb9
ascon: the stack-usage table re-measured on the key path (prototype)
dghgit Oct 20, 2026
4900d24
Merge feature/simple-ciphers and migrate ChaCha20-Poly1305 API
officialfrancismendoza Oct 20, 2026
8321b08
Migrate ChaCha20-Poly1305 to updated cipher API
officialfrancismendoza Oct 20, 2026
5719886
Merge PR #172 key-management redesign into ChaCha20-Poly1305
officialfrancismendoza Oct 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
Cargo.lock
**/target
mutants.out*/
custom_mutants_output/


.idea/
.vscode/

# editor swap / backup files
*.swp
*.swo
*~

# Claude Code: ignore personal/local state, but share team tooling
# (skills, slash commands and subagents). settings.json stays local, so personal permission
# allowlists cannot ride along in a PR.
.claude/*
!.claude/skills/
!.claude/commands/
!.claude/agents/
.claude/settings.local.json
.claude 2/
158 changes: 143 additions & 15 deletions CLAUDE.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Some specifics:
* Public APIs of a library should be both ergonomic and expressive. When defining a new trait or public function, ask
yourself whether a programmer who is new to cryptography is likely to use this in a way that will get them into
trouble.
* Variables should be well-named, well-structured, and well-commented (a comment-to-code ration of 1:1 is a goal to be
* Variables should be well-named, well-structured, and well-commented (a comment-to-code ratio of 1:1 is a goal to be
strived for!). Think about memory footprint and, where possible, use unnamed scopes to allow the compiler to pop
intermediate value variables off the stack as soon as they are no longer needed.
* Always run your code through `cargo mutants` and get the issue count as low as your can. As a first pass, this forces
* Always run your code through `cargo mutants` and get the issue count as low as you can. As a first pass, this forces
you to write thorough unit tests. As a second pass, this draws your attention to bits of your code that cannot be
tested from the outside. Often this means that the code can be simplified without affecting functionality (as defined
by your set of unit tests) -- "simpler code" usually means faster runtime and easier future maintenance.
Expand All @@ -71,7 +71,7 @@ For minor updates, you can instead choose to create an issue with short snippets

* For contributions touching multiple files try and split up the pull request, smaller changes are easier to review and
test, as well as being less likely to run into merge issues.
* Create a test cases for your change, it may be a simple addition to an existing test. If you do not know how to do
* Create test cases for your change; it may be a simple addition to an existing test. If you do not know how to do
this, ask us and we will help you.
* If you run into any merge issues, check out this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to
help you resolve merge conflicts and other issues.
Expand Down
16 changes: 16 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ members = ["cli", "crypto/*", "mem_usage_benches"]

[workspace.package]
edition = "2024"
# `bouncycastle-utils` uses `slice::as_chunks`, stable since 1.88; the 2024 edition alone needs 1.85.
rust-version = "1.88"
version = "0.1.3"

[workspace.dependencies]

# *** Internal Dependencies ***
bouncycastle = { path = "./" }
bouncycastle-aes = { path = "./crypto/aes" }
bouncycastle-ascon = { path = "./crypto/ascon" }
bouncycastle-base64 = { path = "./crypto/base64" }
bouncycastle-chacha20 = { path = "./crypto/chacha20" }
bouncycastle-chacha20-poly1305-aead = { path = "./crypto/chacha20-poly1305-aead" }
bouncycastle-cipher = { path = "./crypto/cipher" }
bouncycastle-core = { path = "crypto/core" }
bouncycastle-core-test-framework = { path = "./crypto/core-test-framework" }
bouncycastle-factory = { path = "./crypto/factory" }
Expand All @@ -20,9 +27,11 @@ bouncycastle-mlkem = { path = "./crypto/mlkem" }
bouncycastle-mlkem-lowmemory = { path = "./crypto/mlkem-lowmemory" }
bouncycastle-mldsa = { path = "./crypto/mldsa" }
bouncycastle-mldsa-lowmemory = { path = "./crypto/mldsa-lowmemory" }
bouncycastle-poly1305 = { path = "./crypto/poly1305" }
bouncycastle-rng = { path = "./crypto/rng" }
bouncycastle-sha2 = { path = "./crypto/sha2" }
bouncycastle-sha3 = { path = "./crypto/sha3" }
bouncycastle-sm3 = { path = "./crypto/sm3" }
bouncycastle-utils = { path = "./crypto/utils" }


Expand All @@ -41,7 +50,12 @@ version.workspace = true
edition.workspace = true

[dependencies]
bouncycastle-aes.workspace = true
bouncycastle-ascon.workspace = true
bouncycastle-base64.workspace = true
bouncycastle-chacha20.workspace = true
bouncycastle-chacha20-poly1305-aead.workspace = true
bouncycastle-cipher.workspace = true
bouncycastle-core.workspace = true
bouncycastle-factory.workspace = true
bouncycastle-hex.workspace = true
Expand All @@ -51,6 +65,8 @@ bouncycastle-mldsa.workspace = true
bouncycastle-mldsa-lowmemory.workspace = true
bouncycastle-mlkem.workspace = true
bouncycastle-mlkem-lowmemory.workspace = true
bouncycastle-poly1305.workspace = true
bouncycastle-rng.workspace = true
bouncycastle-sha2.workspace = true
bouncycastle-sha3.workspace = true
bouncycastle-sm3.workspace = true
165 changes: 123 additions & 42 deletions INTRODUCTION.md

Large diffs are not rendered by default.

136 changes: 133 additions & 3 deletions QUALITY_AND_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ testing must also be contained within the `mod tests {}` block.

All traits in `bouncycastle-core` must have corresponding tests in `bouncycastle-core-test-framework` that exercise all
behaviours and error conditions that are common to all implementations of that trait.
`bouncycastle-core-test-framework` is test infrastructure only: it goes under `[dev-dependencies]` and is never a
runtime dependency, since it ships a deterministic `FixedSeedRNG`.

All crypto algorithms must have tests against the bc-test-data repo and against wycheproof.

Expand Down Expand Up @@ -65,7 +67,16 @@ which parts were done for a very specific reason and should not be changed on a

## Naming Conventions

All normal rust naming convensions from clippy apply. In addition, some library-specific naming conventions:
All normal rust naming conventions from clippy apply, with one exception:

* Where a type, constant or variable corresponds to something a specification (FIPS, RFC, etc) names, keep the
specification's spelling and capitalization, and `#[allow(non_camel_case_types)]`, `#[allow(non_snake_case)]` or
`#[allow(non_upper_case_globals)]` the item locally. So the FIPS 204 signature algorithm is `MLDSA65`, not `MlDsa44`,
and it's `AES_CBC_128`, not `AesCbc128`, and if a specification writes `A` for a matrix and `a` for a vector then
`let A = ...; let a = ...;` is the right thing to do for code readability and correspondence with the spec. The point
is that a reviewer with the specification open can match names by eye; that matters more here than rust convention.

In addition, some library-specific naming conventions:

* In constants, "LEN" is the length of a value in bytes (typically used for sizing arrays), whereas "SIZE" is a value in
bits (typically used as a security parameter). For example SHA256 could have constants `HASH_SIZE = 256` and
Expand All @@ -77,7 +88,13 @@ All normal rust naming convensions from clippy apply. In addition, some library-
## APIs

Where possible, primitives should expose "one-shot APIs" that simply take data and return a result as a static member
function that does not require object instantiation.
function that does not require object instantiation. The exception is anything keyed: a symmetric cipher or MAC is
reached through a key object (`AES128Key<GCM>`, `HmacKey<SHA256>`, `KMAC128Key`, `AsconAEAD128Key`), built once from
`KeyMaterial` by `FromKeyMaterial` / `FromAnyKeyMaterial`, and its one-shots and `create_*` constructors are methods on
that key. The cipher and MAC traits in `core::traits` describe a worker that already exists and carry no constructor
and no key-taking method, so a key's validation and expansion happen once, where the key is made, rather than per call.
A worker borrows the key it came from, for the lifetime on the role trait's associated worker type, so making one
copies no schedule and a worker cannot outlive its key.

Other version of Bouncy Castle have a design pattern where stateful objects follow a pattern of new () -> init () ->
do_update () -> do_final (), and then optionally reset () that sets the object back to an unitialized state. Instead,
Expand All @@ -90,6 +107,64 @@ very little) object state to track and return errors about.

Any struct that holds sensitive data must impl the `core::Secret` trait and all associated super-traits.

A primitive whose safe use depends on the caller composing it correctly -- a raw block permutation, a raw keystream
-- lives under a `hazmat` module in its crate or sub-module, never at the crate root or next to the safe API;
`bouncycastle_core::hazmat` defines the term and the supported uses. A crate or sub-module with such items declares
`pub mod hazmat;`
in its `lib.rs` and neither the crate nor the sub-module ever `pub use`s anything out of it, since a re-export would
bypass the notice.

Any function that writes into a caller-provided output buffer must report how many bytes it wrote, as a `usize` in
its `Ok` value (on its own, or alongside anything else the function needs to return, such as a generated IV). This
holds even when the count is fully determined by the input -- a fixed-length `[u8; LEN]` buffer, say, always writes
exactly `LEN` -- so that callers never have to remember which output-buffer methods report their length and which
don't.

### fn prefixes and suffixes

Function prefixes and suffixes are used consistently across the library.

Take, for example a one-shot API `fn encrypt(plaintext: &[u8]) -> Result<Vec<u8>, SymmetricCipherError>`.

The following prefixes can be applied:

* `do_`: this implies that it is part of a stateful streaming API, will typically take `&mut self`, and is likely
accompanied by a `do_encrypt_final()`; the object comes from a key's `create_encryptor()`.
* `create_`: a key object's constructor for a worker -- `create_encryptor(&self, rng)`, `create_decryptor(&self,
init_data)`, `create_generator(&self)`, `create_verifier(&self)`. Whatever draws randomness takes a `&mut dyn RNG`
explicitly, so a key has no `_rng` twins and no method that reaches for a default RNG.

The following suffixes can be applied

* `_update / _final`: indicates phase of a stateful streaming API. Other verbs can be used here as appropriate to the
primitive, such as `absorb / squeeze`, `encrypt / decrypt`, etc. `_final` indicates that this function call renders
the object unusable afterwards by consuming `self` via a move: `_final(self, ..)`.
* `_rng`: indicates that this version of the function sources its random numbers from a provided `&mut dyn RNG` instead
of from the default library RNG. `_rng(.., &mut dyn RNG)`. Keyed primitives do not have it: their constructors and
one-shots take the RNG, full stop.
* `_nonce`: on an AEAD key, the twin that takes the nonce from the caller instead of drawing it from the RNG, and so
does not return one.
* `_out / _inplace`: indicates that the function works in the provided buffer. `_out` indicates that the function takes
an output buffer, which may be oversized, and returns the number of bytes written to it:
`_out(.., out: &mut [u8] -> Result<usize, SymmetricCipherError>`. `_inplace` indicates that the input and output are
required to be the same size, and so the function uses the same buffer for input and output:
`_inplace(.., data: &mut [u8]) -> Result<usize, SymmetricCipherError>`. It is assumed that these will be
memory-efficient and work in the provided buffer instead of creating duplicate data on the stack.
* `_out_len`: a pair for an `_out` function that computes the minimum size of the output buffer required for the paired
`_out` function to succeed. This may be an over-estimate in order to guarantee success, for example if the size of the
required output buffer depends on the contents, and a subsequent call to the paired `_out` function does not actually
fill all of the requested space.

Where multiple suffixes are present on a single function, they should go in this order:

```text
_{init, update, final, etc}_{rng}_{out, out_len, inplace}
```

Any function that takes an output buffer via an `_out` function must zeroize the provided output buffer via a
`out.fill(0)` prior to writing to it. This must be done first, before even any error checking so that no stale content
is left in the output buffer, even in the case of an error.

## Fallibility

As much as humanly possible, Result and unwrap () should be used for "Bad input data" type things and not "Programmer
Expand Down Expand Up @@ -130,8 +205,55 @@ Note that rust macros tend not to play well with a lot of dev tooling for compil
`cargo mutants`, which is a good reason to avoid macros in core algorithm or data processing code. Macros can be used
more freely within test code.

## Unit tests vs integration tests

Unit tests are test code (and supporting helper functions) embedded in src/**.rs files. They have access to
crate-private or module-private functions and constants.

Integration tests are test code (and supporting helper functions) in tests/**.rs files. They test the crate's code from
the outside -- ie through its public APIs -- since tests/ is a separate crate from src/.

In general, integration tests are preferred over unit tests. This is for a number of reasons:

* To reduce reviewer burden; reviewers will typically focus more effort on the src/ than the tests/, so we want to keep
src/ as short as is reasonable.
* Usually it is easier to determine what is the correct behaviour at the public API level. For example, this is the
level at which we typically have KATs and test vectors.
* Tools like cargo mutants are very helpful at detecting branches that are not exercisable via the public APIs, which
often is an indicator that the branch isn't doing what you think it's doing, or is simply not useful and can be
deleted. Unit tests that bypass the public APIs to pin these sorts of branches obscure the fact that this code is
unreachable.

Unit tests are reasonable to include in the following cases:

* There is high-risk code (usually meaning that it is complex code whose behaviour is not obvious from inspection) where
unit tests help to document the behaviour and protect against accidental breakage via a benign-looking change.
* AND where known answer tests are available.
* AND where this behaviour cannot be tested from integration tests.

When writing unit tests, they should be contained with an `mod tests` at the bottom of the file, and ALL helper
functions that support the unit tests must be contained within that module. The intention is to clearly signal to a code
reviewer what is test code vs functional code.

# Docs

## Proportion

Docs are a reading cost, so default to short. Each fact has one home: the crate docs are an overview plus links, and
the detail lives on the type or module it describes. Rationale is a sentence or two next to the code; history and
derivations go in the commit message. Give a few examples, not one per variant; keep memory tables to the figures,
without a per-row essay; keep CLI docs out of library crates; and never repeat a spec quote across files. Before adding
material, check whether the crate already states it.

## No internal implementation detail in public API docs

The doc comment on a `pub` item is read by a calling application, so it says what the caller can observe and must
do: the contract, the buffers and lengths involved, the errors and when they occur. How the implementor meets that
contract -- which bytes it holds back and why, which private helper runs, how another implementor does it, the design
rationale for a trait's shape -- belongs in a `//` comment next to the code, on the private item, or in the commit
message. A trait's docs in particular describe the trait, not any one implementor. When reviewing, read each public
doc comment as a user with no access to the source and strike anything that only makes sense with it.

## Usage Examples

The crate docs needs a section "Usage Examples" with sample code for all the major usage patterns of the primitives in
Expand All @@ -146,4 +268,12 @@ the crate.

Most crates should have a "Security Considerations" section that documents any footguns where the user of this crate
could undermine their own security; for example where providing a seed or a nonce that is not truly random would
completely undermine the algorithm.
completely undermine the algorithm.

The heading is always exactly `# 🚨 Security Considerations 🚨`, wherever it appears: crate docs, module docs, or the
docs of an individual type or function. A consistent heading makes these sections easy to spot when reading and to find
with a search.

## Release Notes

For release note entries, keep succinct, one line per significant change at most.
34 changes: 32 additions & 2 deletions alpha_0.1.3_release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,38 @@

## Major features

* New algorithms added to crypto/ :
* SM3 -- the SM3 hash (GB/T 32905-2016 / ISO/IEC 10118-3:2018), ported from bc-java.
* AES -- AES-128/192/256, along with its modes AES_ECB, AES_CBC, AES_CCM, AES_CFB, AES_CFB8, AES_CTR, and AES_GCM.
* ASCON -- Ascon-AEAD128, Ascon-Hash256, Ascon-XOF128 and Ascon-CXOF128 (NIST SP 800-232).
* CHACHA20 -- ChaCha20, Poly1305 and ChaCha20-Poly1305 (RFC 8439).
* Further memory usage improvements on ML-DSA / ML-KEM. New figures for the largest size are:
* ML-DSA-87/Sign 118 kb, ML-DSA-87/Verify 212 kb
* ML-DSA-87_lowmemory/Sign 25 kb, ML-DSA-87_lowmemory/Verify 21 kb
* ML-KEM-1024/Encaps 44 kb, ML-KEM-1024/Decaps 58 kb
* ML-KEM-1024_lowmemory/Encaps 11 kb, ML-KEM-1024/Decaps 21 kb
* Performance (throughput) actually saw a slight performance increase as this cleanup was largely about finding and
removing unnecessary memcpy's.

## Minor features / bug fixes

* bug fixes to the way SHA3/SHAKE handled absorbing and squeezing a partial final byte.
* Design discussions about whether core::traits::XOF (in the abstract) should allow interleaving absorb -> squeeze ->
absorb (ie "absorb-after-squeeze). Outcome: absorb-after-squeeze forbidden. Could be changed in the future.
absorb (ie "absorb-after-squeeze). Outcome: absorb-after-squeeze forbidden. Could be changed in the future. Refactored
to an `XOF::xof()`, `XOF.into_squeezer()`, 'XOFSqueezer.output ()' shape.
* SHA2:
* Implemented SHA512/224 and SHA512/256.
* `Hash::do_final_partial_bits()` / `do_final_partial_bits_out()` are now implemented for SHA-2 (FIPS 180-4 s. 5.1).
* SHA3:
* Fixed a bug in `XOF::squeeze_partial_byte_final()`: when it was the first squeeze it bypassed the SHAKE `1111`
domain suffix and returned raw Keccak output, and it returned the wrong `num_bits` bits of the output byte.
* Changed the order of bits when absorbing a final partial byte to match ASN.1 DER BIT_STRING bit ordering.
* The constant-time helpers in bouncycastle-utils now use a more robust optimization barrier based on unsafe
`read_volatile` / `write_volatile` instead of `core::hint::black_box`, which is documented as best-effort only.
* Added the `hazmat` module convention for primitives whose safe use is the caller's job; `bouncycastle_core::hazmat`
defines it.
* The `do_hazardous_operations` handler for `KeyMaterial` is now `hazmat`.
* ML-KEM `encaps_internal` is now `hazmat::EncapsWithRandomness::encaps_with_randomness`, and
`HashDRBG80090A::new_unititialized` is `hazmat::NewUninitialized::new_uninitialized` (typo fixed); both are
extension traits, so the call needs the `hazmat` import.
* New cipher-related features `ElectronicCodeBook`, `KeyStream`, the `AES*Internal` types, `Ecb` and `AES_ECB_*`,
and `CtrKeyStream` under their crates' `hazmat` modules.
Loading
Loading