aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-26 20:20:32 +0200
committerSimon Warta <[email protected]>2015-07-03 10:33:45 +0200
commitf472b8fc61accbbaa6a36af9d2d20b0fde37a1a2 (patch)
tree8e71c24da6f7f5b037024741105ca392369e590a /src/cmd
parentcd9037e29f32197b9c37ef7bec955ac2372b543b (diff)
Make Botan compile when only some modules are enabled
Fixes #146.
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/apps.h1
-rw-r--r--src/cmd/asn1.cpp4
-rw-r--r--src/cmd/base64.cpp4
-rw-r--r--src/cmd/bcrypt.cpp1
-rw-r--r--src/cmd/ca.cpp1
-rw-r--r--src/cmd/cert_verify.cpp6
-rw-r--r--src/cmd/compress.cpp4
-rw-r--r--src/cmd/factor.cpp4
-rw-r--r--src/cmd/fpe.cpp5
-rw-r--r--src/cmd/hash.cpp5
-rw-r--r--src/cmd/is_prime.cpp5
-rw-r--r--src/cmd/keygen.cpp7
-rw-r--r--src/cmd/pkcs10.cpp10
-rw-r--r--src/cmd/self_sig.cpp11
-rw-r--r--src/cmd/speed.cpp11
-rw-r--r--src/cmd/speed_pk.cpp20
-rw-r--r--src/cmd/tls_client.cpp7
-rw-r--r--src/cmd/tls_server.cpp5
18 files changed, 80 insertions, 31 deletions
diff --git a/src/cmd/apps.h b/src/cmd/apps.h
index 8e8e48742..bcb860fb4 100644
--- a/src/cmd/apps.h
+++ b/src/cmd/apps.h
@@ -8,6 +8,7 @@
#include <functional>
#include <string>
#include <set>
+#include <botan/build.h>
#include <botan/hex.h>
#include <botan/auto_rng.h>
#include "getopt.h"
diff --git a/src/cmd/asn1.cpp b/src/cmd/asn1.cpp
index f5b6b6b4e..7264c1a6d 100644
--- a/src/cmd/asn1.cpp
+++ b/src/cmd/asn1.cpp
@@ -6,6 +6,8 @@
#include "apps.h"
+#if defined(BOTAN_HAS_ASN1) && defined(BOTAN_HAS_PEM_CODEC)
+
#include <botan/bigint.h>
#include <botan/hex.h>
#include <botan/der_enc.h>
@@ -350,3 +352,5 @@ int asn1(int argc, char* argv[])
REGISTER_APP(asn1);
}
+
+#endif // BOTAN_HAS_ASN1 && BOTAN_HAS_PEM_CODEC
diff --git a/src/cmd/base64.cpp b/src/cmd/base64.cpp
index 84a30e8ea..d9b2ffa3d 100644
--- a/src/cmd/base64.cpp
+++ b/src/cmd/base64.cpp
@@ -6,6 +6,9 @@
*/
#include "apps.h"
+
+#if defined(BOTAN_HAS_CODEC_FILTERS)
+
#include <fstream>
#include <iostream>
#include <string>
@@ -88,3 +91,4 @@ int base64(int argc, char* argv[])
REGISTER_APP(base64);
}
+#endif // BOTAN_HAS_CODEC_FILTERS
diff --git a/src/cmd/bcrypt.cpp b/src/cmd/bcrypt.cpp
index 498e8f8fd..3cf5f7516 100644
--- a/src/cmd/bcrypt.cpp
+++ b/src/cmd/bcrypt.cpp
@@ -7,6 +7,7 @@
#include "apps.h"
#if defined(BOTAN_HAS_BCRYPT)
+
#include <botan/bcrypt.h>
namespace {
diff --git a/src/cmd/ca.cpp b/src/cmd/ca.cpp
index b32f07f51..427352c20 100644
--- a/src/cmd/ca.cpp
+++ b/src/cmd/ca.cpp
@@ -7,6 +7,7 @@
#include "apps.h"
#if defined(BOTAN_HAS_X509_CERTIFICATES)
+
#include <botan/x509_ca.h>
namespace {
diff --git a/src/cmd/cert_verify.cpp b/src/cmd/cert_verify.cpp
index feff40141..15cd5b8f8 100644
--- a/src/cmd/cert_verify.cpp
+++ b/src/cmd/cert_verify.cpp
@@ -45,8 +45,8 @@ int cert_verify(int argc, char* argv[])
return 0;
}
-}
-
REGISTER_APP(cert_verify);
-#endif
+}
+
+#endif // BOTAN_HAS_X509_CERTIFICATES
diff --git a/src/cmd/compress.cpp b/src/cmd/compress.cpp
index 35f74f8af..c9168f3df 100644
--- a/src/cmd/compress.cpp
+++ b/src/cmd/compress.cpp
@@ -6,6 +6,8 @@
#include "apps.h"
+#if defined(BOTAN_HAS_COMPRESSION)
+
#include <botan/compression.h>
#include <fstream>
@@ -120,3 +122,5 @@ REGISTER_APP(compress);
REGISTER_APP(uncompress);
}
+
+#endif // BOTAN_HAS_COMPRESSION
diff --git a/src/cmd/factor.cpp b/src/cmd/factor.cpp
index e4e20f5b7..5ea53478d 100644
--- a/src/cmd/factor.cpp
+++ b/src/cmd/factor.cpp
@@ -9,6 +9,8 @@
#include "apps.h"
+#if defined(BOTAN_HAS_NUMBERTHEORY)
+
#include <botan/reducer.h>
#include <botan/numthry.h>
@@ -154,3 +156,5 @@ int factor(int argc, char* argv[])
REGISTER_APP(factor);
}
+
+#endif // BOTAN_HAS_NUMBERTHEORY
diff --git a/src/cmd/fpe.cpp b/src/cmd/fpe.cpp
index 579586eaf..a9da9dcb7 100644
--- a/src/cmd/fpe.cpp
+++ b/src/cmd/fpe.cpp
@@ -6,7 +6,7 @@
#include "apps.h"
-#if defined(BOTAN_HAS_FPE_FE1)
+#if defined(BOTAN_HAS_FPE_FE1) && defined(BOTAN_HAS_SHA1)
#include <botan/fpe_fe1.h>
#include <botan/sha160.h>
@@ -151,5 +151,4 @@ REGISTER_APP(fpe);
}
-#endif
-
+#endif // BOTAN_HAS_FPE_FE1 && BOTAN_HAS_SHA1
diff --git a/src/cmd/hash.cpp b/src/cmd/hash.cpp
index dd5bc1e82..fdeaa465d 100644
--- a/src/cmd/hash.cpp
+++ b/src/cmd/hash.cpp
@@ -5,6 +5,9 @@
*/
#include "apps.h"
+
+#if defined(BOTAN_HAS_CODEC_FILTERS)
+
#include <botan/lookup.h>
#include <botan/filters.h>
#include <iostream>
@@ -57,3 +60,5 @@ int hash(int argc, char* argv[])
REGISTER_APP(hash);
}
+
+#endif // BOTAN_HAS_CODEC_FILTERS
diff --git a/src/cmd/is_prime.cpp b/src/cmd/is_prime.cpp
index c3bf8970e..703772477 100644
--- a/src/cmd/is_prime.cpp
+++ b/src/cmd/is_prime.cpp
@@ -5,6 +5,9 @@
*/
#include "apps.h"
+
+#if defined(BOTAN_HAS_NUMBERTHEORY)
+
#include <botan/numthry.h>
namespace {
@@ -43,3 +46,5 @@ int is_prime(int argc, char* argv[])
REGISTER_APP(is_prime);
}
+
+#endif // BOTAN_HAS_NUMBERTHEORY
diff --git a/src/cmd/keygen.cpp b/src/cmd/keygen.cpp
index 75ba3ed42..ead7dd39d 100644
--- a/src/cmd/keygen.cpp
+++ b/src/cmd/keygen.cpp
@@ -5,11 +5,16 @@
*/
#include "apps.h"
+
+#if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) && defined(BOTAN_HAS_X509_CERTIFICATES)
+
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <memory>
+#include <botan/pk_keys.h>
+#include <botan/pkcs8.h>
#if defined(BOTAN_HAS_RSA)
#include <botan/rsa.h>
@@ -120,3 +125,5 @@ int keygen(int argc, char* argv[])
REGISTER_APP(keygen);
}
+
+#endif // BOTAN_HAS_PUBLIC_KEY_CRYPTO && BOTAN_HAS_X509_CERTIFICATES
diff --git a/src/cmd/pkcs10.cpp b/src/cmd/pkcs10.cpp
index ff5fa7bf9..847f898d5 100644
--- a/src/cmd/pkcs10.cpp
+++ b/src/cmd/pkcs10.cpp
@@ -6,15 +6,15 @@
#include "apps.h"
-#if defined(BOTAN_HAS_X509_CERTIFICATES)
+#if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_HAS_RSA)
+
#include <botan/x509self.h>
#include <botan/rsa.h>
-#include <botan/dsa.h>
-using namespace Botan;
-
#include <fstream>
#include <memory>
+using namespace Botan;
+
namespace {
int pkcs10(int argc, char* argv[])
@@ -60,4 +60,4 @@ REGISTER_APP(pkcs10);
}
-#endif
+#endif // BOTAN_HAS_X509_CERTIFICATES && BOTAN_HAS_RSA
diff --git a/src/cmd/self_sig.cpp b/src/cmd/self_sig.cpp
index 0a6c59d87..d6b783497 100644
--- a/src/cmd/self_sig.cpp
+++ b/src/cmd/self_sig.cpp
@@ -6,15 +6,15 @@
#include "apps.h"
-#if defined(BOTAN_HAS_X509_CERTIFICATES)
+#if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_HAS_RSA)
+
#include <botan/x509self.h>
#include <botan/rsa.h>
-#include <botan/dsa.h>
-using namespace Botan;
-
#include <fstream>
#include <memory>
+using namespace Botan;
+
namespace {
int self_sig(int argc, char* argv[])
@@ -45,7 +45,6 @@ int self_sig(int argc, char* argv[])
RSA_PrivateKey key(rng, 2048);
//DL_Group group(rng, DL_Group::DSA_Kosherizer, 2048, 256);
- //DSA_PrivateKey key(rng, group);
std::ofstream priv_key("private.pem");
priv_key << PKCS8::PEM_encode(key, rng, argv[1]);
@@ -82,4 +81,4 @@ REGISTER_APP(self_sig);
}
-#endif
+#endif // BOTAN_HAS_X509_CERTIFICATES && BOTAN_HAS_RSA
diff --git a/src/cmd/speed.cpp b/src/cmd/speed.cpp
index 5e12ff3bc..eea3a7c60 100644
--- a/src/cmd/speed.cpp
+++ b/src/cmd/speed.cpp
@@ -4,16 +4,20 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include "speed.h"
#include "apps.h"
+
+#if defined(BOTAN_HAS_RUNTIME_BENCHMARKING)
+
+#include "speed.h"
#include <iostream>
#include <iomanip>
#include <botan/benchmark.h>
-#include <botan/aead.h>
#include <botan/auto_rng.h>
+#include <botan/cipher_mode.h>
#include <botan/parsing.h>
#include <botan/symkey.h>
+#include <botan/transform.h>
#include <botan/hex.h>
#include <chrono>
@@ -188,7 +192,9 @@ void bench_algo(const std::string& algo,
return;
}
+#if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO)
bench_pk(rng, algo, seconds);
+#endif
}
int speed(int argc, char* argv[])
@@ -242,3 +248,4 @@ int speed(int argc, char* argv[])
REGISTER_APP(speed);
}
+#endif // BOTAN_HAS_RUNTIME_BENCHMARKING
diff --git a/src/cmd/speed_pk.cpp b/src/cmd/speed_pk.cpp
index 63395e624..dc0ee79da 100644
--- a/src/cmd/speed_pk.cpp
+++ b/src/cmd/speed_pk.cpp
@@ -4,21 +4,20 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
+#include "apps.h"
+
+#if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO)
+
#include "speed.h"
#include "timer.h"
-#include <botan/pkcs8.h>
-#include <botan/mem_ops.h>
-#include <botan/parsing.h>
-#include <botan/oids.h>
#include <map>
#include <sstream>
-
-#if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO)
- #include <botan/x509_key.h>
- #include <botan/pkcs8.h>
- #include <botan/pubkey.h>
-#endif
+#include <botan/mem_ops.h>
+#include <botan/parsing.h>
+#include <botan/pkcs8.h>
+#include <botan/pubkey.h>
+#include <botan/x509_key.h>
#if defined(BOTAN_HAS_RSA)
#include <botan/rsa.h>
@@ -876,3 +875,4 @@ void bench_pk(RandomNumberGenerator& rng,
benchmark_mce(rng, seconds, report);
#endif
}
+#endif // BOTAN_HAS_PUBLIC_KEY_CRYPTO
diff --git a/src/cmd/tls_client.cpp b/src/cmd/tls_client.cpp
index e052c6842..a5da299c6 100644
--- a/src/cmd/tls_client.cpp
+++ b/src/cmd/tls_client.cpp
@@ -6,7 +6,11 @@
#include "apps.h"
-#if defined(BOTAN_HAS_TLS) && !defined(BOTAN_TARGET_OS_IS_WINDOWS) && !defined(BOTAN_TARGET_OS_IS_MINGW)
+#if defined(BOTAN_HAS_TLS) \
+ && defined(BOTAN_HAS_DSA) \
+ && !defined(BOTAN_TARGET_OS_IS_WINDOWS) \
+ && !defined(BOTAN_TARGET_OS_IS_MINGW)
+
#include <botan/tls_client.h>
#include <botan/pkcs8.h>
#include <botan/hex.h>
@@ -289,4 +293,5 @@ int tls_client(int argc, char* argv[])
REGISTER_APP(tls_client);
}
+
#endif
diff --git a/src/cmd/tls_server.cpp b/src/cmd/tls_server.cpp
index b7fbfa2c8..605e979ee 100644
--- a/src/cmd/tls_server.cpp
+++ b/src/cmd/tls_server.cpp
@@ -7,7 +7,10 @@
#include "apps.h"
-#if defined(BOTAN_HAS_TLS) && !defined(BOTAN_TARGET_OS_IS_WINDOWS)
+#if defined(BOTAN_HAS_TLS) \
+ && defined(BOTAN_HAS_DSA) \
+ && !defined(BOTAN_TARGET_OS_IS_WINDOWS)
+
#include <botan/tls_server.h>
#include <botan/hex.h>