diff options
author | Jay Berkenbilt <ejb@ql.org> | 2020-04-06 15:49:02 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2020-04-06 15:49:02 +0200 |
commit | 619d294e9d2d9bb64c4eac62fde57096d5a84ba4 (patch) | |
tree | 69d37c3d77e022e27402bea6edb00b5d351505fb /libqpdf/InsecureRandomDataProvider.cc | |
parent | 1360b530ecc96aac4c77ef6ae2db1a05e9b791f1 (diff) | |
download | qpdf-619d294e9d2d9bb64c4eac62fde57096d5a84ba4.tar.zst |
Remove QUtil::srandom
Diffstat (limited to 'libqpdf/InsecureRandomDataProvider.cc')
-rw-r--r-- | libqpdf/InsecureRandomDataProvider.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libqpdf/InsecureRandomDataProvider.cc b/libqpdf/InsecureRandomDataProvider.cc index 18b21baa..e246ff97 100644 --- a/libqpdf/InsecureRandomDataProvider.cc +++ b/libqpdf/InsecureRandomDataProvider.cc @@ -30,8 +30,13 @@ InsecureRandomDataProvider::random() // Seed the random number generator with something simple, but // just to be interesting, don't use the unmodified current // time. It would be better if this were a more secure seed. - QUtil::srandom(static_cast<unsigned int>( - QUtil::get_current_time() ^ 0xcccc)); + unsigned int seed = static_cast<unsigned int>( + QUtil::get_current_time() ^ 0xcccc); +#ifdef HAVE_RANDOM + ::srandom(seed); +#else + srand(seed); +#endif this->seeded_random = true; } |