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
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/entropy.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/socket.h>
|
||||
@@ -44,7 +43,6 @@ struct client {
|
||||
};
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static isc_entropy_t *ectx = NULL;
|
||||
static isc_mempool_t *cmp;
|
||||
static isc_log_t *lctx;
|
||||
static isc_logconfig_t *lcfg;
|
||||
@@ -160,7 +158,7 @@ create_managers(void) {
|
||||
check_result(result, "isc_socketmgr_create");
|
||||
|
||||
dispatchmgr = NULL;
|
||||
result = dns_dispatchmgr_create(mctx, NULL, &dispatchmgr);
|
||||
result = dns_dispatchmgr_create(mctx, &dispatchmgr);
|
||||
check_result(result, "dns_dispatchmgr_create");
|
||||
}
|
||||
|
||||
@@ -306,8 +304,6 @@ main(int argc, char **argv) {
|
||||
== ISC_R_SUCCESS);
|
||||
isc_mempool_setname(cmp, "adb test clients");
|
||||
|
||||
result = isc_entropy_create(mctx, &ectx);
|
||||
check_result(result, "isc_entropy_create()");
|
||||
result = isc_log_create(mctx, &lctx, &lcfg);
|
||||
check_result(result, "isc_log_create()");
|
||||
isc_log_setcontext(lctx);
|
||||
@@ -417,8 +413,6 @@ main(int argc, char **argv) {
|
||||
|
||||
isc_log_destroy(&lctx);
|
||||
|
||||
isc_entropy_detach(&ectx);
|
||||
|
||||
isc_mempool_destroy(&cmp);
|
||||
isc_mem_stats(mctx, stdout);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
Reference in New Issue
Block a user