diff options
author | Jack Lloyd <[email protected]> | 2015-07-11 22:13:33 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-07-11 22:13:33 -0400 |
commit | 12e884924f9d620e0f3cce632b0f9b71a721b4d1 (patch) | |
tree | 4879cf655f818ef8d6a9fa9667a67da0f2fef51c /src/cmd | |
parent | 681805cf95b72d1c407f7c5f9a3569ec3fae6303 (diff) |
Fix fuzzer.cpp to compile even if x509 or tls is disabled
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/fuzzer.cpp | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/cmd/fuzzer.cpp b/src/cmd/fuzzer.cpp index 09c1fba42..a94706967 100644 --- a/src/cmd/fuzzer.cpp +++ b/src/cmd/fuzzer.cpp @@ -5,15 +5,23 @@ */ #include "apps.h" +#include <fstream> +#include <botan/auto_rng.h> + +#if defined(BOTAN_HAS_X509_CERTIFICATES) #include <botan/x509cert.h> #include <botan/x509_crl.h> #include <botan/pkcs8.h> +#endif + +#if defined(BOTAN_HAS_TLS) #include <botan/tls_client.h> -#include <botan/system_rng.h> -#include <fstream> +#endif namespace { +#if defined(BOTAN_HAS_TLS) + class Fuzzer_Creds : public Credentials_Manager { public: @@ -38,6 +46,8 @@ class Fuzzer_Creds : public Credentials_Manager } }; +#endif + int fuzzer(int argc, char* argv[]) { if(argc != 3) @@ -51,21 +61,31 @@ int fuzzer(int argc, char* argv[]) const std::string type = argv[1]; const std::string input = argv[2]; - auto& rng = system_rng(); + AutoSeeded_RNG rng; +#if defined(BOTAN_HAS_X509_CERTIFICATES) if(type == "cert") { X509_Certificate cert(input); + return 0; } - else if(type == "crl") + + if(type == "crl") { X509_CRL crl(input); + return 0; } - else if(type == "privkey") + + if(type == "privkey") { std::unique_ptr<Private_Key>(PKCS8::load_key(input, rng)); + return 0; } - else if(type == "tls_client") + +#endif + +#if defined(BOTAN_HAS_TLS) + if(type == "tls_client") { auto dev_null = [](const byte[], size_t) {}; @@ -106,15 +126,14 @@ int fuzzer(int argc, char* argv[]) } catch(std::exception& e) { + return 0; } + return 0; } - else - { - std::cout << "Unhandled type " << type << "\n"; - return 1; - } +#endif - return 0; + std::cout << "Unknown type '" << type << "'\n"; + return 1; } REGISTER_APP(fuzzer); |