瀏覽代碼

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://golang.org/cl/13823043
Frithjof Schulze 12 年之前
父節點
當前提交
a3c6050446
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      otr/otr.go

+ 4 - 0
otr/otr.go

@@ -277,6 +277,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
 		in = in[len(msgPrefix) : len(in)-1]
 	} else if version := isQuery(in); version > 0 {
 		c.authState = authStateAwaitingDHKey
+		c.myKeyId = 0
 		toSend = c.encode(c.generateDHCommit())
 		return
 	} else {
@@ -310,6 +311,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
 			if err = c.processDHCommit(msg); err != nil {
 				return
 			}
+			c.myKeyId = 0
 			toSend = c.encode(c.generateDHKey())
 			return
 		case authStateAwaitingDHKey:
@@ -328,6 +330,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
 				if err = c.processDHCommit(msg); err != nil {
 					return
 				}
+				c.myKeyId = 0
 				toSend = c.encode(c.generateDHKey())
 				return
 			}
@@ -340,6 +343,7 @@ func (c *Conversation) Receive(in []byte) (out []byte, encrypted bool, change Se
 			if err = c.processDHCommit(msg); err != nil {
 				return
 			}
+			c.myKeyId = 0
 			toSend = c.encode(c.generateDHKey())
 			c.authState = authStateAwaitingRevealSig
 		default: