diff --git a/bignum.h b/bignum.h index c26d18477576874656e7a8ca24e3fd45c1480baf..95972f8b23397d906e8daeba2c69d11c9237799f 100644 --- a/bignum.h +++ b/bignum.h @@ -26,6 +26,8 @@ #ifndef NETTLE_BIGNUM_H_INCLUDED #define NETTLE_BIGNUM_H_INCLUDED +#include "nettle-meta.h" + #include <gmp.h> #include <inttypes.h> @@ -45,4 +47,17 @@ void nettle_mpz_init_set_str_256(mpz_t x, unsigned length, const uint8_t *s); +/* Returns a uniformly distributed random number 0 <= x < 2^n */ +void +nettle_mpz_random_size(mpz_t x, + void *ctx, nettle_random_func random, + unsigned bits); + +/* Returns a number x, almost uniformly random in the range + * 0 <= x < n. */ +void +nettle_mpz_random(mpz_t x, + void *ctx, nettle_random_func random, + const mpz_t n); + #endif /* NETTLE_BIGNUM_H_INCLUDED */