Commit Graph

65 Commits

Author SHA1 Message Date
Juan Batiz-Benet
881f5c9883 secio unexpose bufPool 2014-12-12 03:33:09 -08:00
Juan Batiz-Benet
e7edeca392 added log.Events to secio 2014-12-12 03:29:09 -08:00
Brian Tiger Chow
67665069d1 Update interface.go 2014-12-12 03:10:47 -08:00
Brian Tiger Chow
24308148ad Update interface.go 2014-12-12 03:10:25 -08:00
Juan Batiz-Benet
9267f45085 secio: encrypt copy
sadly, encrypting needs to copy, as the user supplied buffer
must not be mangled.
2014-12-12 02:47:37 -08:00
Juan Batiz-Benet
8d961fc03b secio: better handshake log msg 2014-12-12 02:47:36 -08:00
Juan Batiz-Benet
5aab08fe4f secio -- spipe v2
This commit introduces secio, the next generation spipe.
2014-12-12 02:45:23 -08:00
Juan Batiz-Benet
9d05b35231 crypto/key: stretcher refactor 2014-12-12 02:45:22 -08:00
Brian Tiger Chow
74eb03231d fix(core, peer) helpers to testutil, err handling
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 14:32:52 -08:00
Brian Tiger Chow
d77c4bb5e0 refactor(peer): create peer through peerstore
for safety!

use mockpeer.WithID methods to create peers in tests

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
Brian Tiger Chow
73a89e161d refactor(peerstore) s/Get/FindOrCreate
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
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