Created
October 10, 2015 22:06
-
-
Save agl/07cb9f83f40e0764c7af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/otr/otr.go b/otr/otr.go | |
index 0d18a60..ed560ed 100644 | |
--- a/otr/otr.go | |
+++ b/otr/otr.go | |
@@ -12,20 +12,21 @@ import ( | |
"crypto/cipher" | |
"crypto/dsa" | |
"crypto/hmac" | |
"crypto/rand" | |
"crypto/sha1" | |
"crypto/sha256" | |
"crypto/subtle" | |
"encoding/base64" | |
"encoding/hex" | |
"errors" | |
+ "fmt" | |
"hash" | |
"io" | |
"math/big" | |
"strconv" | |
) | |
// SecurityChange describes a change in the security state of a Conversation. | |
type SecurityChange int | |
const ( | |
@@ -1030,21 +1031,26 @@ func (c *Conversation) calcDataKeys(myKeyId, theirKeyId uint32) (slot *keySlot, | |
// Find an empty slot to write into. | |
slot = nil | |
for i := range c.keySlots { | |
if !c.keySlots[i].used { | |
slot = &c.keySlots[i] | |
break | |
} | |
} | |
if slot == nil { | |
- err = errors.New("otr: internal error: no key slots") | |
+ errStr := fmt.Sprintf("otr: internal error: no key slots (myKeyId: %d, theirKeyId: %d", myKeyId, theirKeyId) | |
+ for i := range c.keySlots { | |
+ slot := &c.keySlots[i] | |
+ errStr += fmt.Sprintf(", slot[%d] = {myKeyId: %d, theirKeyId: %d}", slot.myKeyId, slot.theirKeyId) | |
+ } | |
+ err = errors.New(errStr) | |
return | |
} | |
var myPriv, myPub, theirPub *big.Int | |
if myKeyId == c.myKeyId { | |
myPriv = c.myCurrentDHPriv | |
myPub = c.myCurrentDHPub | |
} else if myKeyId == c.myKeyId-1 { | |
myPriv = c.myLastDHPriv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment