Fix udp15Server decrypt IV: use server_nonce, not client_nonce
SetUDP15Crypto was initializing udp15Server with setup15(key, serverNonce, clientNonce), which set decryptIV=clientNonce. But the server encrypts with server_nonce, so the client-side decryptIV must be server_nonce. The incoming IV byte from the server was 0x58, but our decryptIV[0] was 0xab (client_nonce[0]). Diff of -83, way outside the ±30 acceptance window. Now udp15Server.decryptIV is directly set to server_nonce.
This commit is contained in:
committed by
Brandon McGinty
parent
4c7731043c
commit
e93087afeb
@@ -412,6 +412,8 @@ var udp15Client *cryptState15
|
||||
var udp15Server *cryptState15
|
||||
|
||||
// SetUDP15Crypto installs the 1.5 native UDP crypto state from CryptSetup.
|
||||
// udp15Client: encrypts with client_nonce (outbound).
|
||||
// udp15Server: decrypts with server_nonce (inbound).
|
||||
func SetUDP15Crypto(key, clientNonce, serverNonce []byte) {
|
||||
csClient := &cryptState15{}
|
||||
if err := csClient.setup15(key, clientNonce, serverNonce); err != nil {
|
||||
@@ -420,11 +422,12 @@ func SetUDP15Crypto(key, clientNonce, serverNonce []byte) {
|
||||
}
|
||||
udp15Client = csClient
|
||||
|
||||
// Server state: we only use decryptIV (to decrypt server→client packets).
|
||||
// The server encrypts with server_nonce, so our decryptIV must be server_nonce.
|
||||
csServer := &cryptState15{}
|
||||
if err := csServer.setup15(key, serverNonce, clientNonce); err != nil {
|
||||
log.Error("SetUDP15Crypto server: %v", err)
|
||||
return
|
||||
}
|
||||
copy(csServer.key[:], key)
|
||||
copy(csServer.decryptIV[:], serverNonce)
|
||||
csServer.initialized = true
|
||||
udp15Server = csServer
|
||||
|
||||
log.Info("Mumble 1.5 native UDP crypto initialized")
|
||||
|
||||
Reference in New Issue
Block a user