-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add experimental hybrid post-quantum handshake using Kyber-1024 and Dilithium #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mateusvff
wants to merge
25
commits into
WireGuard:master
Choose a base branch
from
Mateusvff:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…ed secret derivation
…ivate keys in Device struct
… marshaling and unmarshaling
New tests
[PQ Authentication] ML-DSA 5 implementation
feat: add tests for MLDSA
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
This pull request adds experimental support for a hybrid post-quantum handshake to
wireguard-go, combining the existing X25519-based key agreement with ML-KEM (Kyber-1024) and ML-DSA (Dilithium) for authentication. The goal is to provide a prototype implementation of a post-quantum–ready WireGuard handshake while preserving the original Noise_IK pattern and existing behaviour for non-PQ peers.The implementation is based on the
circlcryptographic library from Cloudflare, which provides Go implementations of Kyber and Dilithium.Design overview
The implementation is split into two main parts:
Hybrid key agreement (ML-KEM / Kyber-1024)
MessageInitiationand is encrypted within the Noise handshake.combinedSecret, which feeds into the existing Noise key schedule.Hybrid authentication (ML-DSA / Dilithium)
MessageInitiationis extended with aSignaturefield that carries a Dilithium signature over the serialized message fields (excluding MAC and signature fields).Implementation details
New sizes and types
MLKEMPublicKeySize,MLKEMPrivateKeySize,MLKEMCiphertextSize.MLDSAPublicKeySize,MLDSAPrivateKeySize,MLDSASignatureSize.device/noise-types.go.Extended identity and handshake structures
staticIdentitynow includes:mlkemPrivateKey,mlkemPublicKeymldsaPrivateKey,mldsaPublicKeyHandshakenow includes:remoteMLKEMStatic(peer’s ML-KEM public key)remoteMLDSAStatic(peer’s ML-DSA public key)Handshake protocol changes
device/noise-protocol.go:MessageInitiationwas extended with:MLKEMfield to carry the Kyber ciphertext.Signaturefield to carry the Dilithium signature.CreateMessageInitiation:kyber1024.Scheme().Encapsulate(remoteMLKEMStatic)to obtainmlkemSecretandciphertext.ciphertextintomsg.MLKEM.mlkemSecretviaKDF2intocombinedSecret.msg.Signature.ConsumeMessageInitiation:remoteMLDSAStaticand verifiesmsg.Signaturewith the Dilithium verification routine.msg.MLKEMand callsDecapsulatewith the local ML-KEM private key to recovermlkemSecret.combinedSecretusing the same KDF and continues with the existing Noise key schedule.UAPI and key management
device/uapi.gowas updated to accept:mlkem_private_key,mlkem_public_keymldsa_private_key,mldsa_public_keydevice/quantum-keys.gowas added providing:GenerateQuantumKeyPairfor Kyber-1024 key pairs.GenerateMLDSAKeyPairfor Dilithium5 key pairs.circl’skem.SchemeAPI for Kyber (viaGenerateKeyPair) andsign.Schemefor Dilithium (viaGenerateKey).Compatibility
Testing
Unit tests
Integration tests
Manual validation