From: Niels Möller Date: Wed, 9 Oct 2002 21:11:12 +0000 (+0200) Subject: (nettle_mpz_random, nettle_mpz_random_size): Added X-Git-Tag: nettle_1.7_release_20030311~261 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=390d52880da63a5b603540488171f4fe53a22e84;p=thirdparty%2Fnettle.git (nettle_mpz_random, nettle_mpz_random_size): Added prototypes. Rev: src/nettle/bignum.h:1.4 --- diff --git a/bignum.h b/bignum.h index c26d1847..95972f8b 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 #include @@ -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 */