Some fixes for SIDH

This commit is contained in:
Frank Denis 2018-02-13 16:57:38 +01:00
parent b5d6938dbf
commit 05ebd385da
2 changed files with 6 additions and 2 deletions

View File

@ -88,7 +88,7 @@ func (proxy *Proxy) Decrypt(serverInfo *ServerInfo, encrypted []byte, nonce []by
}
var packet []byte
var err error
if serverInfo.CryptoConstruction == XChacha20Poly1305 {
if serverInfo.CryptoConstruction == XChacha20Poly1305 || serverInfo.CryptoConstruction == SIDHXChacha20Poly1305 {
packet, err = xsecretbox.Open(nil, serverNonce, encrypted[responseHeaderLen:], serverInfo.SharedKey[:])
} else {
var xsalsaServerNonce [24]byte

View File

@ -151,7 +151,11 @@ func FetchCurrentDNSCryptCert(proxy *Proxy, serverName *string, proto string, pk
certInfo.SharedKey = sharedKey
highestSerial = serial
certInfo.CryptoConstruction = cryptoConstruction
copy(certInfo.MagicQuery[:], binCert[104:112])
if cryptoConstruction == SIDHXChacha20Poly1305 {
copy(certInfo.MagicQuery[:], binCert[636:644])
} else {
copy(certInfo.MagicQuery[:], binCert[104:112])
}
if isNew {
dlog.Noticef("[%s] OK (crypto v%d) - rtt: %dms", *serverName, cryptoConstruction, rtt.Nanoseconds()/1000000)
} else {