agl / pond

Pond
BSD 3-Clause "New" or "Revised" License
911 stars 109 forks source link

newRatchet(..) always called with contact.theirIdentityPublic zero #176

Open burdges opened 9 years ago

burdges commented 9 years ago

Add the line fmt.Printf("%x\n",contact.theirIdentityPublic[:]) anywhere around https://github.com/agl/pond/blob/master/client/client.go#L1041 in newRatchet(..). Next run go test. It'll print 0000000000000000000000000000000000000000000000000000000000000000 repeatedly, so the ratchet never sees a non-zero value for contact.theirIdentityPublic.

This is because the two calls to newRatchet at https://github.com/agl/pond/blob/master/client/client.go#L1051 and https://github.com/agl/pond/blob/master/client/disk.go#L103 run before key exchange completes.

I have not dug into the ratchet code enough to figure out if this matters, but the ratchet does use ratchet.theirIdentityPublic. If it matters, we could move the calls to newRatchet elsewhere, presumably only for V2 as doing so might break new key up.