diff options
author | lloyd <[email protected]> | 2008-09-28 16:04:33 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 16:04:33 +0000 |
commit | 4a04f965bd43bd591c8973ed025dc312823f1607 (patch) | |
tree | 30016b6e1ff6188dbcc0e183a7ae53b60051c960 /src | |
parent | 6edc83ddef93bddf70f1b259d80b104bf14524c2 (diff) |
Modularize the Adler32 checksum in checksums/adler32
Add a new option --disable-modules which allows for disabling any
set of modules that normally would be autoloaded.
Rename the Botan feature test macros from BOTAN_EXT_BLAH to BOTAN_HAS_BLAH,
which will be much more sensible especially when everything is done in this
fashion (eg, BOTAN_HAS_BLOWFISH or BOTAN_HAS_RSA, etc)
Diffstat (limited to 'src')
-rw-r--r-- | src/def_alg.cpp | 8 | ||||
-rw-r--r-- | src/modules.cpp | 26 | ||||
-rw-r--r-- | src/rng.cpp | 44 |
3 files changed, 42 insertions, 36 deletions
diff --git a/src/def_alg.cpp b/src/def_alg.cpp index bba904b11..835aa03e2 100644 --- a/src/def_alg.cpp +++ b/src/def_alg.cpp @@ -37,7 +37,10 @@ #include <botan/turing.h> #include <botan/wid_wake.h> -#include <botan/adler32.h> +#ifdef BOTAN_HAS_ADLER32 + #include <botan/adler32.h> +#endif + #include <botan/crc24.h> #include <botan/crc32.h> #include <botan/fork256.h> @@ -193,7 +196,10 @@ Default_Engine::find_hash(const std::string& algo_spec) const return 0; const std::string algo_name = global_state().deref_alias(name[0]); +#ifdef BOTAN_HAS_ADLER32 HANDLE_TYPE_NO_ARGS("Adler32", Adler32); +#endif + HANDLE_TYPE_NO_ARGS("CRC24", CRC24); HANDLE_TYPE_NO_ARGS("CRC32", CRC32); HANDLE_TYPE_NO_ARGS("FORK-256", FORK_256); diff --git a/src/modules.cpp b/src/modules.cpp index a5016aa8c..d38a29c9a 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -9,23 +9,23 @@ #include <botan/timers.h> #include <botan/parsing.h> -#if defined(BOTAN_EXT_MUTEX_PTHREAD) +#if defined(BOTAN_HAS_MUTEX_PTHREAD) #include <botan/mux_pthr.h> -#elif defined(BOTAN_EXT_MUTEX_WIN32) +#elif defined(BOTAN_HAS_MUTEX_WIN32) #include <botan/mux_win32.h> -#elif defined(BOTAN_EXT_MUTEX_QT) +#elif defined(BOTAN_HAS_MUTEX_QT) #include <botan/mux_qt.h> #endif -#if defined(BOTAN_EXT_ALLOC_MMAP) +#if defined(BOTAN_HAS_ALLOC_MMAP) #include <botan/mmap_mem.h> #endif -#if defined(BOTAN_EXT_ENGINE_GNU_MP) +#if defined(BOTAN_HAS_ENGINE_GNU_MP) #include <botan/eng_gmp.h> #endif -#if defined(BOTAN_EXT_ENGINE_OPENSSL) +#if defined(BOTAN_HAS_ENGINE_OPENSSL) #include <botan/eng_ossl.h> #endif @@ -36,11 +36,11 @@ namespace Botan { *************************************************/ Mutex_Factory* Builtin_Modules::mutex_factory() const { -#if defined(BOTAN_EXT_MUTEX_PTHREAD) +#if defined(BOTAN_HAS_MUTEX_PTHREAD) return new Pthread_Mutex_Factory; -#elif defined(BOTAN_EXT_MUTEX_WIN32) +#elif defined(BOTAN_HAS_MUTEX_WIN32) return new Win32_Mutex_Factory; -#elif defined(BOTAN_EXT_MUTEX_QT) +#elif defined(BOTAN_HAS_MUTEX_QT) return new Qt_Mutex_Factory; #else return 0; @@ -54,7 +54,7 @@ std::vector<Allocator*> Builtin_Modules::allocators() const { std::vector<Allocator*> allocators; -#if defined(BOTAN_EXT_ALLOC_MMAP) +#if defined(BOTAN_HAS_ALLOC_MMAP) allocators.push_back(new MemoryMapping_Allocator); #endif @@ -71,7 +71,7 @@ std::string Builtin_Modules::default_allocator() const { if(should_lock) { -#if defined(BOTAN_EXT_ALLOC_MMAP) +#if defined(BOTAN_HAS_ALLOC_MMAP) return "mmap"; #else return "locking"; @@ -90,11 +90,11 @@ std::vector<Engine*> Builtin_Modules::engines() const if(use_engines) { -#if defined(BOTAN_EXT_ENGINE_GNU_MP) +#if defined(BOTAN_HAS_ENGINE_GNU_MP) engines.push_back(new GMP_Engine); #endif -#if defined(BOTAN_EXT_ENGINE_OPENSSL) +#if defined(BOTAN_HAS_ENGINE_OPENSSL) engines.push_back(new OpenSSL_Engine); #endif } diff --git a/src/rng.cpp b/src/rng.cpp index 55c1c6032..3d13533ab 100644 --- a/src/rng.cpp +++ b/src/rng.cpp @@ -10,41 +10,41 @@ #include <botan/parsing.h> #include <botan/timers.h> -#if defined(BOTAN_EXT_TIMER_HARDWARE) +#if defined(BOTAN_HAS_TIMER_HARDWARE) #include <botan/tm_hard.h> -#elif defined(BOTAN_EXT_TIMER_POSIX) +#elif defined(BOTAN_HAS_TIMER_POSIX) #include <botan/tm_posix.h> -#elif defined(BOTAN_EXT_TIMER_UNIX) +#elif defined(BOTAN_HAS_TIMER_UNIX) #include <botan/tm_unix.h> -#elif defined(BOTAN_EXT_TIMER_WIN32) +#elif defined(BOTAN_HAS_TIMER_WIN32) #include <botan/tm_win32.h> #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_DEVICE) +#if defined(BOTAN_HAS_ENTROPY_SRC_DEVICE) #include <botan/es_dev.h> #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_EGD) +#if defined(BOTAN_HAS_ENTROPY_SRC_EGD) #include <botan/es_egd.h> #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_UNIX) +#if defined(BOTAN_HAS_ENTROPY_SRC_UNIX) #include <botan/es_unix.h> #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_BEOS) +#if defined(BOTAN_HAS_ENTROPY_SRC_BEOS) #include <botan/es_beos.h> #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_CAPI) +#if defined(BOTAN_HAS_ENTROPY_SRC_CAPI) #include <botan/es_capi.h> #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_WIN32) +#if defined(BOTAN_HAS_ENTROPY_SRC_WIN32) #include <botan/es_win32.h> #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_FTW) +#if defined(BOTAN_HAS_ENTROPY_SRC_FTW) #include <botan/es_ftw.h> #endif @@ -77,19 +77,19 @@ RandomNumberGenerator* RandomNumberGenerator::make_rng() new ANSI_X931_RNG("AES-256", new Randpool("AES-256", "HMAC(SHA-256)")); -#if defined(BOTAN_EXT_TIMER_HARDWARE) +#if defined(BOTAN_HAS_TIMER_HARDWARE) rng->add_entropy_source(new Hardware_Timer); -#elif defined(BOTAN_EXT_TIMER_POSIX) +#elif defined(BOTAN_HAS_TIMER_POSIX) rng->add_entropy_source(new POSIX_Timer); -#elif defined(BOTAN_EXT_TIMER_UNIX) +#elif defined(BOTAN_HAS_TIMER_UNIX) rng->add_entropy_source(new Unix_Timer); -#elif defined(BOTAN_EXT_TIMER_WIN32) +#elif defined(BOTAN_HAS_TIMER_WIN32) rng->add_entropy_source(new Win32_Timer); #else rng->add_entropy_source(new Timer); #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_DEVICE) +#if defined(BOTAN_HAS_ENTROPY_SRC_DEVICE) rng->add_entropy_source( new Device_EntropySource( split_on("/dev/random:/dev/srandom:/dev/urandom", ':') @@ -97,31 +97,31 @@ RandomNumberGenerator* RandomNumberGenerator::make_rng() ); #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_EGD) +#if defined(BOTAN_HAS_ENTROPY_SRC_EGD) rng->add_entropy_source( new EGD_EntropySource(split_on("/var/run/egd-pool:/dev/egd-pool", ':')) ); #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_CAPI) +#if defined(BOTAN_HAS_ENTROPY_SRC_CAPI) rng->add_entropy_source(new Win32_CAPI_EntropySource); #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_WIN32) +#if defined(BOTAN_HAS_ENTROPY_SRC_WIN32) rng->add_entropy_source(new Win32_EntropySource); #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_UNIX) +#if defined(BOTAN_HAS_ENTROPY_SRC_UNIX) rng->add_entropy_source( new Unix_EntropySource(split_on("/bin:/sbin:/usr/bin:/usr/sbin", ':')) ); #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_BEOS) +#if defined(BOTAN_HAS_ENTROPY_SRC_BEOS) rng->add_entropy_source(new BeOS_EntropySource); #endif -#if defined(BOTAN_EXT_ENTROPY_SRC_FTW) +#if defined(BOTAN_HAS_ENTROPY_SRC_FTW) rng->add_entropy_source(new FTW_EntropySource("/proc")); #endif |