1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 08:38:07 +00:00

rename xprv struct to XprvNode

This commit is contained in:
Pavol Rusnak 2013-11-08 12:44:11 +01:00
parent 42da580ce8
commit b14ce58df7
3 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@
#include "ecdsa.h" #include "ecdsa.h"
#include "bip32.h" #include "bip32.h"
void xprv_from_seed(uint8_t *seed, int seed_len, xprv *out) void xprv_from_seed(uint8_t *seed, int seed_len, XprvNode *out)
{ {
out->version = 0x0488ADE4; // main-net out->version = 0x0488ADE4; // main-net
out->depth = 0; out->depth = 0;
@ -18,7 +18,7 @@ void xprv_from_seed(uint8_t *seed, int seed_len, xprv *out)
ecdsa_get_address(out->public_key, 0, out->address); ecdsa_get_address(out->public_key, 0, out->address);
} }
void xprv_descent(xprv *inout, uint32_t i) void xprv_descent(XprvNode *inout, uint32_t i)
{ {
uint8_t data[1 + 32 + 4]; uint8_t data[1 + 32 + 4];
bignum256 a, b; bignum256 a, b;

View File

@ -12,12 +12,12 @@ typedef struct {
uint8_t chain_code[32]; // form a continuous 64 byte block uint8_t chain_code[32]; // form a continuous 64 byte block
uint8_t public_key[33]; uint8_t public_key[33];
char address[35]; char address[35];
} xprv; } XprvNode;
void xprv_from_seed(uint8_t *seed, int seed_len, xprv *out); void xprv_from_seed(uint8_t *seed, int seed_len, XprvNode *out);
#define xprv_descent_prime(X, I) xprv_descent((X), ((I) | 0x80000000)) #define xprv_descent_prime(X, I) xprv_descent((X), ((I) | 0x80000000))
void xprv_descent(xprv *inout, uint32_t i); void xprv_descent(XprvNode *inout, uint32_t i);
#endif #endif

View File

@ -74,7 +74,7 @@ char *tohex(const uint8_t *bin, size_t l)
// test vector 1 from https://en.bitcoin.it/wiki/BIP_0032_TestVectors // test vector 1 from https://en.bitcoin.it/wiki/BIP_0032_TestVectors
START_TEST(test_bip32_vector_1) START_TEST(test_bip32_vector_1)
{ {
xprv node; XprvNode node;
// init m // init m
xprv_from_seed(fromhex("000102030405060708090a0b0c0d0e0f"), 16, &node); xprv_from_seed(fromhex("000102030405060708090a0b0c0d0e0f"), 16, &node);
@ -126,7 +126,7 @@ END_TEST
// test vector 2 from https://en.bitcoin.it/wiki/BIP_0032_TestVectors // test vector 2 from https://en.bitcoin.it/wiki/BIP_0032_TestVectors
START_TEST(test_bip32_vector_2) START_TEST(test_bip32_vector_2)
{ {
xprv node; XprvNode node;
// init m // init m
xprv_from_seed(fromhex("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542"), 64, &node); xprv_from_seed(fromhex("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542"), 64, &node);