diff options
author | lloyd <[email protected]> | 2014-01-10 23:07:16 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-10 23:07:16 +0000 |
commit | ad6555f522ae16f6284e8dafa02f630b88bcf289 (patch) | |
tree | bd63c51dbeab75eb0f90c72589bc922141237056 /src | |
parent | 6894dca64c04936d07048c0e8cbf7e25858548c3 (diff) |
Split up docs into the reference manual, the website, and everything else.
Add `website` target to makefile.
Some progress towards fixing minimized builds.
TLS now hard requires ECDSA and GCM since otherwise a minimized build
has only insecure options.
Remove boost_thread dependency in command line tool
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/botan.doxy.in | 2 | ||||
-rw-r--r-- | src/build-data/makefile/commands.in | 14 | ||||
-rw-r--r-- | src/build-data/makefile/dso.in (renamed from src/build-data/makefile/shared.in) | 2 | ||||
-rw-r--r-- | src/build-data/makefile/gmake.in | 89 | ||||
-rw-r--r-- | src/build-data/makefile/header.in | 32 | ||||
-rw-r--r-- | src/build-data/makefile/nmake.in | 40 | ||||
-rw-r--r-- | src/cmd/apps.cpp | 27 | ||||
-rw-r--r-- | src/cmd/apps.h | 5 | ||||
-rw-r--r-- | src/cmd/bcrypt.cpp | 5 | ||||
-rw-r--r-- | src/cmd/dsa_sign.cpp | 9 | ||||
-rw-r--r-- | src/cmd/fpe.cpp | 5 | ||||
-rw-r--r-- | src/cmd/main.cpp | 82 | ||||
-rw-r--r-- | src/cmd/tls_server_asio.cpp | 11 | ||||
-rw-r--r-- | src/lib/cert/x509/info.txt | 1 | ||||
-rw-r--r-- | src/lib/engine/core_engine/core_modes.cpp | 5 | ||||
-rw-r--r-- | src/lib/pk_pad/get_pk_pad.cpp | 4 | ||||
-rw-r--r-- | src/lib/rng/info.txt | 2 | ||||
-rw-r--r-- | src/lib/tls/info.txt | 2 | ||||
-rw-r--r-- | src/tests/test_aead.cpp (renamed from src/tests/kat_aead.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_bigint.cpp (renamed from src/tests/kat_bigint.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_block.cpp (renamed from src/tests/kat_block.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_cryptobox.cpp (renamed from src/tests/kat_cryptobox.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_cvc.cpp (renamed from src/tests/kat_cvc.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_dh.cpp (renamed from src/tests/kat_dh.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_dlies.cpp (renamed from src/tests/kat_dlies.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_dsa.cpp (renamed from src/tests/kat_dsa.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_ecdsa.cpp (renamed from src/tests/kat_ecdsa.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_elg.cpp (renamed from src/tests/kat_elg.cpp) | 11 | ||||
-rw-r--r-- | src/tests/test_gost_3410.cpp (renamed from src/tests/kat_gost.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_hash.cpp (renamed from src/tests/kat_hash.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_hkdf.cpp (renamed from src/tests/kat_hkdf.cpp) | 8 | ||||
-rw-r--r-- | src/tests/test_kdf.cpp (renamed from src/tests/kat_kdf.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_keywrap.cpp (renamed from src/tests/kat_keywrap.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_mac.cpp (renamed from src/tests/kat_mac.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_modes.cpp (renamed from src/tests/kat_modes.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_nr.cpp (renamed from src/tests/kat_nr.cpp) | 12 | ||||
-rw-r--r-- | src/tests/test_ocb.cpp (renamed from src/tests/kat_ocb.cpp) | 12 | ||||
-rw-r--r-- | src/tests/test_passhash.cpp (renamed from src/tests/kat_passhash.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_pbkdf.cpp (renamed from src/tests/kat_pbkdf.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_pubkey.cpp (renamed from src/tests/pubkey.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_rng.cpp (renamed from src/tests/kat_rng.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_rsa.cpp (renamed from src/tests/kat_rsa.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_rw.cpp (renamed from src/tests/kat_rw.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_stream.cpp (renamed from src/tests/kat_stream.cpp) | 0 | ||||
-rw-r--r-- | src/tests/test_transform.cpp (renamed from src/tests/kat_transform.cpp) | 1 | ||||
-rw-r--r-- | src/tests/test_tss.cpp (renamed from src/tests/kat_tss.cpp) | 12 |
46 files changed, 236 insertions, 157 deletions
diff --git a/src/build-data/botan.doxy.in b/src/build-data/botan.doxy.in index 63eaa7e15..49d18fe7c 100644 --- a/src/build-data/botan.doxy.in +++ b/src/build-data/botan.doxy.in @@ -78,7 +78,7 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = lib +INPUT = src/lib INPUT_ENCODING = UTF-8 FILE_PATTERNS = RECURSIVE = YES diff --git a/src/build-data/makefile/commands.in b/src/build-data/makefile/commands.in new file mode 100644 index 000000000..33c6634c3 --- /dev/null +++ b/src/build-data/makefile/commands.in @@ -0,0 +1,14 @@ +# Program aliases +AR = %{ar_command} +COPY = cp +COPY_R = cp -r +CD = @cd +ECHO = @echo +INSTALL_CMD_EXEC = %{install_cmd_exec} +INSTALL_CMD_DATA = %{install_cmd_data} +LN = ln -fs +MKDIR = @mkdir +MKDIR_INSTALL = @umask 022; mkdir -p -m 755 +RANLIB = %{ranlib_command} +RM = @rm -f +RM_R = @rm -rf diff --git a/src/build-data/makefile/shared.in b/src/build-data/makefile/dso.in index f4116cce4..7e9829fff 100644 --- a/src/build-data/makefile/shared.in +++ b/src/build-data/makefile/dso.in @@ -3,7 +3,7 @@ SHARED_LIB = $(SONAME).%{version_patch} SYMLINK = $(LIBNAME)-$(BRANCH).%{so_suffix} $(SHARED_LIB): $(LIBOBJS) - %{so_link} $(LDFLAGS) $(LIBOBJS) $(LIB_LINKS_TO) -o $(SHARED_LIB) + $(LIB_LINK_CMD) $(LDFLAGS) $(LIBOBJS) $(LIB_LINKS_TO) -o $(SHARED_LIB) $(LN) $(SHARED_LIB) $(SONAME) $(LN) $(SHARED_LIB) $(SYMLINK) diff --git a/src/build-data/makefile/gmake.in b/src/build-data/makefile/gmake.in index 2bdf34e4a..60520cd5f 100644 --- a/src/build-data/makefile/gmake.in +++ b/src/build-data/makefile/gmake.in @@ -1,48 +1,6 @@ -# Compiler Options -CXX = %{cc} -LIB_OPT = %{lib_opt} -APP_OPT = %{app_opt} -LANG_FLAGS = %{lang_flags} -WARN_FLAGS = %{warn_flags} -SO_OBJ_FLAGS = %{shared_flags} -LIB_LINKS_TO = %{link_to} -APP_LINKS_TO = $(LIB_LINKS_TO) -lboost_thread -TEST_LINKS_TO = $(LIB_LINKS_TO) -lboost_filesystem - -LIB_FLAGS = $(SO_OBJ_FLAGS) $(LANG_FLAGS) $(LIB_OPT) $(WARN_FLAGS) -APP_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) -TEST_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) - -# Version Numbers -VERSION = %{version} -BRANCH = %{version_major}.%{version_minor} - -# Installation Settings -DESTDIR = %{prefix} - -BINDIR = $(DESTDIR)/bin -LIBDIR = $(DESTDIR)/%{libdir} -HEADERDIR = $(DESTDIR)/%{includedir}/botan-$(BRANCH)/botan -DOCDIR = $(DESTDIR)/%{docdir}/botan-$(VERSION) -PKGCONF_DIR = $(LIBDIR)/pkgconfig - -CONFIG_SCRIPT = %{botan_config} -PKGCONFIG = %{botan_pkgconfig} - -# Aliases for Common Programs -AR = %{ar_command} -COPY = cp -COPY_R = cp -r -CD = @cd -ECHO = @echo -INSTALL_CMD_EXEC = %{install_cmd_exec} -INSTALL_CMD_DATA = %{install_cmd_data} -LN = ln -fs -MKDIR = @mkdir -MKDIR_INSTALL = @umask 022; mkdir -p -m 755 -RANLIB = %{ranlib_command} -RM = @rm -f -RM_R = @rm -rf +%{header_in} + +%{commands_in} # Targets APP = %{app_prefix}botan @@ -57,13 +15,13 @@ LIBPATH = botan-$(BRANCH) all: $(APP) $(TEST) # File Lists -INCLUDE_DIR = %{botan_include_dir} +INCLUDE_DIR = %{botan_include_dir} LIBOBJS = %{lib_objs} -APPOBJS = %{app_objs} +APPOBJS = %{app_objs} -TESTOBJS = %{test_objs} +TESTOBJS = %{test_objs} # Build Commands %{lib_build_cmds} @@ -73,7 +31,7 @@ TESTOBJS = %{test_objs} %{test_build_cmds} # Link Commands -%{shared_makefile} +%{dso_in} $(APP): $(LIBRARIES) $(APPOBJS) $(CXX) $(LDFLAGS) $(APPOBJS) -L. -l$(LIBPATH) $(APP_LINKS_TO) -o $(APP) @@ -86,16 +44,19 @@ $(STATIC_LIB): $(LIBOBJS) $(AR) $(STATIC_LIB) $(LIBOBJS) $(RANLIB) $(STATIC_LIB) -%{python_makefile} +%{python_in} # Fake Targets -.PHONY = docs clean distclean install +.PHONY = clean distclean docs website install -docs: -%{build_doc_commands} +SPHINX_CONFIG = %{sphinx_config_dir} +SPHINX_OPTS = -b html + +WEBSITE_DIR=%{doc_output_dir}/website +WEBSITE_SRC_DIR=%{doc_output_dir}/website-src clean: - $(RM_R) %{build_dir}/lib/* %{build_dir}/tests/* + $(RM_R) %{build_dir}/obj $(RM) $(LIBRARIES) $(SYMLINK) $(SONAME) $(APP) $(TEST) distclean: clean @@ -103,6 +64,9 @@ distclean: clean $(RM) Makefile* $(CONFIG_SCRIPT) $(PKGCONFIG) $(RM) botan_all.cpp botan_all.h +docs: +%{build_doc_commands} + install: $(LIBRARIES) docs $(MKDIR_INSTALL) $(DOCDIR) $(COPY_R) %{doc_output_dir}/* $(DOCDIR) @@ -115,14 +79,27 @@ install: $(LIBRARIES) docs $(MKDIR_INSTALL) $(LIBDIR) $(INSTALL_CMD_DATA) $(STATIC_LIB) $(LIBDIR) - ifdef $(SHARED_LIB) +ifneq ($(SHARED_LIB),) $(INSTALL_CMD_EXEC) $(SHARED_LIB) $(LIBDIR) $(CD) $(LIBDIR); $(LN) $(SHARED_LIB) $(SYMLINK) $(CD) $(LIBDIR); $(LN) $(SHARED_LIB) $(SONAME) - endif +endif $(MKDIR_INSTALL) $(BINDIR) $(INSTALL_CMD_EXEC) $(CONFIG_SCRIPT) $(BINDIR) $(MKDIR_INSTALL) $(PKGCONF_DIR) $(INSTALL_CMD_DATA) $(PKGCONFIG) $(PKGCONF_DIR) + +website: + rm -rf $(WEBSITE_SRC_DIR) + mkdir -p $(WEBSITE_SRC_DIR) + cp -r %{doc_dir}/*.rst %{doc_dir}/relnotes %{doc_dir}/website/*.rst $(WEBSITE_SRC_DIR) + sphinx-build -q -c $(SPHINX_CONFIG) -b html $(WEBSITE_SRC_DIR) $(WEBSITE_DIR) + sphinx-build -q -c $(SPHINX_CONFIG) -b html %{doc_dir}/manual $(WEBSITE_DIR)/manual + rm -rf $(WEBSITE_DIR)/.doctrees + rm -rf $(WEBSITE_DIR)/manual/.doctrees + rm -f $(WEBSITE_DIR)/.buildinfo + rm -f $(WEBSITE_DIR)/manual/.buildinfo + doxygen %{build_dir}/botan.doxy + mv %{doc_output_dir}/doxygen $(WEBSITE_DIR)/doxygen diff --git a/src/build-data/makefile/header.in b/src/build-data/makefile/header.in new file mode 100644 index 000000000..dfd02aa35 --- /dev/null +++ b/src/build-data/makefile/header.in @@ -0,0 +1,32 @@ +# Compiler Options +CXX = %{cc} +LIB_OPT = %{lib_opt} +APP_OPT = %{app_opt} +LANG_FLAGS = %{lang_flags} +WARN_FLAGS = %{warn_flags} +SO_OBJ_FLAGS = %{shared_flags} + +LIB_LINK_CMD = %{so_link} + +LIB_LINKS_TO = %{link_to} +APP_LINKS_TO = $(LIB_LINKS_TO) +TEST_LINKS_TO = $(LIB_LINKS_TO) -lboost_filesystem + +LIB_FLAGS = $(SO_OBJ_FLAGS) $(LANG_FLAGS) $(LIB_OPT) $(WARN_FLAGS) +APP_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) +TEST_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) + +# Version Numbers +VERSION = %{version} +BRANCH = %{version_major}.%{version_minor} + +# Installation Settings +DESTDIR = %{prefix} +BINDIR = $(DESTDIR)/bin +LIBDIR = $(DESTDIR)/%{libdir} +HEADERIR = $(DESTDIR)/%{includedir}/botan-$(BRANCH)/botan +DOCDIR = $(DESTDIR)/%{docdir}/botan-$(VERSION) +PKGCONF_DIR = $(LIBDIR)/pkgconfig + +CONFIG_SCRIPT = %{botan_config} +PKGCONFIG = %{botan_pkgconfig} diff --git a/src/build-data/makefile/nmake.in b/src/build-data/makefile/nmake.in index 1ebba3c9f..9a248117b 100644 --- a/src/build-data/makefile/nmake.in +++ b/src/build-data/makefile/nmake.in @@ -1,23 +1,4 @@ -### Compiler Options -CXX = %{cc} -LIB_OPT = %{lib_opt} -APP_OPT = %{app_opt} -LANG_FLAGS = %{lang_flags} -WARN_FLAGS = %{warn_flags} -SO_OBJ_FLAGS = %{shared_flags} -LIB_LINK_CMD = %{so_link} -APP_LINKS_TO = $(LIB_LINKS_TO) -lboost_thread -TEST_LINKS_TO = $(LIB_LINKS_TO) -lboost_filesystem - -LIB_FLAGS = $(LIB_OPT) $(LANG_FLAGS) $(WARN_FLAGS) $(SO_OBJ_FLAGS) -APP_FLAGS = $(APP_OPT) $(LANG_FLAGS) $(WARN_FLAGS) -TEST_FLAGS = $(APP_OPT) $(LANG_FLAGS) $(WARN_FLAGS) - -### Version Numbers -VERSION = %{version} - -### Installation Settings -DESTDIR = %{prefix} +%{header_in} ### Aliases for Common Programs AR = %{ar_command} @@ -33,8 +14,8 @@ RM_R = $(RM) /S RMDIR = @rmdir ### File Lists -APP = botan -TEST = botan-test +APP = %{app_prefix}botan +TEST = %{app_prefix}botan-test LIBOBJS = %{lib_objs} @@ -51,14 +32,14 @@ BOTAN_LIB = $(LIBNAME).%{static_suffix} all: $(APP) $(TEST) -### Build Commands +# Build Commands %{lib_build_cmds} %{app_build_cmds} %{test_build_cmds} -### Link Commands +# Link Commands $(APP): $(LIBRARIES) $(APPOBJS) $(CXX) /Fe$@ $(APPOBJS) $(BOTAN_LIB) $(LINK_TO) @@ -72,7 +53,13 @@ $(BOTAN_LIB): $(LIBOBJS) $(LIB_LINK_CMD) /Fe$(LIBNAME) $(LIBOBJS) $(LINK_TO) !Endif -### Fake Targets +%{python_in} + +# Fake Targets + +SPHINX_CONFIG = %{sphinx_config_dir} +SPHINX_OPTS = -b html + docs: %{build_doc_commands} @@ -90,8 +77,7 @@ distclean: clean $(RMDIR) %{build_dir} $(RM) Makefile $(LIBNAME).* $(APP).* -### Install Commands -install: $(LIBRARIES) +install: $(LIBRARIES) docs -$(MKDIR) $(DESTDIR)\include\botan $(INSTALL_CMD) botan.* $(DESTDIR) $(INSTALL_CMD) build\include\botan\*.h $(DESTDIR)\include\botan diff --git a/src/cmd/apps.cpp b/src/cmd/apps.cpp deleted file mode 100644 index 120457cb1..000000000 --- a/src/cmd/apps.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "apps.h" - -int apps_main(const std::string& cmd, int argc, char* argv[]) - { -#define CALL_APP(cmdsym) \ - do { if(cmd == #cmdsym) { return cmdsym ##_main (argc - 1, argv + 1); } } while(0) - - CALL_APP(asn1); - CALL_APP(base64); - CALL_APP(bcrypt); - CALL_APP(bzip); - CALL_APP(ca); - CALL_APP(factor); - CALL_APP(fpe); - CALL_APP(hash); - CALL_APP(keygen); - CALL_APP(dsa_sign); - CALL_APP(dsa_verify); - CALL_APP(pkcs10); - CALL_APP(read_ssh); - CALL_APP(self_sig); - CALL_APP(tls_client); - CALL_APP(tls_server); - CALL_APP(x509); - - return -1; - } diff --git a/src/cmd/apps.h b/src/cmd/apps.h index 39665a720..280ee46a0 100644 --- a/src/cmd/apps.h +++ b/src/cmd/apps.h @@ -7,7 +7,10 @@ using namespace Botan; -int apps_main(const std::string& cmd, int argc, char* argv[]); +int unimplemented(int argc, char* argv[], const char* what); + +#define UNIMPLEMENTED(main, prob) \ + int main(int argc, char* argv[]) { return unimplemented(argc, argv, prob); } #define DEFINE_APP(cmd) int cmd ## _main(int argc, char* argv[]); diff --git a/src/cmd/bcrypt.cpp b/src/cmd/bcrypt.cpp index 2b0bfa132..2b4b4e61d 100644 --- a/src/cmd/bcrypt.cpp +++ b/src/cmd/bcrypt.cpp @@ -1,4 +1,6 @@ #include "apps.h" + +#if defined(BOTAN_HAS_BCRYPT) #include <botan/bcrypt.h> int bcrypt_main(int argc, char* argv[]) @@ -30,3 +32,6 @@ int bcrypt_main(int argc, char* argv[]) << " " << argv[0] << " password passhash\n"; return 1; } +#else +UNIMPLEMENTED(bcrypt_main, "bcrypt"); +#endif diff --git a/src/cmd/dsa_sign.cpp b/src/cmd/dsa_sign.cpp index 308e68814..365e91a37 100644 --- a/src/cmd/dsa_sign.cpp +++ b/src/cmd/dsa_sign.cpp @@ -5,9 +5,13 @@ #include <string> #include <memory> +#include <botan/base64.h> #include <botan/pubkey.h> + +#if defined(BOTAN_HAS_DSA) + #include <botan/dsa.h> -#include <botan/base64.h> + using namespace Botan; const std::string SUFFIX = ".sig"; @@ -69,3 +73,6 @@ int dsa_sign_main(int argc, char* argv[]) } return 0; } +#else +UNIMPLEMENTED(dsa_sign_main, "DSA"); +#endif diff --git a/src/cmd/fpe.cpp b/src/cmd/fpe.cpp index e40db8a32..d1e748b4c 100644 --- a/src/cmd/fpe.cpp +++ b/src/cmd/fpe.cpp @@ -1,4 +1,6 @@ #include "apps.h" + +#if defined(BOTAN_HAS_FPE_FE1) #include <botan/fpe_fe1.h> #include <botan/sha160.h> @@ -141,3 +143,6 @@ int fpe_main(int argc, char* argv[]) return 0; } +#else +UNIMPLEMENTED(fpe_main, "FPE"); +#endif diff --git a/src/cmd/main.cpp b/src/cmd/main.cpp index 2d675d546..5f6a0042f 100644 --- a/src/cmd/main.cpp +++ b/src/cmd/main.cpp @@ -37,24 +37,21 @@ int help(int , char* argv[]) return 1; } +int config_main(int argc, char* argv[]) + { + return 1; + } + } -int main(int argc, char* argv[]) +int unimplemented(int , char* argv[], const char* what) { - if(BOTAN_VERSION_MAJOR != version_major() || - BOTAN_VERSION_MINOR != version_minor() || - BOTAN_VERSION_PATCH != version_patch()) - { - std::cout << "Warning: linked version (" - << version_major() << '.' - << version_minor() << '.' - << version_patch() - << ") does not match version built against (" - << BOTAN_VERSION_MAJOR << '.' - << BOTAN_VERSION_MINOR << '.' - << BOTAN_VERSION_PATCH << ")\n"; - } + std::cout << argv[0] << " command not implemented - library missing " << what << "\n"; + return 1; + } +int main(int argc, char* argv[]) + { try { Botan::LibraryInitializer init; @@ -67,9 +64,29 @@ int main(int argc, char* argv[]) if(cmd == "help") return help(argc, argv); + if(cmd == "config") + { + return config_main(argc - 1, argv + 1); + } + if(cmd == "version") { std::cout << Botan::version_string() << "\n"; + + if(BOTAN_VERSION_MAJOR != version_major() || + BOTAN_VERSION_MINOR != version_minor() || + BOTAN_VERSION_PATCH != version_patch()) + { + std::cout << "Warning: linked version (" + << version_major() << '.' + << version_minor() << '.' + << version_patch() + << ") does not match version built against (" + << BOTAN_VERSION_MAJOR << '.' + << BOTAN_VERSION_MINOR << '.' + << BOTAN_VERSION_PATCH << ")\n"; + } + return 0; } @@ -79,24 +96,37 @@ int main(int argc, char* argv[]) return 0; } - if(cmd == "speed") - return speed_main(argc - 1, argv + 1); - if(cmd == "http_get") { auto resp = HTTP::GET_sync(argv[2]); std::cout << resp << "\n"; } - int e = apps_main(cmd, argc - 1, argv + 1); - - if(e == -1) - { - std::cout << "Unknown command " << cmd << "\n"; - return help(argc, argv); - } - - return e; +#define CALL_APP(cmdsym) \ + do { if(cmd == #cmdsym) { return cmdsym ##_main (argc - 1, argv + 1); } } while(0) + + CALL_APP(asn1); + CALL_APP(base64); + CALL_APP(bcrypt); + CALL_APP(bzip); + CALL_APP(ca); + CALL_APP(factor); + CALL_APP(fpe); + CALL_APP(hash); + CALL_APP(keygen); + CALL_APP(dsa_sign); + CALL_APP(dsa_verify); + CALL_APP(pkcs10); + CALL_APP(read_ssh); + CALL_APP(self_sig); + CALL_APP(tls_client); + CALL_APP(tls_server); + CALL_APP(tls_server_asio); + CALL_APP(x509); + CALL_APP(speed); + + std::cout << "Unknown command " << cmd << "\n"; + return help(argc, argv); } catch(std::exception& e) { diff --git a/src/cmd/tls_server_asio.cpp b/src/cmd/tls_server_asio.cpp index b49206136..524181510 100644 --- a/src/cmd/tls_server_asio.cpp +++ b/src/cmd/tls_server_asio.cpp @@ -2,10 +2,11 @@ #include <iostream> #include <string> #include <vector> +#include <thread> #define _GLIBCXX_HAVE_GTHR_DEFAULT #include <boost/asio.hpp> #include <boost/bind.hpp> -#include <boost/thread.hpp> +//#include <boost/thread.hpp> #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> @@ -265,7 +266,7 @@ class asio_tls_server size_t choose_thread_count() { - size_t result = boost::thread::hardware_concurrency(); + size_t result = std::thread::hardware_concurrency(); if(result) return result; @@ -291,12 +292,12 @@ int tls_server_asio_main(int argc, char* argv[]) std::cout << "Using " << num_threads << " threads\n"; - std::vector<boost::shared_ptr<boost::thread> > threads; + std::vector<boost::shared_ptr<std::thread> > threads; for(size_t i = 0; i != num_threads; ++i) { - boost::shared_ptr<boost::thread> thread( - new boost::thread( + boost::shared_ptr<std::thread> thread( + new std::thread( boost::bind(&boost::asio::io_service::run, &io_service))); threads.push_back(thread); } diff --git a/src/lib/cert/x509/info.txt b/src/lib/cert/x509/info.txt index 83512857f..a74fd6631 100644 --- a/src/lib/cert/x509/info.txt +++ b/src/lib/cert/x509/info.txt @@ -3,6 +3,7 @@ define OCSP 20131128 <requires> datastor +http_util </requires> <libs> diff --git a/src/lib/engine/core_engine/core_modes.cpp b/src/lib/engine/core_engine/core_modes.cpp index 6524d9c16..fa8c9babf 100644 --- a/src/lib/engine/core_engine/core_modes.cpp +++ b/src/lib/engine/core_engine/core_modes.cpp @@ -10,6 +10,7 @@ #include <botan/filters.h> #include <botan/algo_factory.h> #include <botan/mode_pad.h> +#include <botan/transform_filter.h> #include <memory> #if defined(BOTAN_HAS_MODE_CFB) @@ -170,11 +171,11 @@ Keyed_Filter* get_cipher_mode(const BlockCipher* block_cipher, } #endif -#if defined(BOTAN_HAS_AEAD_FILTER) - if(bits % 8 != 0) throw std::invalid_argument("AEAD interface does not support non-octet length tags"); +#if defined(BOTAN_HAS_AEAD_FILTER) + const size_t tag_size = bits / 8; #if defined(BOTAN_HAS_AEAD_CCM) diff --git a/src/lib/pk_pad/get_pk_pad.cpp b/src/lib/pk_pad/get_pk_pad.cpp index 8c27b1fa1..2809f1714 100644 --- a/src/lib/pk_pad/get_pk_pad.cpp +++ b/src/lib/pk_pad/get_pk_pad.cpp @@ -112,8 +112,6 @@ EME* get_eme(const std::string& algo_spec) { SCAN_Name request(algo_spec); - Algorithm_Factory& af = global_state().algorithm_factory(); - if(request.algo_name() == "Raw") return nullptr; // No padding @@ -123,6 +121,8 @@ EME* get_eme(const std::string& algo_spec) #endif #if defined(BOTAN_HAS_EME1) + Algorithm_Factory& af = global_state().algorithm_factory(); + if(request.algo_name() == "EME1" && request.arg_count_between(1, 2)) { if(request.arg_count() == 1 || diff --git a/src/lib/rng/info.txt b/src/lib/rng/info.txt index 4c88ba382..ba7aa8e6a 100644 --- a/src/lib/rng/info.txt +++ b/src/lib/rng/info.txt @@ -1,3 +1,5 @@ <requires> entropy +auto_rng +hmac_rng </requires> diff --git a/src/lib/tls/info.txt b/src/lib/tls/info.txt index adae12cb2..5a5601df5 100644 --- a/src/lib/tls/info.txt +++ b/src/lib/tls/info.txt @@ -73,8 +73,10 @@ credentials cryptobox_psk dh ecdh +ecdsa eme_pkcs emsa3 +gcm hmac kdf2 md5 diff --git a/src/tests/kat_aead.cpp b/src/tests/test_aead.cpp index 8b46e9177..8b46e9177 100644 --- a/src/tests/kat_aead.cpp +++ b/src/tests/test_aead.cpp diff --git a/src/tests/kat_bigint.cpp b/src/tests/test_bigint.cpp index b71e0af2d..b71e0af2d 100644 --- a/src/tests/kat_bigint.cpp +++ b/src/tests/test_bigint.cpp diff --git a/src/tests/kat_block.cpp b/src/tests/test_block.cpp index 2ef5f8979..2ef5f8979 100644 --- a/src/tests/kat_block.cpp +++ b/src/tests/test_block.cpp diff --git a/src/tests/kat_cryptobox.cpp b/src/tests/test_cryptobox.cpp index 9a53da74c..9a53da74c 100644 --- a/src/tests/kat_cryptobox.cpp +++ b/src/tests/test_cryptobox.cpp diff --git a/src/tests/kat_cvc.cpp b/src/tests/test_cvc.cpp index 9519f0926..9519f0926 100644 --- a/src/tests/kat_cvc.cpp +++ b/src/tests/test_cvc.cpp diff --git a/src/tests/kat_dh.cpp b/src/tests/test_dh.cpp index 890bae632..890bae632 100644 --- a/src/tests/kat_dh.cpp +++ b/src/tests/test_dh.cpp diff --git a/src/tests/kat_dlies.cpp b/src/tests/test_dlies.cpp index 05fdb863f..05fdb863f 100644 --- a/src/tests/kat_dlies.cpp +++ b/src/tests/test_dlies.cpp diff --git a/src/tests/kat_dsa.cpp b/src/tests/test_dsa.cpp index 19c557823..19c557823 100644 --- a/src/tests/kat_dsa.cpp +++ b/src/tests/test_dsa.cpp diff --git a/src/tests/kat_ecdsa.cpp b/src/tests/test_ecdsa.cpp index 32747c7b0..32747c7b0 100644 --- a/src/tests/kat_ecdsa.cpp +++ b/src/tests/test_ecdsa.cpp diff --git a/src/tests/kat_elg.cpp b/src/tests/test_elg.cpp index d94d2813e..332e5ae0e 100644 --- a/src/tests/kat_elg.cpp +++ b/src/tests/test_elg.cpp @@ -3,11 +3,15 @@ #include <botan/auto_rng.h> #include <botan/pubkey.h> -#include <botan/elgamal.h> +#include <botan/dl_group.h> #include <botan/hex.h> #include <iostream> #include <fstream> +#if defined(BOTAN_HAS_ELGAMAL) + #include <botan/elgamal.h> +#endif + using namespace Botan; namespace { @@ -27,6 +31,7 @@ size_t elgamal_kat(const std::string& p, const BigInt x_bn = BigInt(x); DL_Group group(p_bn, g_bn); +#if defined(BOTAN_HAS_ELGAMAL) ElGamal_PrivateKey privkey(rng, group, x_bn); ElGamal_PublicKey pubkey = privkey; @@ -38,6 +43,9 @@ size_t elgamal_kat(const std::string& p, PK_Decryptor_EME dec(privkey, padding); return validate_encryption(enc, dec, "ElGamal/" + padding, msg, nonce, ciphertext); +#else + return 1; +#endif } } @@ -57,4 +65,3 @@ size_t test_elgamal() return fails; } - diff --git a/src/tests/kat_gost.cpp b/src/tests/test_gost_3410.cpp index 4cd43a027..4cd43a027 100644 --- a/src/tests/kat_gost.cpp +++ b/src/tests/test_gost_3410.cpp diff --git a/src/tests/kat_hash.cpp b/src/tests/test_hash.cpp index eaa3ff3b5..eaa3ff3b5 100644 --- a/src/tests/kat_hash.cpp +++ b/src/tests/test_hash.cpp diff --git a/src/tests/kat_hkdf.cpp b/src/tests/test_hkdf.cpp index 25ad4567f..842123968 100644 --- a/src/tests/kat_hkdf.cpp +++ b/src/tests/test_hkdf.cpp @@ -1,7 +1,9 @@ #include "tests.h" #include <botan/libstate.h> -#include <botan/hkdf.h> +#if defined(BOTAN_HAS_HKDF) + #include <botan/hkdf.h> +#endif #include <botan/hex.h> #include <iostream> #include <fstream> @@ -25,6 +27,7 @@ secure_vector<byte> hkdf(const std::string& hkdf_algo, if(!mac_proto) throw std::invalid_argument("Bad HKDF hash '" + algo + "'"); +#if defined(BOTAN_HAS_HKDF) HKDF hkdf(mac_proto->clone(), mac_proto->clone()); hkdf.start_extract(&salt[0], salt.size()); @@ -34,6 +37,9 @@ secure_vector<byte> hkdf(const std::string& hkdf_algo, secure_vector<byte> key(L); hkdf.expand(&key[0], key.size(), &info[0], info.size()); return key; +#else + return ""; +#endif } size_t hkdf_test(const std::string& algo, diff --git a/src/tests/kat_kdf.cpp b/src/tests/test_kdf.cpp index 0fc627673..0fc627673 100644 --- a/src/tests/kat_kdf.cpp +++ b/src/tests/test_kdf.cpp diff --git a/src/tests/kat_keywrap.cpp b/src/tests/test_keywrap.cpp index a7dcbfe75..a7dcbfe75 100644 --- a/src/tests/kat_keywrap.cpp +++ b/src/tests/test_keywrap.cpp diff --git a/src/tests/kat_mac.cpp b/src/tests/test_mac.cpp index 2b07497aa..2b07497aa 100644 --- a/src/tests/kat_mac.cpp +++ b/src/tests/test_mac.cpp diff --git a/src/tests/kat_modes.cpp b/src/tests/test_modes.cpp index 1c3dad934..1c3dad934 100644 --- a/src/tests/kat_modes.cpp +++ b/src/tests/test_modes.cpp diff --git a/src/tests/kat_nr.cpp b/src/tests/test_nr.cpp index 7946ed324..982e38bc2 100644 --- a/src/tests/kat_nr.cpp +++ b/src/tests/test_nr.cpp @@ -3,7 +3,12 @@ #include <botan/auto_rng.h> #include <botan/pubkey.h> -#include <botan/nr.h> +#include <botan/dl_group.h> + +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) + #include <botan/nr.h> +#endif + #include <botan/hex.h> #include <iostream> #include <fstream> @@ -26,6 +31,8 @@ size_t nr_sig_kat(const std::string& p, BigInt p_bn(p), q_bn(q), g_bn(g), x_bn(x); DL_Group group(p_bn, q_bn, g_bn); + +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) NR_PrivateKey privkey(rng, group, x_bn); NR_PublicKey pubkey = privkey; @@ -36,6 +43,9 @@ size_t nr_sig_kat(const std::string& p, PK_Signer sign(privkey, padding); return validate_signature(verify, sign, "nr/" + hash, msg, rng, nonce, signature); +#else + return 1; +#endif } } diff --git a/src/tests/kat_ocb.cpp b/src/tests/test_ocb.cpp index b2bd296e0..b76e26189 100644 --- a/src/tests/kat_ocb.cpp +++ b/src/tests/test_ocb.cpp @@ -1,12 +1,12 @@ #include "tests.h" +#include <iostream> +#if defined(BOTAN_HAS_OCB) #include <botan/ocb.h> #include <botan/hex.h> #include <botan/sha2_32.h> #include <botan/aes.h> -#include <iostream> -//#include <botan/selftest.h> using namespace Botan; @@ -139,4 +139,12 @@ size_t test_ocb() return fails; } +#else + +size_t test_ocb() + { + std::cout << "OCB disabled in build\n"; + return 0; + } +#endif diff --git a/src/tests/kat_passhash.cpp b/src/tests/test_passhash.cpp index 6f66743c5..6f66743c5 100644 --- a/src/tests/kat_passhash.cpp +++ b/src/tests/test_passhash.cpp diff --git a/src/tests/kat_pbkdf.cpp b/src/tests/test_pbkdf.cpp index 5d97bf0e9..5d97bf0e9 100644 --- a/src/tests/kat_pbkdf.cpp +++ b/src/tests/test_pbkdf.cpp diff --git a/src/tests/pubkey.cpp b/src/tests/test_pubkey.cpp index 85e2924be..85e2924be 100644 --- a/src/tests/pubkey.cpp +++ b/src/tests/test_pubkey.cpp diff --git a/src/tests/kat_rng.cpp b/src/tests/test_rng.cpp index 88e21f62c..88e21f62c 100644 --- a/src/tests/kat_rng.cpp +++ b/src/tests/test_rng.cpp diff --git a/src/tests/kat_rsa.cpp b/src/tests/test_rsa.cpp index 28320ddb0..28320ddb0 100644 --- a/src/tests/kat_rsa.cpp +++ b/src/tests/test_rsa.cpp diff --git a/src/tests/kat_rw.cpp b/src/tests/test_rw.cpp index 4d3bc2d5b..4d3bc2d5b 100644 --- a/src/tests/kat_rw.cpp +++ b/src/tests/test_rw.cpp diff --git a/src/tests/kat_stream.cpp b/src/tests/test_stream.cpp index 707f5d62d..707f5d62d 100644 --- a/src/tests/kat_stream.cpp +++ b/src/tests/test_stream.cpp diff --git a/src/tests/kat_transform.cpp b/src/tests/test_transform.cpp index e53b5b800..5d3c4dc3f 100644 --- a/src/tests/kat_transform.cpp +++ b/src/tests/test_transform.cpp @@ -2,7 +2,6 @@ #include <botan/botan.h> #include <botan/transform.h> -#include <botan/threefish.h> #include <botan/benchmark.h> #include <botan/hex.h> #include <iostream> diff --git a/src/tests/kat_tss.cpp b/src/tests/test_tss.cpp index f9caddb6f..38d9dfbfa 100644 --- a/src/tests/kat_tss.cpp +++ b/src/tests/test_tss.cpp @@ -7,10 +7,13 @@ #include "tests.h" #include <botan/auto_rng.h> #include <botan/hex.h> -#include <botan/tss.h> #include <iostream> #include <stdio.h> +#if defined(BOTAN_HAS_THRESHOLD_SECRET_SHARING) + +#include <botan/tss.h> + namespace { void print(const Botan::secure_vector<Botan::byte>& r) @@ -59,3 +62,10 @@ size_t test_tss() return fails; } +#else +size_t test_tss() + { + std::cout << "Skipping TSS tests\n"; + return 1; + } +#endif |