From 6f66162e93540653b870161cc4b106f58c341e6d Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 25 Apr 2016 17:15:02 +0200 Subject: [PATCH] fix tools and gui --- gui/gui.pro | 8 +++++++- gui/mainwindow.cpp | 3 ++- tools/Makefile | 2 +- tools/bip39bruteforce.c | 9 +++++---- tools/mktable.c | 3 ++- tools/xpubaddrgen.c | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/gui/gui.pro b/gui/gui.pro index 2ac6ec09ad..2b89a71dfc 100644 --- a/gui/gui.pro +++ b/gui/gui.pro @@ -4,8 +4,14 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = gui TEMPLATE = app -SOURCES += ../bip32.c ../bip39.c ../sha2.c ../pbkdf2.c ../hmac.c ../rand.c ../bignum.c ../ecdsa.c ../ripemd160.c ../base58.c ../secp256k1.c ../nist256p1.c mainwindow.cpp main.cpp +SOURCES += ../bip32.c ../bip39.c ../sha2.c ../pbkdf2.c ../hmac.c ../rand.c ../bignum.c ../ecdsa.c ../ripemd160.c ../base58.c ../secp256k1.c ../nist256p1.c ../curves.c ../ed25519-donna/ed25519.c mainwindow.cpp main.cpp HEADERS += mainwindow.h ../bip32.h ../bip39.h FORMS += mainwindow.ui + +INCLUDEPATH += .. +INCLUDEPATH += ../ed25519-donna + +DEFINES += ED25519_CUSTOMRANDOM=1 +DEFINES += ED25519_CUSTOMHASH=1 diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index a67d288572..fd2d3c312f 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -5,6 +5,7 @@ extern "C" { #include "../bip32.h" #include "../bip39.h" #include "../ecdsa.h" +#include "../curves.h" } bool root_set = false; @@ -35,7 +36,7 @@ void MainWindow::on_buttonLoad_clicked() } uint8_t seed[64]; mnemonic_to_seed(ui->editMnemonic->text().toLocal8Bit().data(), ui->editPassphrase->text().toLocal8Bit().data(), seed, 0); - hdnode_from_seed(seed, 64, &root); + hdnode_from_seed(seed, 64, SECP256K1_NAME, &root); root_set = true; ui->spinAccount->setValue(1); on_spinAccount_valueChanged(1); diff --git a/tools/Makefile b/tools/Makefile index 61032e6586..481a46bcb6 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -25,7 +25,7 @@ CFLAGS += $(OPTFLAGS) \ all: xpubaddrgen mktable bip39bruteforce -OBJS = ../bip32.o ../bip39.o ../ecdsa.o ../sha2.o ../bignum.o ../base58.o ../secp256k1.o ../nist256p1.o ../ripemd160.o ../hmac.o ../rand.o ../pbkdf2.o +OBJS = ../bip32.o ../bip39.o ../ecdsa.o ../sha2.o ../bignum.o ../base58.o ../secp256k1.o ../nist256p1.o ../ripemd160.o ../hmac.o ../rand.o ../pbkdf2.o ../curves.o ../ed25519-donna/ed25519.o %.o: %.c %.h options.h $(CC) $(CFLAGS) -o $@ -c $< diff --git a/tools/bip39bruteforce.c b/tools/bip39bruteforce.c index e6e9be02e6..a551588286 100644 --- a/tools/bip39bruteforce.c +++ b/tools/bip39bruteforce.c @@ -1,9 +1,10 @@ #include #include #include -#include -#include -#include +#include "bip39.h" +#include "bip32.h" +#include "ecdsa.h" +#include "curves.h" char passphrase[256]; uint8_t seed[512 / 8]; @@ -47,7 +48,7 @@ int main(int argc, char **argv) count++; passphrase[len - 1] = 0; mnemonic_to_seed(mnemonic, passphrase, seed, NULL); - hdnode_from_seed(seed, 512 / 8, &node); + hdnode_from_seed(seed, 512 / 8, SECP256K1_NAME, &node); hdnode_private_ckd_prime(&node, 44); hdnode_private_ckd_prime(&node, 0); hdnode_private_ckd_prime(&node, 0); diff --git a/tools/mktable.c b/tools/mktable.c index 77997039dc..292adac9cb 100644 --- a/tools/mktable.c +++ b/tools/mktable.c @@ -3,6 +3,7 @@ #include "bignum.h" #include "ecdsa.h" #include "rand.h" +#include "bip32.h" /* * This program prints the contents of the ecdsa_curve.cp array. @@ -16,7 +17,7 @@ int main(int argc, char **argv) { return 1; } const char *name = argv[1]; - const ecdsa_curve *curve = get_curve_by_name(name); + const curve_info *curve = get_curve_by_name(name); if (curve == 0) { printf("Unknown curve '%s'\n", name); return 1; diff --git a/tools/xpubaddrgen.c b/tools/xpubaddrgen.c index 42f87826fc..12b350d723 100644 --- a/tools/xpubaddrgen.c +++ b/tools/xpubaddrgen.c @@ -2,8 +2,8 @@ #include #include #include -#include -#include +#include "bip32.h" +#include "ecdsa.h" void process_job(uint32_t jobid, const char *xpub, uint32_t change, uint32_t from, uint32_t to) {