~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/golang.org/x/crypto/otr/otr.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
                in = in[len(msgPrefix) : len(in)-1]
278
278
        } else if version := isQuery(in); version > 0 {
279
279
                c.authState = authStateAwaitingDHKey
280
 
                c.myKeyId = 0
 
280
                c.reset()
281
281
                toSend = c.encode(c.generateDHCommit())
282
282
                return
283
283
        } else {
311
311
                        if err = c.processDHCommit(msg); err != nil {
312
312
                                return
313
313
                        }
314
 
                        c.myKeyId = 0
 
314
                        c.reset()
315
315
                        toSend = c.encode(c.generateDHKey())
316
316
                        return
317
317
                case authStateAwaitingDHKey:
330
330
                                if err = c.processDHCommit(msg); err != nil {
331
331
                                        return
332
332
                                }
333
 
                                c.myKeyId = 0
 
333
                                c.reset()
334
334
                                toSend = c.encode(c.generateDHKey())
335
335
                                return
336
336
                        }
343
343
                        if err = c.processDHCommit(msg); err != nil {
344
344
                                return
345
345
                        }
346
 
                        c.myKeyId = 0
 
346
                        c.reset()
347
347
                        toSend = c.encode(c.generateDHKey())
348
348
                        c.authState = authStateAwaitingRevealSig
349
349
                default:
417
417
                                        change = SMPSecretNeeded
418
418
                                        c.smp.saved = &inTLV
419
419
                                        return
420
 
                                } else if err == smpFailureError {
 
420
                                }
 
421
                                if err == smpFailureError {
421
422
                                        err = nil
422
423
                                        change = SMPFailed
423
 
                                        return
424
 
                                }
425
 
                                if complete {
 
424
                                } else if complete {
426
425
                                        change = SMPComplete
427
426
                                }
428
427
                                if reply.typ != 0 {
1037
1036
                }
1038
1037
        }
1039
1038
        if slot == nil {
1040
 
                err = errors.New("otr: internal error: no key slots")
1041
 
                return
 
1039
                return nil, errors.New("otr: internal error: no more key slots")
1042
1040
        }
1043
1041
 
1044
1042
        var myPriv, myPub, theirPub *big.Int
1164
1162
        return ret
1165
1163
}
1166
1164
 
 
1165
func (c *Conversation) reset() {
 
1166
        c.myKeyId = 0
 
1167
 
 
1168
        for i := range c.keySlots {
 
1169
                c.keySlots[i].used = false
 
1170
        }
 
1171
}
 
1172
 
1167
1173
type PublicKey struct {
1168
1174
        dsa.PublicKey
1169
1175
}