mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-30 17:21:21 +00:00
use const in hdnode_from_* methods
This commit is contained in:
parent
b4cdba8489
commit
10a92c3c62
6
bip32.c
6
bip32.c
@ -31,7 +31,7 @@
|
|||||||
#include "ripemd160.h"
|
#include "ripemd160.h"
|
||||||
#include "base58.h"
|
#include "base58.h"
|
||||||
|
|
||||||
int hdnode_from_xpub(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *public_key, HDNode *out)
|
int hdnode_from_xpub(uint32_t depth, uint32_t fingerprint, uint32_t child_num, const uint8_t *chain_code, const uint8_t *public_key, HDNode *out)
|
||||||
{
|
{
|
||||||
curve_point c;
|
curve_point c;
|
||||||
if (!ecdsa_read_pubkey(public_key, &c)) { // invalid pubkey
|
if (!ecdsa_read_pubkey(public_key, &c)) { // invalid pubkey
|
||||||
@ -46,7 +46,7 @@ int hdnode_from_xpub(uint32_t depth, uint32_t fingerprint, uint32_t child_num, u
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hdnode_from_xprv(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *private_key, HDNode *out)
|
int hdnode_from_xprv(uint32_t depth, uint32_t fingerprint, uint32_t child_num, const uint8_t *chain_code, const uint8_t *private_key, HDNode *out)
|
||||||
{
|
{
|
||||||
bignum256 a;
|
bignum256 a;
|
||||||
bn_read_be(private_key, &a);
|
bn_read_be(private_key, &a);
|
||||||
@ -62,7 +62,7 @@ int hdnode_from_xprv(uint32_t depth, uint32_t fingerprint, uint32_t child_num, u
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hdnode_from_seed(uint8_t *seed, int seed_len, HDNode *out)
|
int hdnode_from_seed(const uint8_t *seed, int seed_len, HDNode *out)
|
||||||
{
|
{
|
||||||
uint8_t I[32 + 32];
|
uint8_t I[32 + 32];
|
||||||
memset(out, 0, sizeof(HDNode));
|
memset(out, 0, sizeof(HDNode));
|
||||||
|
6
bip32.h
6
bip32.h
@ -35,11 +35,11 @@ typedef struct {
|
|||||||
uint8_t public_key[33];
|
uint8_t public_key[33];
|
||||||
} HDNode;
|
} HDNode;
|
||||||
|
|
||||||
int hdnode_from_xpub(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *public_key, HDNode *out);
|
int hdnode_from_xpub(uint32_t depth, uint32_t fingerprint, uint32_t child_num, const uint8_t *chain_code, const uint8_t *public_key, HDNode *out);
|
||||||
|
|
||||||
int hdnode_from_xprv(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *private_key, HDNode *out);
|
int hdnode_from_xprv(uint32_t depth, uint32_t fingerprint, uint32_t child_num, const uint8_t *chain_code, const uint8_t *private_key, HDNode *out);
|
||||||
|
|
||||||
int hdnode_from_seed(uint8_t *seed, int seed_len, HDNode *out);
|
int hdnode_from_seed(const uint8_t *seed, int seed_len, HDNode *out);
|
||||||
|
|
||||||
#define hdnode_private_ckd_prime(X, I) hdnode_private_ckd((X), ((I) | 0x80000000))
|
#define hdnode_private_ckd_prime(X, I) hdnode_private_ckd((X), ((I) | 0x80000000))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user