1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 03:18:09 +00:00

fix int param for crypto.random.uniform()

This commit is contained in:
Jan Pochyla 2016-09-25 15:26:05 +02:00 committed by Pavol Rusnak
parent 605ba30bd6
commit 5c02718c58
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -25,7 +25,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Random_make_new(const mp_obj_type_t *type, size
/// Compute uniform random number from interval 0 ... n - 1
/// '''
STATIC mp_obj_t mod_TrezorCrypto_Random_uniform(mp_obj_t self, mp_obj_t n) {
uint32_t nn = mp_obj_get_int(n);
uint32_t nn = mp_obj_get_int_truncated(n);
if (nn == 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Maximum can't be zero"));
}