Adds MLKEM Payload placeholder to client internals

This commit is contained in:
riccardom
2026-08-27 12:18:07 +02:00
parent 1cab588bc0
commit 87fbf0ac26
4 changed files with 14 additions and 0 deletions
+1
View File
@@ -2839,6 +2839,7 @@ func convertToOfferAnswer(msg *sProto.Message) (*peer.OfferAnswer, error) {
Version: msg.GetBody().GetNetBirdVersion(), Version: msg.GetBody().GetNetBirdVersion(),
RosenpassPubKey: rosenpassPubKey, RosenpassPubKey: rosenpassPubKey,
RosenpassAddr: rosenpassAddr, RosenpassAddr: rosenpassAddr,
MlkemPayload: msg.GetBody().GetMlkemPayload(),
RelaySrvAddress: msg.GetBody().GetRelayServerAddress(), RelaySrvAddress: msg.GetBody().GetRelayServerAddress(),
RelaySrvIP: relayIP, RelaySrvIP: relayIP,
SessionID: sessionID, SessionID: sessionID,
+6
View File
@@ -39,6 +39,12 @@ type OfferAnswer struct {
// This value is the local Rosenpass server address when sending the message // This value is the local Rosenpass server address when sending the message
RosenpassAddr string RosenpassAddr string
// MlkemPayload carries the post-quantum X25519MLKEM768 handshake message
// (pqkem-framed offer on an OFFER, answer on an ANSWER) that seeds the
// WireGuard PSK. Opaque here — the pqkem library frames and parses it. Nil
// when the peer does not run the ML-KEM PQ exchange.
MlkemPayload []byte
// relay server address // relay server address
RelaySrvAddress string RelaySrvAddress string
// RelaySrvIP is the IP the remote peer is connected to on its // RelaySrvIP is the IP the remote peer is connected to on its
+1
View File
@@ -63,6 +63,7 @@ func (s *Signaler) signalOfferAnswer(offerAnswer OfferAnswer, remoteKey string,
}, },
RosenpassPubKey: offerAnswer.RosenpassPubKey, RosenpassPubKey: offerAnswer.RosenpassPubKey,
RosenpassAddr: offerAnswer.RosenpassAddr, RosenpassAddr: offerAnswer.RosenpassAddr,
MlkemPayload: offerAnswer.MlkemPayload,
RelaySrvAddress: offerAnswer.RelaySrvAddress, RelaySrvAddress: offerAnswer.RelaySrvAddress,
RelaySrvIP: offerAnswer.RelaySrvIP, RelaySrvIP: offerAnswer.RelaySrvIP,
SessionID: sessionIDBytes, SessionID: sessionIDBytes,
+6
View File
@@ -52,6 +52,9 @@ type CredentialPayload struct {
Credential *Credential Credential *Credential
RosenpassPubKey []byte RosenpassPubKey []byte
RosenpassAddr string RosenpassAddr string
// MlkemPayload is the opaque post-quantum KEM handshake message riding this
// OFFER/ANSWER (see Body.mlkemPayload). Nil when not running the PQ exchange.
MlkemPayload []byte
RelaySrvAddress string RelaySrvAddress string
RelaySrvIP netip.Addr RelaySrvIP netip.Addr
SessionID []byte SessionID []byte
@@ -89,6 +92,9 @@ func MarshalCredential(myKey wgtypes.Key, remoteKey string, p CredentialPayload)
if p.RelaySrvIP.IsValid() { if p.RelaySrvIP.IsValid() {
body.RelayServerIP = p.RelaySrvIP.Unmap().AsSlice() body.RelayServerIP = p.RelaySrvIP.Unmap().AsSlice()
} }
if len(p.MlkemPayload) > 0 {
body.MlkemPayload = p.MlkemPayload
}
return &proto.Message{ return &proto.Message{
Key: myKey.PublicKey().String(), Key: myKey.PublicKey().String(),
RemoteKey: remoteKey, RemoteKey: remoteKey,