Commit Graph
12 Commits
Author SHA1 Message Date
Adam Langley beef0f4390 x/crypto/otr: reformat the libotr test harness with clang-format.
We have clang-format these days to eliminate any worries about C-code
formatting.

Change-Id: I86433d99f786ac4091c39eb4a41422c5a18d4d4a
Reviewed-on: https://go-review.googlesource.com/16937
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-20 20:14:19 +00:00
Adam Langley 8270119ea2 x/crypto/otr: update libotr test code for version 4.
The test for this package contains a test case (disabled by default)
that exercises the code against libotr (the reference implementation).
Since that test was written, libotr has updated to version 4 which
contains non-backwards-compatible API changes.

This change updates the test harness for version 4 of libotr.

Change-Id: Ib40c899c609cc827903ae18fd80476d179bf0a33
Reviewed-on: https://go-review.googlesource.com/16936
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-20 20:13:31 +00:00
Adam Langley fb90bd22f5 x/crypto/otr: make errors fatal.
Since the test against libotr (disabled by default) runs forever, any
errors should be fatal otherwise they'll never be noticed.

Change-Id: Idf07dd963260f140be1950afcbd04331b56bd627
Reviewed-on: https://go-review.googlesource.com/16935
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-20 20:13:25 +00:00
Adam Langley d438f321d3 x/crypto/otr: clear key slots when handshaking.
The OTR implementation had a bug where key slots would not be marked as
unused after a rehandshake. Since handshaking resets the key ids, some
key slots would be left over with much higher key ids. These key slots
would lead to an error when the code ran out of slots.

Fixes agl/xmpp-client#96.

Change-Id: I013bbc4eaf0616373ab52f14b7f7757c353983ca
Reviewed-on: https://go-review.googlesource.com/16934
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-20 20:11:45 +00:00
Arlo Breault ccca2aa616 otr: smpFailureError processing tlvTypeSMP3 prevents sending tlvTypeSMP4
* The other side is left hanging, waiting for their chance to do the
   comparison.

Change-Id: I186933ebb53a30e190414c5572206851681e0a37
Reviewed-on: https://go-review.googlesource.com/15260
Reviewed-by: Adam Langley <agl@golang.org>
2015-11-15 17:51:08 +00:00
Reinaldo de Souza Jr aedad9a179 otr: Fix revealing MAC keys when a DH key is rotated
The existing implementation did not save all the fields in keySlot, which not
only caused a cache miss on every calcDataKeys() but also caused the rotate keys
functions to not find the MAC keys that should be revealed.

It also stops revealing the sending MAC keys. The finite-state analysis of the
otr v2 spec[1] revealed an attack on message integrity when sending MAC keys are
revealed. The spec had been updated accordingly [2].

1 - http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.165.7945&rep=rep1&type=pdf
2 - http://sourceforge.net/p/otr/libotr/ci/58fd90cb77c836ff9fa762e91d2b2becc6d5aae8/

Change-Id: Iee36205994ebdb27d8c890ae25fd9981326401df
Reviewed-on: https://go-review.googlesource.com/12781
Reviewed-by: Adam Langley <agl@golang.org>
2015-08-30 18:06:42 +00:00
David Symonds 1fbbd62cfe crypto: add import comments.
Change-Id: I33240faf1b8620d0cd600de661928d8e422ebdbc
Reviewed-on: https://go-review.googlesource.com/1235
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 23:26:36 +00:00
Frithjof Schulze a3c6050446 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
2013-09-22 15:38:36 -04:00
Adam Langley c9c0e06eed go.crypto/otr: expose IsEncrypted.
It's useful to expose this bit of state because, although callers can
keep track of it themselves, it's already in the Conversation so it
seems wasteful to make them do so.

R=golang-dev, ioerror
CC=golang-dev
https://golang.org/cl/6724056
2012-10-17 14:58:16 -04:00
Shenghou Ma 2aed6cb9f1 otr: fix compilation
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6446054
2012-07-26 19:56:54 -04:00
Adam Langley 327f456371 otr: support signaling the end of a conversation.
The explicit OTR termination signal tells the peer that they should
discard their session keys and, more importantly, tells them that
*you* have done so and therefore cannot decrypt future messages.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6430043
2012-07-24 19:21:47 -04:00
Adam Langley 929dedf39d otr: add package
otr implements the Off-the-Record messaging protocol from
http://www.cypherpunks.ca/otr/. It's often used on IRC and Jabber
for private conversations.

R=golang-dev, rsc, dchest
CC=golang-dev
https://golang.org/cl/6300064
2012-06-14 13:36:13 -04:00