Commit 40b64dbf authored by Frithjof Schulze's avatar Frithjof Schulze

go.crypto/otr: Reset Conversation.myKeyId for each AKE.

This shouldn't be necessary according to the OTRv2 spec,
but is expected by at least one other client.

CC=golang-dev
https://codereview.appspot.com/13823043

Committer: Adam Langley <agl@golang.org>
parent 596e2a37
...@@ -277,6 +277,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se ...@@ -277,6 +277,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
in = in[len(msgPrefix) : len(in)-1] in = in[len(msgPrefix) : len(in)-1]
} else if version := isQuery(in); version > 0 { } else if version := isQuery(in); version > 0 {
c.authState = authStateAwaitingDHKey c.authState = authStateAwaitingDHKey
c.myKeyId = 0
toSend = c.encode(c.generateDHCommit()) toSend = c.encode(c.generateDHCommit())
return return
} else { } else {
...@@ -310,6 +311,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se ...@@ -310,6 +311,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
if err = c.processDHCommit(msg); err != nil { if err = c.processDHCommit(msg); err != nil {
return return
} }
c.myKeyId = 0
toSend = c.encode(c.generateDHKey()) toSend = c.encode(c.generateDHKey())
return return
case authStateAwaitingDHKey: case authStateAwaitingDHKey:
...@@ -328,6 +330,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se ...@@ -328,6 +330,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
if err = c.processDHCommit(msg); err != nil { if err = c.processDHCommit(msg); err != nil {
return return
} }
c.myKeyId = 0
toSend = c.encode(c.generateDHKey()) toSend = c.encode(c.generateDHKey())
return return
} }
...@@ -340,6 +343,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se ...@@ -340,6 +343,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
if err = c.processDHCommit(msg); err != nil { if err = c.processDHCommit(msg); err != nil {
return return
} }
c.myKeyId = 0
toSend = c.encode(c.generateDHKey()) toSend = c.encode(c.generateDHKey())
c.authState = authStateAwaitingRevealSig c.authState = authStateAwaitingRevealSig
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment