entropy.c 255 B

12345678910111213
  1. #include "config.h"
  2. #include "entropy.h"
  3. gmp_randstate_t _rstate;
  4. unsigned long int _rseed;
  5. void mpz_entropy_init()
  6. {
  7. gmp_randinit_default(_rstate);
  8. getrandom(&_rseed, sizeof(unsigned long int), GRND_NONBLOCK);
  9. gmp_randseed_ui(_rstate, _rseed);
  10. }