feat(mix): use LIONESS for Sphinx payload encryption#2349
Closed
chaitanyaprem wants to merge 1 commit into
Closed
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2349 +/- ##
==========================================
+ Coverage 73.48% 73.58% +0.10%
==========================================
Files 168 169 +1
Lines 22254 22362 +108
Branches 20 20
==========================================
+ Hits 16353 16455 +102
- Misses 5901 5907 +6
🚀 New features to boost your workflow:
|
3 tasks
bkomuves
reviewed
Apr 28, 2026
bkomuves
reviewed
Apr 28, 2026
bkomuves
reviewed
Apr 28, 2026
bkomuves
reviewed
Apr 28, 2026
bkomuves
reviewed
Apr 28, 2026
bkomuves
reviewed
Apr 28, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c518502 to
99774ab
Compare
This was referenced Apr 30, 2026
Contributor
Author
|
Closing this PR as this will be now tracked at logos-co/nim-libp2p-mix#1 |
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.
Summary
Replaces AES-CTR delta (payload) encryption in the Sphinx mix protocol with LIONESS, a wide-block PRP. Header encryption stays AES-CTR — only the payload is migrating.
This closes the payload integrity gap as per logos-co/logos-lips#306: under AES-CTR, tampering past the leading-zeros window was undetectable because XOR encryption is malleable. With LIONESS, any single-bit flip in the ciphertext diffuses across the whole plaintext on decrypt, scrambling the leading-zeros tag at the exit hop. The integrity test from #2233 is included verbatim and now passes.
processReplyadditionally verifies the leading-zeros tag after unwrapping (was unchecked under AES-CTR).For construction details see the design notes. A formal spec update is in progress (logos-co/logos-lips#306).
Affected Areas
Compatibility & Downstream Validation
Wire-incompatible with prior AES-CTR-only nodes on the payload path. Header format unchanged.
Impact on Library Users
mix_protocol.nim.libp2p/protocols/mix/lioness.nimexports the standalone cipher.Risk Assessment
Payload encryption is security-critical. Requesting review from cryptography researchers before merge — round structure, SHAKE128 KDF, and key-derivation chain are the focus areas.
References
Additional Notes