diff options
author | Werner Koch <[email protected]> | 2002-08-03 10:50:53 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2002-08-03 10:50:53 +0000 |
commit | 85aa3e18c296cdf18f76a47754d5270eb4e3630e (patch) | |
tree | c47a142fce35ba999e72fad2037a8020b3d8ab16 /cipher/random.c | |
parent | 2002-08-02 Timo Schulz <[email protected]> (diff) | |
download | gnupg-85aa3e18c296cdf18f76a47754d5270eb4e3630e.tar.gz gnupg-85aa3e18c296cdf18f76a47754d5270eb4e3630e.zip |
The big extension module removal.
Diffstat (limited to '')
-rw-r--r-- | cipher/random.c | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/cipher/random.c b/cipher/random.c index 2c958d9d4..1d7bf8a93 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -1,5 +1,5 @@ /* random.c - random number generator - * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -56,8 +56,7 @@ #include "i18n.h" #include "random.h" #include "rand-internal.h" -#include "dynload.h" - +#include "algorithms.h" #ifndef RAND_MAX /* for SunOS */ #define RAND_MAX 32767 @@ -125,6 +124,37 @@ static struct { ulong naddbytes; } rndstats; + +static int (* +getfnc_gather_random (void))(void (*)(const void*, size_t, int), int, + size_t, int) +{ +#ifdef USE_RNDLINUX + return rndlinux_gather_random; +#endif +#ifdef USE_RNDUNIX + return rndunix_gather_random; +#endif +#ifdef USE_RNDEGD + return rndegd_gather_random; +#endif +#ifdef USE_RNDW32 + return rndw32_gather_random; +#endif + return NULL; +} + +static void (* +getfnc_fast_random_poll (void))( void (*)(const void*, size_t, int), int) +{ +#ifdef USE_RNDW32 + return rndw32_gather_random_fast; +#endif + return NULL; +} + + + static void initialize(void) { @@ -136,7 +166,6 @@ initialize(void) keypool = secure_alloc ? m_alloc_secure_clear(POOLSIZE+BLOCKLEN) : m_alloc_clear(POOLSIZE+BLOCKLEN); is_initialized = 1; - cipher_modules_constructor(); } static void @@ -560,7 +589,7 @@ fast_random_poll() if( !is_initialized ) initialize(); initialized = 1; - fnc = dynload_getfnc_fast_random_poll(); + fnc = getfnc_fast_random_poll(); } if( fnc ) { (*fnc)( add_randomness, 1 ); @@ -637,7 +666,7 @@ read_random_source( int requester, size_t length, int level ) if( !fnc ) { if( !is_initialized ) initialize(); - fnc = dynload_getfnc_gather_random(); + fnc = getfnc_gather_random(); if( !fnc ) { faked_rng = 1; fnc = gather_faked; @@ -685,3 +714,4 @@ gather_faked( void (*add)(const void*, size_t, int), int requester, return 0; /* okay */ } + |