mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-09-29 05:04:57 +02:00
Fix mingw ID randomness from 8 to 16 bits.
git-svn-id: file:///svn/unbound/trunk@1717 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
- Fix for crash at start on windows.
|
||||
- tag for release 1.3.2.
|
||||
- trunk has version 1.3.3.
|
||||
- Fix for ID bits on windows to use all 16. RAND_MAX was not
|
||||
defined like you'd expect on mingw.
|
||||
|
||||
9 July 2009: Wouter
|
||||
- tag for release 1.3.1.
|
||||
|
||||
+7
-1
@@ -78,6 +78,12 @@ struct ub_randstate {
|
||||
/** Size of key to use */
|
||||
#define SEED_SIZE 20
|
||||
|
||||
/**
|
||||
* Max random value. Similar to RAND_MAX, but more portable
|
||||
* (mingw uses only 15 bits random).
|
||||
*/
|
||||
#define MAX_VALUE 0x7fffffff
|
||||
|
||||
/** Number of bytes to reseed after */
|
||||
#define REKEY_BYTES (1 << 24)
|
||||
|
||||
@@ -168,7 +174,7 @@ ub_random(struct ub_randstate* s)
|
||||
RC4(&s->rc4, sizeof(r),
|
||||
(unsigned char *)&r, (unsigned char *)&r);
|
||||
s->rc4_ready -= sizeof(r);
|
||||
return (long int)((r) % (((unsigned)RAND_MAX + 1)));
|
||||
return (long int)((r) % (((unsigned)MAX_VALUE + 1)));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user