mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-12 18:49:07 +00:00
add check to mnemonic_from_data as well
This commit is contained in:
parent
6939275362
commit
e04ec2a831
4
bip39.c
4
bip39.c
@ -28,6 +28,10 @@ const char *mnemonic_from_data(const uint8_t *data, int len)
|
||||
static char bits[256 + 8];
|
||||
static char mnemo[24 * 10];
|
||||
|
||||
if (len % 4 || len < 16 || len > 32) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHA256_Raw((const uint8_t *)data, len, hash);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
|
@ -34,7 +34,7 @@ const bignum256 order256k1 = {
|
||||
.val = {0x10364141, 0x3f497a33, 0x348a03bb, 0x2bb739ab, 0x3ffffeba, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0xffff}};
|
||||
|
||||
const bignum256 order256k1_half = {
|
||||
.val = {0x281b20a0, 0x3fa4bd19, 0x3a4501dd, 0x15db9cd5, 0x3fffff5d, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x00007fff}};
|
||||
.val = {0x281b20a0, 0x3fa4bd19, 0x3a4501dd, 0x15db9cd5, 0x3fffff5d, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x7fff}};
|
||||
|
||||
const bignum256 three_over_two256k1 = {
|
||||
.val = {0x3ffffe19, 0x3ffffffd, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x7fff}};
|
||||
|
Loading…
Reference in New Issue
Block a user