1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

gui: fixup after ECDSA updates

This commit is contained in:
Roman Zeyde 2015-07-07 10:58:08 +03:00
parent ea16aa0b86
commit 749cf8b75f
2 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,7 @@ 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 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 mainwindow.cpp main.cpp
HEADERS += mainwindow.h ../bip32.h ../bip39.h

View File

@ -45,7 +45,8 @@ void MainWindow::on_spinAccount_valueChanged(int arg1)
{
if (!root_set) return;
const char addr_version = 0x00, wif_version = 0x80;
char buf[128];
const size_t buflen = 128;
char buf[buflen + 1];
HDNode node;
// external chain
for (int chain = 0; chain < 2; chain++) {
@ -54,14 +55,14 @@ void MainWindow::on_spinAccount_valueChanged(int arg1)
hdnode_private_ckd(&node, 44 | 0x80000000);
hdnode_private_ckd(&node, 0 | 0x80000000); // bitcoin
hdnode_private_ckd(&node, (arg1 - 1) | 0x80000000);
hdnode_serialize_private(&node, buf); QString xprv = QString(buf); ui->lineXprv->setText(xprv);
hdnode_serialize_public(&node, buf); QString xpub = QString(buf); ui->lineXpub->setText(xpub);
hdnode_serialize_private(&node, buf, buflen); QString xprv = QString(buf); ui->lineXprv->setText(xprv);
hdnode_serialize_public(&node, buf, buflen); QString xpub = QString(buf); ui->lineXpub->setText(xpub);
hdnode_private_ckd(&node, chain); // external / internal
for (int i = 0; i < 100; i++) {
HDNode node2 = node;
hdnode_private_ckd(&node2, i);
ecdsa_get_address(node2.public_key, addr_version, buf); QString address = QString(buf);
ecdsa_get_wif(node2.private_key, wif_version, buf); QString wif = QString(buf);
ecdsa_get_address(node2.public_key, addr_version, buf, buflen); QString address = QString(buf);
ecdsa_get_wif(node2.private_key, wif_version, buf, buflen); QString wif = QString(buf);
list->setItem(i, 0, new QTableWidgetItem(address));
list->setItem(i, 1, new QTableWidgetItem(wif));
list->setItem(i, 2, new QTableWidgetItem("0.0"));