Officially Break backwards-compatitbility with Ricochet-IM

This commit is contained in:
Sarah Jamie Lewis 2019-01-23 11:57:43 -08:00
parent 7a4350f0c1
commit 96fc03580b
5 changed files with 8 additions and 8 deletions

View File

@ -123,7 +123,7 @@ func TestProcessAuthTimeout(t *testing.T) {
}() }()
conn, _ := ln.Accept() conn, _ := ln.Accept()
// Giving the client inconsistent keypair to make EDH fail
pub, priv, _ := ed25519.GenerateKey(rand.Reader) pub, priv, _ := ed25519.GenerateKey(rand.Reader)
rc := NewInboundConnection(conn) rc := NewInboundConnection(conn)
err := HandleInboundConnection(rc).ProcessAuthAsV3Server(identity.InitializeV3("", &priv, &pub), ServerAuthValid3DH) err := HandleInboundConnection(rc).ProcessAuthAsV3Server(identity.InitializeV3("", &priv, &pub), ServerAuthValid3DH)

View File

@ -16,7 +16,7 @@ func TestNegotiateInboundVersions(t *testing.T) {
} }
defer conn.Close() defer conn.Close()
conn.Write([]byte{0x49, 0x4D, 0x01, 0x01}) conn.Write([]byte{0x49, 0x4D, 0x01, 0x03})
} }
l, err := net.Listen("tcp", ":4000") l, err := net.Listen("tcp", ":4000")

View File

@ -14,7 +14,7 @@ func TestOutboundVersionNegotiation(t *testing.T) {
b := make([]byte, 4) b := make([]byte, 4)
n, err := conn.Read(b) n, err := conn.Read(b)
if n == 4 && err == nil { if n == 4 && err == nil {
conn.Write([]byte{0x01}) conn.Write([]byte{0x03})
} }
conn.Close() conn.Close()
}() }()

View File

@ -31,7 +31,7 @@ func Open(acn connectivity.ACN, remoteHostname string) (*connection.Connection,
// NegotiateVersionOutbound takes an open network connection and executes // NegotiateVersionOutbound takes an open network connection and executes
// the ricochet version negotiation procedure. // the ricochet version negotiation procedure.
func NegotiateVersionOutbound(conn net.Conn, remoteHostname string) (*connection.Connection, error) { func NegotiateVersionOutbound(conn net.Conn, remoteHostname string) (*connection.Connection, error) {
versions := []byte{0x49, 0x4D, 0x01, 0x01} versions := []byte{0x49, 0x4D, 0x01, 0x03}
if n, err := conn.Write(versions); err != nil || n < len(versions) { if n, err := conn.Write(versions); err != nil || n < len(versions) {
return nil, utils.VersionNegotiationError return nil, utils.VersionNegotiationError
} }
@ -41,7 +41,7 @@ func NegotiateVersionOutbound(conn net.Conn, remoteHostname string) (*connection
return nil, utils.VersionNegotiationError return nil, utils.VersionNegotiationError
} }
if res[0] != 0x01 { if res[0] != 0x03 {
return nil, utils.VersionNegotiationFailed return nil, utils.VersionNegotiationFailed
} }
rc := connection.NewOutboundConnection(conn, remoteHostname) rc := connection.NewOutboundConnection(conn, remoteHostname)
@ -52,7 +52,7 @@ func NegotiateVersionOutbound(conn net.Conn, remoteHostname string) (*connection
// as if that connection was a client. Returns a ricochet connection if successful // as if that connection was a client. Returns a ricochet connection if successful
// error otherwise. // error otherwise.
func NegotiateVersionInbound(conn net.Conn) (*connection.Connection, error) { func NegotiateVersionInbound(conn net.Conn) (*connection.Connection, error) {
versions := []byte{0x49, 0x4D, 0x01, 0x01} versions := []byte{0x49, 0x4D, 0x01, 0x03}
// Read version response header // Read version response header
header := make([]byte, 3) header := make([]byte, 3)
if _, err := io.ReadAtLeast(conn, header, len(header)); err != nil { if _, err := io.ReadAtLeast(conn, header, len(header)); err != nil {
@ -71,7 +71,7 @@ func NegotiateVersionInbound(conn net.Conn) (*connection.Connection, error) {
selectedVersion := byte(0xff) selectedVersion := byte(0xff)
for _, v := range versionList { for _, v := range versionList {
if v == 0x01 { if v == 0x03 {
selectedVersion = v selectedVersion = v
break break
} }

View File

@ -13,7 +13,7 @@ func SimpleServer() {
b := make([]byte, 4) b := make([]byte, 4)
n, err := conn.Read(b) n, err := conn.Read(b)
if n == 4 && err == nil { if n == 4 && err == nil {
conn.Write([]byte{0x01}) conn.Write([]byte{0x03})
} }
conn.Close() conn.Close()
} }