Commit Graph

54 Commits

Author SHA1 Message Date
Jeromy
4f083d54d6 write a few package doc strings to improve look of godoc 2014-11-08 21:42:36 -08:00
Jeromy
88bf39118c comment comment comment comment 2014-11-03 03:02:56 +00:00
Jeromy
6efaa1d811 remove signed pipe 2014-11-01 16:07:56 -07:00
Jeromy
5edbca2e70 cleanup from CR 2014-11-01 16:07:56 -07:00
Jeromy
98f56ab7e2 remove sha1 from hmac hash suite options 2014-11-01 16:07:56 -07:00
Jeromy
950957240a address comments from PR 2014-11-01 16:07:56 -07:00
Jeromy
a8069024e9 cut down on allocations 2014-11-01 16:07:56 -07:00
Jeromy
027920540f more memory tweaks 2014-11-01 16:07:56 -07:00
Jeromy
9b1c99e9aa shrink msgio buffer size to decrease memory pressure 2014-11-01 16:07:56 -07:00
Jeromy
32417724a6 Reenable secure channel code 2014-11-01 16:07:56 -07:00
Jeromy
f89cfc1108 moved pipes package 2014-11-01 16:07:56 -07:00
Jeromy
07733b17b3 msgio pooling first hack 2014-11-01 16:07:56 -07:00
Jeromy
ffc59fff1b add blowfish code and refactor pipes and duplex a little 2014-11-01 16:07:56 -07:00
Jeromy
01c0c6e169 implement signed pipe and add blowfish cipher to supported suites 2014-11-01 16:07:56 -07:00
Jeromy
3994762ca6 fix bug 2014-11-01 16:07:56 -07:00
Jeromy
317ca2f865 benchmark secure channel 2014-11-01 16:07:56 -07:00
Jeromy
d92db12460 lots of logging 2014-10-26 00:45:40 +00:00
Brian Tiger Chow
2ed7da8cfd refactor(crypto) mv proto PBPublicKey -> PublicKey, etc. 2014-10-22 21:49:43 -07:00
Brian Tiger Chow
fdcf3f6d34 chore(crypto/spipe) use generic Makefile 2014-10-22 21:39:19 -07:00
Brian Tiger Chow
157035233e fix(crypto/spipe/pb) rename proto package -> spipe_pb 2014-10-22 15:54:18 -07:00
Brian Tiger Chow
6e9e29b87d fix(crypto) rename proto package -> crypto_pb, regen go file
+ add Makefile
2014-10-22 15:54:17 -07:00
Brian Tiger Chow
e3a9a11afc refactor(crypto) move proto to internal pb package
https://docs.google.com/document/d/1e8kOo3r51b2BWtTs_1uADIA5djfXhPT36s6eHVRIvaU/edit
2014-10-22 15:54:17 -07:00
Brian Tiger Chow
673bb1ba68 refactor(crypto/spipe) move proto to internal pb package
https://docs.google.com/document/d/1e8kOo3r51b2BWtTs_1uADIA5djfXhPT36s6eHVRIvaU/edit
2014-10-22 15:54:17 -07:00
Juan Batiz-Benet
9ca87fbb93 peer.Peer is now an interface
![](http://m.memegen.com/77n7dk.jpg)
2014-10-20 03:26:46 -07:00
Juan Batiz-Benet
b1d11ccfcb peerstore constructs peers
Now, all peers should be retrieved from the Peerstore, which will
construct the peers accordingly. This ensures there's only one peer
object per peer (opposite would be bad: things get out sync)

cc @whyrusleeping
2014-10-20 00:44:44 -07:00
Juan Batiz-Benet
63d6ee6daa multiconn in swarm 2014-10-19 05:05:28 -07:00
Juan Batiz-Benet
f8d70f344b simultaneous open should work for now
It's a patch, really. it's not the full multiconn fix.
2014-10-18 20:01:27 -07:00
Juan Batiz-Benet
ffba031469 test closing/cancellation
- does end properly
- no goroutines leaked!
2014-10-18 04:36:20 -07:00
Juan Batiz-Benet
8aed79cd97 fixed data races 2014-10-18 04:36:20 -07:00
Juan Batiz-Benet
e989d6febe move IDFromPubKey to peer pkg 2014-10-18 04:28:26 -07:00
Juan Batiz-Benet
972c0f7b4b u.DOut -> log.Debug
and other logging switches. I kept the u.PErr and u.POut in cli
commands, as those do need to write raw output directly.
2014-10-09 04:50:22 -07:00
Juan Batiz-Benet
66839fa1de changed logging, in dht and elsewhere
- use log.* instead of u.*
- use automatic type conversions to .String()
  (Peer.String() prints nicely, and avoids calling b58 encoding
  until needed)
2014-10-07 21:33:59 -07:00
Juan Batiz-Benet
77fccaa2f3 Obviated need for .ID.Pretty() all over the place. 2014-10-06 04:23:55 -07:00
Juan Batiz-Benet
f3ae0e8e1b u.Hash - error
the u.Hash error can be safely ignored (panic) because multihash
only fails from the selection of hash function. If the fn + length
are valid, it won't error.

cc @whyrusleeping
2014-10-06 02:26:52 -07:00
Juan Batiz-Benet
5136c786e5 Bugfix: "Malformed Public Key" Error
This commit fixed the notoriously annoying "Malformed Public Key"
problem. The issue was that sometimes the byte representation of
the points (x,y in big.Int) generated would be one less byte than
expected. This is simply because (* big.Int) Write uses the least
amount of bytes needed for the int.

I instead changed the marshalling/unmarshalling to do exactly
what stdlib crypto/tls does: use `ellipctic.Marshal` which marshals
according to the ANSI X9.62 standard.

http://golang.org/pkg/crypto/elliptic/#Marshal
http://golang.org/src/pkg/crypto/tls/key_agreement.go#L214

```Go
// crypto/tls
ka.privateKey, x, y, err = elliptic.GenerateKey(ka.curve, config.rand())
ecdhePublic := elliptic.Marshal(ka.curve, x, y)

// ipfs/crypto
priv, x, y, err := elliptic.GenerateKey(curve, rand.Reader)
pubKey := elliptic.Marshal(curve, x, y)
```

((Warning: we're using `rand.Reader` directly, which we shouldn't
do, as it can be seeded. We should use a configured source, as
crypto/tls. Flagged in #143))

This makes me think we should re-use a lot of their datastructures
and functions directly (e.g. ecdheKeyAgreement)

Fixed: #135

cc @bren2010 @whyrusleeping
2014-10-05 15:56:52 -07:00
Juan Batiz-Benet
7e83982247 print out key if 'malformed' 2014-10-05 14:50:30 -07:00
Juan Batiz-Benet
26a481a904 fixed key hashing interface + test 2014-10-01 00:52:26 -07:00
Jeromy
a65e8600a3 catch ipns branch up to master and make all things compile 2014-10-01 00:37:53 -07:00
Jeromy
d1f011244f address comments from the PR #45 2014-10-01 00:33:00 -07:00
Jeromy
c41a9717fe make disconnects and reconnects work a little better 2014-10-01 00:26:59 -07:00
Juan Batiz-Benet
484d6004f7 crypto: abstracted Key and added Equals. 2014-09-27 00:18:54 -07:00
Juan Batiz-Benet
c7bd8b78dd handshake catch 2014-09-26 23:58:44 -07:00
Juan Batiz-Benet
0817ffa366 spipe + handshake with peerstore 2014-09-26 02:41:46 -07:00
Juan Batiz-Benet
eaffabec4f handshake: error out while sending + dbg 2014-09-23 05:23:54 -07:00
Brian Tiger Chow
814cb992f4 misc(crypto) remove stale test
@jbenet

Handshake library has been modified to use Secure Pipe. This test
targets the old implementation.

TODO: write a new handshake test
2014-09-22 04:06:18 -07:00
Juan Batiz-Benet
9dd39de491 Fixed connections all over. 2014-09-22 04:06:12 -07:00
Juan Batiz-Benet
1439a53b15 handshake: bugfix (secure -> insecure chan) + logs 2014-09-22 04:06:12 -07:00
Juan Batiz-Benet
d040104762 handshake: setting remote key expects it to match 2014-09-22 04:06:12 -07:00
Juan Batiz-Benet
34a0580ea6 godep multiaddr update 2014-09-22 04:05:19 -07:00
Juan Batiz-Benet
c787adaa65 better handshake for all. 2014-09-22 04:05:13 -07:00