Commit a287f1a9 authored by Niels Möller's avatar Niels Möller

testutils.c: Fix high bits of the mpz_urandomb used with mini-gmp.

parent f0136f46
2018-11-25 Niels Möller <nisse@lysator.liu.se>
* testsuite/testutils.c (mpz_urandomb) [NETTLE_USE_MINI_GMP]: Fix
masking of most significant bits.
* rsa-decrypt-tr.c (rsa_decrypt_tr): Use
NETTLE_OCTET_SIZE_TO_LIMB_SIZE.
......
......@@ -818,7 +818,7 @@ mpz_urandomb (mpz_t r, struct knuth_lfib_ctx *ctx, mp_bitcnt_t bits)
uint8_t *buf = xalloc (bytes);
knuth_lfib_random (ctx, bytes, buf);
buf[bytes-1] &= 0xff >> (8*bytes - bits);
buf[0] &= 0xff >> (8*bytes - bits);
nettle_mpz_set_str_256_u (r, bytes, buf);
free (buf);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment