Replace all random functions with isc_random, isc_random_buf and isc_random_uniform API.
The three functions has been modeled after the arc4random family of functions, and they will always return random bytes. The isc_random family of functions internally use these CSPRNG (if available): 1. getrandom() libc call (might be available on Linux and Solaris) 2. SYS_getrandom syscall (might be available on Linux, detected at runtime) 3. arc4random(), arc4random_buf() and arc4random_uniform() (available on BSDs and Mac OS X) 4. crypto library function: 4a. RAND_bytes in case OpenSSL 4b. pkcs_C_GenerateRandom() in case PKCS#11 library
This commit is contained in:
committed by
Witold Kręcicki
parent
74dd289a1c
commit
3a4f820d62
@@ -34,7 +34,6 @@
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/entropy.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/mem.h>
|
||||
@@ -354,7 +353,6 @@ ATF_TC_BODY(deserialize_corrupt, tc) {
|
||||
int fd;
|
||||
off_t filesize = 0;
|
||||
char *base, *p, *q;
|
||||
isc_uint32_t r;
|
||||
int i;
|
||||
|
||||
UNUSED(tc);
|
||||
@@ -389,14 +387,11 @@ ATF_TC_BODY(deserialize_corrupt, tc) {
|
||||
close(fd);
|
||||
|
||||
/* Randomly fuzz a portion of the memory */
|
||||
isc_random_get(&r);
|
||||
p = base + (r % filesize);
|
||||
p = base + (isc_random() % filesize);
|
||||
q = base + filesize;
|
||||
isc_random_get(&r);
|
||||
q -= (r % (q - p));
|
||||
q -= (isc_random() % (q - p));
|
||||
while (p++ < q) {
|
||||
isc_random_get(&r);
|
||||
*p = r & 0xff;
|
||||
*p = isc_random() & 0xff;
|
||||
}
|
||||
|
||||
result = dns_rbt_deserialize_tree(base, filesize, 0, mctx,
|
||||
|
||||
Reference in New Issue
Block a user