Use libsecp256k1 instead of openssl for crypto.

We still use openssl for bignums (base58) and for ripemd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2015-06-26 11:54:07 +09:30
parent 5a79ef9502
commit d20ddb5a90
22 changed files with 120 additions and 207 deletions

View File

@@ -12,10 +12,11 @@
#include "bitcoin/address.h"
#include "bitcoin/tx.h"
#include "bitcoin/pubkey.h"
#include "bitcoin/privkey.h"
#include "bitcoin/shadouble.h"
#include "protobuf_convert.h"
#include <openssl/ec.h>
#include <unistd.h>
#include <time.h>
#include "opt_bits.h"
/* Bitcoin nodes are allowed to be 2 hours in the future. */
@@ -76,7 +77,7 @@ int main(int argc, char *argv[])
bool testnet;
size_t i;
struct pubkey commitkey, outkey, changekey;
EC_KEY *commitprivkey, *outprivkey;
struct privkey commitprivkey, outprivkey;
err_set_progname(argv[0]);
@@ -123,16 +124,14 @@ int main(int argc, char *argv[])
/* We don't really need the privkey here, but it's the most
* convenient way to get the pubkey from bitcoind. */
commitprivkey = key_from_base58(argv[4], strlen(argv[4]), &testnet,
&commitkey);
if (!commitprivkey)
if (!key_from_base58(argv[4], strlen(argv[4]), &testnet,
&commitprivkey, &commitkey))
errx(1, "Invalid private key '%s'", argv[4]);
if (!testnet)
errx(1, "Private key '%s' not on testnet!", argv[4]);
outprivkey = key_from_base58(argv[5], strlen(argv[5]), &testnet,
&outkey);
if (!outprivkey)
if (!key_from_base58(argv[5], strlen(argv[5]), &testnet,
&outprivkey, &outkey))
errx(1, "Invalid private key '%s'", argv[5]);
if (!testnet)
errx(1, "Private key '%s' not on testnet!", argv[5]);