diff options
Diffstat (limited to 'src')
32 files changed, 188 insertions, 24 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 212ba23e9..d652b7a6d 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -17,16 +17,28 @@ #include <set> // Always available: -#include <botan/block_cipher.h> -#include <botan/stream_cipher.h> -#include <botan/hash.h> -#include <botan/cipher_mode.h> #include <botan/entropy_src.h> #include <botan/parsing.h> #include <botan/cpuid.h> #include <botan/internal/os_utils.h> #include <botan/version.h> +#if defined(BOTAN_HAS_BLOCK_CIPHER) + #include <botan/block_cipher.h> +#endif + +#if defined(BOTAN_HAS_STREAM_CIPHER) + #include <botan/stream_cipher.h> +#endif + +#if defined(BOTAN_HAS_HASH) + #include <botan/hash.h> +#endif + +#if defined(BOTAN_HAS_CIPHER_MODE) + #include <botan/cipher_mode.h> +#endif + #if defined(BOTAN_HAS_MAC) #include <botan/mac.h> #endif @@ -693,29 +705,40 @@ class Speed final : public Command { using namespace std::placeholders; - if(Botan::HashFunction::providers(algo).size() > 0) + if(false) + { + } +#if defined(BOTAN_HAS_HASH) + else if(Botan::HashFunction::providers(algo).size() > 0) { bench_providers_of<Botan::HashFunction>( algo, provider, msec, buf_sizes, std::bind(&Speed::bench_hash, this, _1, _2, _3, _4)); } +#endif +#if defined(BOTAN_HAS_BLOCK_CIPHER) else if(Botan::BlockCipher::providers(algo).size() > 0) { bench_providers_of<Botan::BlockCipher>( algo, provider, msec, buf_sizes, std::bind(&Speed::bench_block_cipher, this, _1, _2, _3, _4)); } +#endif +#if defined(BOTAN_HAS_STREAM_CIPHER) else if(Botan::StreamCipher::providers(algo).size() > 0) { bench_providers_of<Botan::StreamCipher>( algo, provider, msec, buf_sizes, std::bind(&Speed::bench_stream_cipher, this, _1, _2, _3, _4)); } +#endif +#if defined(BOTAN_HAS_CIPHER_MODE) else if(auto enc = Botan::get_cipher_mode(algo, Botan::ENCRYPTION)) { auto dec = Botan::get_cipher_mode(algo, Botan::DECRYPTION); bench_cipher_mode(*enc, *dec, msec, buf_sizes); } +#endif #if defined(BOTAN_HAS_MAC) else if(Botan::MessageAuthenticationCode::providers(algo).size() > 0) { @@ -944,6 +967,7 @@ class Speed final : public Command } } +#if defined(BOTAN_HAS_BLOCK_CIPHER) void bench_block_cipher(Botan::BlockCipher& cipher, const std::string& provider, std::chrono::milliseconds runtime, @@ -979,7 +1003,9 @@ class Speed final : public Command record_result(decrypt_timer); } } +#endif +#if defined(BOTAN_HAS_STREAM_CIPHER) void bench_stream_cipher( Botan::StreamCipher& cipher, const std::string& provider, @@ -1009,7 +1035,9 @@ class Speed final : public Command record_result(encrypt_timer); } } +#endif +#if defined(BOTAN_HAS_HASH) void bench_hash( Botan::HashFunction& hash, const std::string& provider, @@ -1025,6 +1053,7 @@ class Speed final : public Command record_result(timer); } } +#endif #if defined(BOTAN_HAS_MAC) void bench_mac( @@ -1048,6 +1077,7 @@ class Speed final : public Command } #endif +#if defined(BOTAN_HAS_CIPHER_MODE) void bench_cipher_mode( Botan::Cipher_Mode& enc, Botan::Cipher_Mode& dec, @@ -1092,6 +1122,7 @@ class Speed final : public Command record_result(decrypt_timer); } } +#endif void bench_rng( Botan::RandomNumberGenerator& rng, diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp index ebc9673bd..91638bfea 100644 --- a/src/cli/utils.cpp +++ b/src/cli/utils.cpp @@ -8,13 +8,16 @@ #include "cli.h" #include <botan/version.h> -#include <botan/hash.h> #include <botan/rng.h> #include <botan/cpuid.h> #include <botan/hex.h> #include <botan/parsing.h> #include <sstream> +#if defined(BOTAN_HAS_HASH) + #include <botan/hash.h> +#endif + #if defined(BOTAN_HAS_MAC) #include <botan/mac.h> #endif @@ -142,6 +145,8 @@ class Print_Cpuid final : public Command BOTAN_REGISTER_COMMAND("cpuid", Print_Cpuid); +#if defined(BOTAN_HAS_HASH) + class Hash final : public Command { public: @@ -183,6 +188,8 @@ class Hash final : public Command BOTAN_REGISTER_COMMAND("hash", Hash); +#endif + class RNG final : public Command { public: diff --git a/src/lib/base/info.txt b/src/lib/base/info.txt index c5f89f470..fd3f7b890 100644 --- a/src/lib/base/info.txt +++ b/src/lib/base/info.txt @@ -11,11 +11,7 @@ symkey.h </header:public> <requires> -block -hash hex -modes rng -stream utils </requires> diff --git a/src/lib/base/lookup.h b/src/lib/base/lookup.h index 18c885d16..1cfa7d3c9 100644 --- a/src/lib/base/lookup.h +++ b/src/lib/base/lookup.h @@ -9,14 +9,23 @@ #define BOTAN_LOOKUP_H_ #include <botan/build.h> -#include <botan/block_cipher.h> -#include <botan/stream_cipher.h> -#include <botan/hash.h> #include <botan/exceptn.h> #include <string> #include <vector> #include <memory> +#if defined(BOTAN_HAS_BLOCK_CIPHER) + #include <botan/block_cipher.h> +#endif + +#if defined(BOTAN_HAS_STREAM_CIPHER) + #include <botan/stream_cipher.h> +#endif + +#if defined(BOTAN_HAS_HASH) + #include <botan/hash.h> +#endif + #if defined(BOTAN_HAS_MAC) #include <botan/mac.h> #endif @@ -34,6 +43,8 @@ namespace Botan { * caller assume ownership of them */ +#if defined(BOTAN_HAS_BLOCK_CIPHER) + /** * Block cipher factory method. * @@ -61,6 +72,10 @@ inline std::vector<std::string> get_block_cipher_providers(const std::string& al return BlockCipher::providers(algo_spec); } +#endif + +#if defined(BOTAN_HAS_STREAM_CIPHER) + /** * Stream cipher factory method. * @@ -88,6 +103,10 @@ inline std::vector<std::string> get_stream_cipher_providers(const std::string& a return StreamCipher::providers(algo_spec); } +#endif + +#if defined(BOTAN_HAS_HASH) + /** * Hash function factory method. * @@ -122,6 +141,8 @@ inline std::vector<std::string> get_hash_function_providers(const std::string& a return HashFunction::providers(algo_spec); } +#endif + #if defined(BOTAN_HAS_MAC) /** * MAC factory method. diff --git a/src/lib/block/lion/info.txt b/src/lib/block/lion/info.txt index c818627eb..a7b93e92e 100644 --- a/src/lib/block/lion/info.txt +++ b/src/lib/block/lion/info.txt @@ -1,3 +1,8 @@ <defines> LION -> 20131128 </defines> + +<requires> +stream +hash +</requires> diff --git a/src/lib/ffi/info.txt b/src/lib/ffi/info.txt index d85faee0e..c02bd3a39 100644 --- a/src/lib/ffi/info.txt +++ b/src/lib/ffi/info.txt @@ -14,6 +14,9 @@ ffi.h </header:public> <requires> +block +stream +hash aead kdf pbkdf diff --git a/src/lib/filters/algo_filt.cpp b/src/lib/filters/algo_filt.cpp index 63906907c..099c413d3 100644 --- a/src/lib/filters/algo_filt.cpp +++ b/src/lib/filters/algo_filt.cpp @@ -10,6 +10,8 @@ namespace Botan { +#if defined(BOTAN_HAS_STREAM_CIPHER) + StreamCipher_Filter::StreamCipher_Filter(StreamCipher* cipher) : m_buffer(DEFAULT_BUFFERSIZE), m_cipher(cipher) @@ -48,6 +50,10 @@ void StreamCipher_Filter::write(const uint8_t input[], size_t length) } } +#endif + +#if defined(BOTAN_HAS_HASH) + Hash_Filter::Hash_Filter(const std::string& hash_name, size_t len) : m_hash(HashFunction::create_or_throw(hash_name)), m_out_len(len) @@ -62,6 +68,9 @@ void Hash_Filter::end_msg() else send(output); } +#endif + +#if defined(BOTAN_HAS_MAC) MAC_Filter::MAC_Filter(const std::string& mac_name, size_t len) : m_mac(MessageAuthenticationCode::create_or_throw(mac_name)), @@ -85,4 +94,6 @@ void MAC_Filter::end_msg() send(output); } +#endif + } diff --git a/src/lib/filters/filters.h b/src/lib/filters/filters.h index af310a599..b4aee1207 100644 --- a/src/lib/filters/filters.h +++ b/src/lib/filters/filters.h @@ -8,14 +8,22 @@ #ifndef BOTAN_FILTERS_H_ #define BOTAN_FILTERS_H_ -#include <botan/stream_cipher.h> -#include <botan/hash.h> -#include <botan/mac.h> - -#include <botan/pipe.h> #include <botan/basefilt.h> #include <botan/key_filt.h> #include <botan/data_snk.h> +#include <botan/pipe.h> + +#if defined(BOTAN_HAS_STREAM_CIPHER) + #include <botan/stream_cipher.h> +#endif + +#if defined(BOTAN_HAS_HASH) + #include <botan/hash.h> +#endif + +#if defined(BOTAN_HAS_MAC) + #include <botan/mac.h> +#endif #if defined(BOTAN_HAS_CODEC_FILTERS) #include <botan/b64_filt.h> @@ -24,6 +32,8 @@ namespace Botan { +#if defined(BOTAN_HAS_STREAM_CIPHER) + /** * Stream Cipher Filter */ @@ -89,6 +99,9 @@ class BOTAN_PUBLIC_API(2,0) StreamCipher_Filter final : public Keyed_Filter secure_vector<uint8_t> m_buffer; std::unique_ptr<StreamCipher> m_cipher; }; +#endif + +#if defined(BOTAN_HAS_HASH) /** * Hash Filter. @@ -126,6 +139,9 @@ class BOTAN_PUBLIC_API(2,0) Hash_Filter final : public Filter std::unique_ptr<HashFunction> m_hash; const size_t m_out_len; }; +#endif + +#if defined(BOTAN_HAS_MAC) /** * MessageAuthenticationCode Filter. @@ -204,6 +220,7 @@ class BOTAN_PUBLIC_API(2,0) MAC_Filter final : public Keyed_Filter std::unique_ptr<MessageAuthenticationCode> m_mac; const size_t m_out_len; }; +#endif } diff --git a/src/lib/hash/checksum/info.txt b/src/lib/hash/checksum/info.txt new file mode 100644 index 000000000..5aab13b59 --- /dev/null +++ b/src/lib/hash/checksum/info.txt @@ -0,0 +1,4 @@ + +<requires> +hash +</requires> diff --git a/src/lib/hash/info.txt b/src/lib/hash/info.txt index e71318b73..8d3817058 100644 --- a/src/lib/hash/info.txt +++ b/src/lib/hash/info.txt @@ -1,3 +1,7 @@ +<defines> +HASH -> 20180112 +</defines> + <header:public> hash.h </header:public> diff --git a/src/lib/kdf/kdf1/info.txt b/src/lib/kdf/kdf1/info.txt index a2372c7e3..f88268f93 100644 --- a/src/lib/kdf/kdf1/info.txt +++ b/src/lib/kdf/kdf1/info.txt @@ -1,3 +1,7 @@ <defines> KDF1 -> 20131128 </defines> + +<requires> +hash +</requires> diff --git a/src/lib/kdf/kdf1_iso18033/info.txt b/src/lib/kdf/kdf1_iso18033/info.txt index af6026836..494b8358b 100644 --- a/src/lib/kdf/kdf1_iso18033/info.txt +++ b/src/lib/kdf/kdf1_iso18033/info.txt @@ -1,3 +1,7 @@ <defines> KDF1_18033 -> 20160128 </defines> + +<requires> +hash +</requires> diff --git a/src/lib/kdf/kdf2/info.txt b/src/lib/kdf/kdf2/info.txt index 26c824cf2..e222a4521 100644 --- a/src/lib/kdf/kdf2/info.txt +++ b/src/lib/kdf/kdf2/info.txt @@ -1,3 +1,7 @@ <defines> KDF2 -> 20131128 </defines> + +<requires> +hash +</requires> diff --git a/src/lib/mac/cbc_mac/info.txt b/src/lib/mac/cbc_mac/info.txt index 1cf22eae0..994a63872 100644 --- a/src/lib/mac/cbc_mac/info.txt +++ b/src/lib/mac/cbc_mac/info.txt @@ -1,3 +1,7 @@ <defines> CBC_MAC -> 20131128 </defines> + +<requires> +block +</requires> diff --git a/src/lib/mac/cmac/info.txt b/src/lib/mac/cmac/info.txt index bdddca1b2..d78b3851e 100644 --- a/src/lib/mac/cmac/info.txt +++ b/src/lib/mac/cmac/info.txt @@ -3,5 +3,6 @@ CMAC -> 20131128 </defines> <requires> +block poly_dbl </requires> diff --git a/src/lib/mac/gmac/info.txt b/src/lib/mac/gmac/info.txt index 416e914db..104e35962 100644 --- a/src/lib/mac/gmac/info.txt +++ b/src/lib/mac/gmac/info.txt @@ -4,5 +4,5 @@ GMAC -> 20160207 <requires> gcm -mac +block </requires> diff --git a/src/lib/mac/hmac/info.txt b/src/lib/mac/hmac/info.txt index cf1a288f6..50dc665dc 100644 --- a/src/lib/mac/hmac/info.txt +++ b/src/lib/mac/hmac/info.txt @@ -1,3 +1,7 @@ <defines> HMAC -> 20131128 </defines> + +<requires> +hash +</requires> diff --git a/src/lib/misc/nist_keywrap/info.txt b/src/lib/misc/nist_keywrap/info.txt index 3fb3639f0..b48e84c11 100644 --- a/src/lib/misc/nist_keywrap/info.txt +++ b/src/lib/misc/nist_keywrap/info.txt @@ -1,3 +1,7 @@ <defines> NIST_KEYWRAP -> 20171119 </defines> + +<requires> +block +</requires> diff --git a/src/lib/modes/aead/ccm/info.txt b/src/lib/modes/aead/ccm/info.txt index b12a43b03..9341cea7f 100644 --- a/src/lib/modes/aead/ccm/info.txt +++ b/src/lib/modes/aead/ccm/info.txt @@ -1,3 +1,7 @@ <defines> AEAD_CCM -> 20131128 </defines> + +<requires> +block +</requires> diff --git a/src/lib/modes/aead/gcm/info.txt b/src/lib/modes/aead/gcm/info.txt index 6dc5c6928..e46fa34bc 100644 --- a/src/lib/modes/aead/gcm/info.txt +++ b/src/lib/modes/aead/gcm/info.txt @@ -3,5 +3,6 @@ AEAD_GCM -> 20131128 </defines> <requires> +block ctr </requires> diff --git a/src/lib/modes/aead/ocb/info.txt b/src/lib/modes/aead/ocb/info.txt index 9af91f238..4e16e2362 100644 --- a/src/lib/modes/aead/ocb/info.txt +++ b/src/lib/modes/aead/ocb/info.txt @@ -3,5 +3,6 @@ AEAD_OCB -> 20131128 </defines> <requires> +block poly_dbl </requires> diff --git a/src/lib/modes/cbc/info.txt b/src/lib/modes/cbc/info.txt index a1e3e1dec..778ba1e25 100644 --- a/src/lib/modes/cbc/info.txt +++ b/src/lib/modes/cbc/info.txt @@ -3,5 +3,6 @@ MODE_CBC -> 20131128 </defines> <requires> +block mode_pad </requires> diff --git a/src/lib/modes/cfb/info.txt b/src/lib/modes/cfb/info.txt index 29744514f..77a6af448 100644 --- a/src/lib/modes/cfb/info.txt +++ b/src/lib/modes/cfb/info.txt @@ -1,3 +1,7 @@ <defines> MODE_CFB -> 20131128 </defines> + +<requires> +block +</requires> diff --git a/src/lib/modes/cipher_mode.cpp b/src/lib/modes/cipher_mode.cpp index 6023102da..804713be7 100644 --- a/src/lib/modes/cipher_mode.cpp +++ b/src/lib/modes/cipher_mode.cpp @@ -51,10 +51,12 @@ Cipher_Mode* get_cipher_mode(const std::string& algo, Cipher_Dir direction, } #endif +#if defined(BOTAN_HAS_STREAM_CIPHER) if(auto sc = StreamCipher::create(algo)) { return new Stream_Cipher_Mode(sc.release()); } +#endif #if defined(BOTAN_HAS_AEAD_MODES) if(auto aead = get_aead(algo, direction)) diff --git a/src/lib/modes/stream_mode.h b/src/lib/modes/stream_mode.h index 8db23d993..3bce01731 100644 --- a/src/lib/modes/stream_mode.h +++ b/src/lib/modes/stream_mode.h @@ -9,10 +9,15 @@ #define BOTAN_STREAM_MODE_H_ #include <botan/cipher_mode.h> -#include <botan/stream_cipher.h> + +#if defined(BOTAN_HAS_STREAM_CIPHER) + #include <botan/stream_cipher.h> +#endif namespace Botan { +#if defined(BOTAN_HAS_STREAM_CIPHER) + class BOTAN_PUBLIC_API(2,0) Stream_Cipher_Mode final : public Cipher_Mode { public: @@ -70,6 +75,8 @@ class BOTAN_PUBLIC_API(2,0) Stream_Cipher_Mode final : public Cipher_Mode std::unique_ptr<StreamCipher> m_cipher; }; +#endif + } #endif diff --git a/src/lib/modes/xts/info.txt b/src/lib/modes/xts/info.txt index 2a41f696f..cee850be7 100644 --- a/src/lib/modes/xts/info.txt +++ b/src/lib/modes/xts/info.txt @@ -3,5 +3,6 @@ MODE_XTS -> 20131128 </defines> <requires> +block poly_dbl </requires> diff --git a/src/lib/stream/ctr/info.txt b/src/lib/stream/ctr/info.txt index 4cb30fa2f..270ceecf8 100644 --- a/src/lib/stream/ctr/info.txt +++ b/src/lib/stream/ctr/info.txt @@ -1,3 +1,7 @@ <defines> CTR_BE -> 20131128 </defines> + +<requires> +block +</requires> diff --git a/src/lib/stream/ofb/info.txt b/src/lib/stream/ofb/info.txt index be585d0d3..2675e7857 100644 --- a/src/lib/stream/ofb/info.txt +++ b/src/lib/stream/ofb/info.txt @@ -1,3 +1,7 @@ <defines> OFB -> 20131128 </defines> + +<requires> +block +</requires> diff --git a/src/tests/test_block.cpp b/src/tests/test_block.cpp index 02115b66a..a274b260b 100644 --- a/src/tests/test_block.cpp +++ b/src/tests/test_block.cpp @@ -5,6 +5,9 @@ */ #include "tests.h" + +#if defined(BOTAN_HAS_BLOCK_CIPHER) + #include <botan/block_cipher.h> namespace Botan_Tests { @@ -144,3 +147,5 @@ class Block_Cipher_Tests final : public Text_Based_Test BOTAN_REGISTER_TEST("block", Block_Cipher_Tests); } + +#endif diff --git a/src/tests/test_hash.cpp b/src/tests/test_hash.cpp index 39b13de32..0424e94f3 100644 --- a/src/tests/test_hash.cpp +++ b/src/tests/test_hash.cpp @@ -6,10 +6,14 @@ #include "tests.h" -#include <botan/hash.h> +#if defined(BOTAN_HAS_HASH) + #include <botan/hash.h> +#endif namespace Botan_Tests { +#if defined(BOTAN_HAS_HASH) + namespace { class Hash_Function_Tests final : public Text_Based_Test @@ -109,4 +113,6 @@ BOTAN_REGISTER_TEST("hash", Hash_Function_Tests); } +#endif + } diff --git a/src/tests/test_otp.cpp b/src/tests/test_otp.cpp index 9bd4c0f18..4604356f9 100644 --- a/src/tests/test_otp.cpp +++ b/src/tests/test_otp.cpp @@ -6,16 +6,17 @@ */ #include "tests.h" -#include <botan/hash.h> #if defined(BOTAN_HAS_HOTP) #include <botan/parsing.h> #include <botan/hotp.h> + #include <botan/hash.h> #endif #if defined(BOTAN_HAS_TOTP) #include <botan/totp.h> #include <botan/calendar.h> + #include <botan/hash.h> #endif namespace Botan_Tests { diff --git a/src/tests/test_rfc6979.cpp b/src/tests/test_rfc6979.cpp index 8b8af434f..b9de7fcb9 100644 --- a/src/tests/test_rfc6979.cpp +++ b/src/tests/test_rfc6979.cpp @@ -8,10 +8,9 @@ #if defined(BOTAN_HAS_RFC6979_GENERATOR) #include <botan/rfc6979.h> + #include <botan/hash.h> #endif -#include <botan/hash.h> - namespace Botan_Tests { namespace { |