Rusty Russell
0a6e3d1e13
utils: remove tal_tmpctx altogether, use global.
In particular, we now only free tmpctx at the end of main().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Christian Decker
08bfb740f5
onion: Move cli onion tool to devtools/onion
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Rusty Russell
ab634dfcdd
common/test_sphinx: change to standard run- format.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
7200002773
tests: detect and close leaks in unit tests.
Fixes : #288
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
4f6ae3209b
common/test/test_sphinx: build fixes.
It isn't currently included in make check, so fix it to build and do that.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
739b163f8b
Makefiles: simplify dependencies.
Gather all binaries and objects and make the depend on external
requirements and common headers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
14277f93f2
tests: fix up whitespace.
The next makefile cleanup adds them to the whitespace check.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
a37c165cb9
common: move some files out of lightningd/
Basically all files shared by different daemons.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
85ff95e829
common: new directory for any shared objects.
To avoid everything pulling in HTLCs stuff to the opening daemon, we
split the channel and commit_tx routines into initial_channel and
initial_commit_tx (no HTLC support) and move full HTLC supporting versions
into channeld.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
b99c5620ef
struct secret: use everywhere.
We alternated between using a sha256 and using a privkey, but there are
numerous places where we have a random 32 bytes which are neither.
This fixes many of them (plus, struct privkey is now defined in terms of
struct secret).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
9820abda7c
sphinx: Store shared secrets on the origin node
We could recompute them once we receive a reply and need to decrypt
it, but why go through the trouble when we can just store them?
8 years ago
Christian Decker
79582ea415
sphinx: Update the HMAC in onionreply to full length
8 years ago
Christian Decker
c44836ee2f
sphinx: Use test vector hop_data
The test vector no longer simply fills the hop_data with 'A', instead
we actually fill in the struct.
8 years ago
Christian Decker
83e89f0fe5
sphinx: Using hop_data to serialize per-hop information into onion
Signed-off-by: Christian Decker <decker.christian@gmail.com>
8 years ago
Christian Decker
752f884c23
sphinx: Removed per-hop payloads, will be replaced by hop_data
This is in preparation for the migration to `hop_data` which contains
all fields, and uses the `short_channel_id` instead of the pubkey.
8 years ago
Christian Decker
cca0e561d6
sphinx: Added unit-testing mode to test_sphinx
Currently hidden behind the `--unit` flag. Tests the onion reply
against the test vectors.
8 years ago
Christian Decker
e603dba14a
sphinx: Fixing makefile for test_sphinx and using lightningd version
8 years ago
Rusty Russell
8146b838e8
daemon/sphinx: split handling.
We want to use HSM to do the ECDH part, so split that out.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
cae283087d
sphinx: Committing the onion packet to the payment-hash
The sphinx onion packet now commits to the HTLC payment-hash it is
associated with. This prevents replay attacks with the same onion.
8 years ago
Christian Decker
91b17d45d8
sphinx: Removing last vestiges of the end-to-end payload
So far this was simply set to a zero-length end-to-end payload. We
don't have any plans of re-adding it for the moment, so let's get rid
of the unused code.
8 years ago
Rusty Russell
a4fdaab5b3
Use global secp256k1_ctx instead of passing it around.
If I'd known how large this patch would be (though trivial), I'd
have done it in parts.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
7bb5c279a8
sphinx: Implemented sphinx onion routing
Implements a spec-compliant sphinx onion routing format. The format has
been cross-checked with the go implementation
cdecker/lightning-onion@b9e117e.
9 years ago