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:
Ondřej Surý
2018-04-22 14:56:28 +02:00
committed by Witold Kręcicki
parent 74dd289a1c
commit 3a4f820d62
115 changed files with 406 additions and 4912 deletions

View File

@@ -19,7 +19,6 @@
#include <isc/boolean.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/error.h>
#include <isc/log.h>
#include <isc/mem.h>
@@ -59,7 +58,6 @@ isc_mem_t *mctx;
unsigned char qdata[1024], rdata[1024];
isc_buffer_t qbuffer, rbuffer;
isc_taskmgr_t *taskmgr;
isc_entropy_t *ent = NULL;
isc_task_t *task1;
isc_log_t *lctx = NULL;
isc_logconfig_t *logconfig = NULL;
@@ -224,8 +222,7 @@ main(int argc, char *argv[]) {
}
}
RUNTIME_CHECK(isc_entropy_create(mctx, &ent) == ISC_R_SUCCESS);
RUNTIME_CHECK(dst_lib_init(mctx, ent, NULL, 0) == ISC_R_SUCCESS);
RUNTIME_CHECK(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS);
dns_result_register();
dst_result_register();
@@ -279,8 +276,6 @@ main(int argc, char *argv[]) {
dst_lib_destroy();
isc_entropy_detach(&ent);
isc_log_destroy(&lctx);
if (verbose)