1
0
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:
Pavol Rusnak 2016-10-09 23:41:48 +02:00
parent 4fb15a13d8
commit ad73c0d4e7
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -936,9 +936,9 @@ int ecdsa_address_decode(const char *addr, uint32_t version, uint8_t *out)
if (version <= 0xFF) { if (version <= 0xFF) {
return base58_decode_check(addr, out, 21) == 21 && out[0] == (version & 0xFF); return base58_decode_check(addr, out, 21) == 21 && out[0] == (version & 0xFF);
} else if (version <= 0xFFFF) { } else if (version <= 0xFFFF) {
return base58_decode_check(addr, out, 22) == 22 && out[0] == ((version >> 8)) && out[1] == (version & 0xFF); return base58_decode_check(addr, out, 22) == 22 && out[0] == ((version >> 8) & 0xFF) && out[1] == (version & 0xFF);
} else if (version <= 0xFFFF) { } else if (version <= 0xFFFFFF) {
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, 23) == 23 && out[0] == ((version >> 16) & 0xFF) && out[1] == ((version >> 8) & 0xFF) && out[2] == (version & 0xFF);
} else { } 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); 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);
} }