mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
fix ecdsa_address_decode
This commit is contained in:
parent
4fb15a13d8
commit
ad73c0d4e7
6
ecdsa.c
6
ecdsa.c
@ -936,9 +936,9 @@ int ecdsa_address_decode(const char *addr, uint32_t version, uint8_t *out)
|
||||
if (version <= 0xFF) {
|
||||
return base58_decode_check(addr, out, 21) == 21 && out[0] == (version & 0xFF);
|
||||
} else if (version <= 0xFFFF) {
|
||||
return base58_decode_check(addr, out, 22) == 22 && out[0] == ((version >> 8)) && out[1] == (version & 0xFF);
|
||||
} else if (version <= 0xFFFF) {
|
||||
return base58_decode_check(addr, out, 23) == 23 && out[0] == ((version >> 16)) && out[1] == ((version >> 8) & 0xFF) && out[2] == (version & 0xFF);
|
||||
return base58_decode_check(addr, out, 22) == 22 && out[0] == ((version >> 8) & 0xFF) && out[1] == (version & 0xFF);
|
||||
} else if (version <= 0xFFFFFF) {
|
||||
return base58_decode_check(addr, out, 23) == 23 && out[0] == ((version >> 16) & 0xFF) && out[1] == ((version >> 8) & 0xFF) && out[2] == (version & 0xFF);
|
||||
} else {
|
||||
return base58_decode_check(addr, out, 24) == 24 && out[0] == (version >> 24) && out[1] == ((version >> 16) & 0xFF) && out[2] == ((version >> 8) & 0xFF) && out[3] == (version & 0xFF);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user