1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-30 03:18:20 +00:00
trezor-firmware/bip32.h

32 lines
847 B
C
Raw Normal View History

#ifndef __BIP32_H__
#define __BIP32_H__
#include <stdint.h>
typedef struct {
uint32_t depth;
uint32_t fingerprint;
uint32_t child_num;
2014-01-14 13:35:13 +00:00
uint8_t chain_code[32];
2014-01-21 17:38:44 +00:00
uint8_t private_key[32];
uint8_t public_key[33];
} HDNode;
void hdnode_from_xpub(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *public_key, HDNode *out);
void hdnode_from_xprv(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *private_key, HDNode *out);
void hdnode_from_seed(uint8_t *seed, int seed_len, HDNode *out);
2014-01-14 13:35:13 +00:00
#define hdnode_private_ckd_prime(X, I) hdnode_private_ckd((X), ((I) | 0x80000000))
2014-01-14 13:35:13 +00:00
int hdnode_private_ckd(HDNode *inout, uint32_t i);
int hdnode_public_ckd(HDNode *inout, uint32_t i);
2014-01-21 17:38:44 +00:00
void hdnode_fill_public_key(HDNode *node);
2014-01-21 17:38:44 +00:00
void hdnode_fill_address(HDNode *node);
2013-11-08 15:02:48 +00:00
#endif