aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cli/pk_crypt.cpp1
-rw-r--r--src/lib/block/serpent/serpent.cpp2
-rw-r--r--src/lib/pbkdf/pwdhash.cpp2
-rw-r--r--src/lib/pk_pad/emsa.cpp7
-rw-r--r--src/lib/pubkey/pkcs8.cpp11
-rw-r--r--src/lib/stream/chacha/chacha_avx2/info.txt4
-rwxr-xr-xsrc/scripts/test_all_configs.py27
-rw-r--r--src/tests/test_c25519.cpp2
-rw-r--r--src/tests/test_ecies.cpp2
-rw-r--r--src/tests/test_ffi.cpp8
-rw-r--r--src/tests/test_kdf.cpp9
-rw-r--r--src/tests/test_pk_pad.cpp15
-rw-r--r--src/tests/test_siv.cpp11
-rw-r--r--src/tests/unit_tls.cpp6
14 files changed, 84 insertions, 23 deletions
diff --git a/src/cli/pk_crypt.cpp b/src/cli/pk_crypt.cpp
index 62c1d519e..9b7f50746 100644
--- a/src/cli/pk_crypt.cpp
+++ b/src/cli/pk_crypt.cpp
@@ -16,6 +16,7 @@
#include <botan/oids.h>
#include <botan/aead.h>
#include <botan/pem.h>
+#include <botan/rng.h>
namespace Botan_CLI {
diff --git a/src/lib/block/serpent/serpent.cpp b/src/lib/block/serpent/serpent.cpp
index 35231cab5..98e701738 100644
--- a/src/lib/block/serpent/serpent.cpp
+++ b/src/lib/block/serpent/serpent.cpp
@@ -10,7 +10,7 @@
#include <botan/rotate.h>
#include <botan/internal/serpent_sbox.h>
-#if defined(BOTAN_HAS_SERPENT_SIMD)
+#if defined(BOTAN_HAS_SERPENT_SIMD) || defined(BOTAN_HAS_SERPENT_AVX2)
#include <botan/cpuid.h>
#endif
diff --git a/src/lib/pbkdf/pwdhash.cpp b/src/lib/pbkdf/pwdhash.cpp
index 783ac7066..610ae7ac7 100644
--- a/src/lib/pbkdf/pwdhash.cpp
+++ b/src/lib/pbkdf/pwdhash.cpp
@@ -4,7 +4,7 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/pbkdf.h>
+#include <botan/pwdhash.h>
#include <botan/exceptn.h>
#include <botan/scan_name.h>
diff --git a/src/lib/pk_pad/emsa.cpp b/src/lib/pk_pad/emsa.cpp
index 4b02776c2..a3e448686 100644
--- a/src/lib/pk_pad/emsa.cpp
+++ b/src/lib/pk_pad/emsa.cpp
@@ -196,7 +196,12 @@ std::string hash_for_emsa(const std::string& algo_spec)
return pos_hash;
}
- return "SHA-512"; // safe default if nothing we understand
+ // If we don't understand what this is return a safe default
+#if defined(BOTAN_HAS_SHA2_64)
+ return "SHA-512";
+#else
+ return "SHA-256";
+#endif
}
}
diff --git a/src/lib/pubkey/pkcs8.cpp b/src/lib/pubkey/pkcs8.cpp
index d299a98a4..b6d33cfcb 100644
--- a/src/lib/pubkey/pkcs8.cpp
+++ b/src/lib/pubkey/pkcs8.cpp
@@ -160,10 +160,15 @@ choose_pbe_params(const std::string& pbe_algo, const std::string& key_algo)
if(pbe_algo.empty())
{
// Defaults:
- if(key_algo == "Curve25519" || key_algo == "McEliece")
+ const bool nonstandard_pk = (key_algo == "McEliece" || key_algo == "XMSS");
+
+#if defined(BOTAN_HAS_GCM) && defined(BOTAN_HAS_SHA2_64)
+ if(nonstandard_pk)
return std::make_pair("AES-256/GCM", "SHA-512");
- else // for everything else (RSA, DSA, ECDSA, GOST, ...)
- return std::make_pair("AES-256/CBC", "SHA-256");
+#endif
+
+ // Default is something compatible with everyone else
+ return std::make_pair("AES-256/CBC", "SHA-256");
}
SCAN_Name request(pbe_algo);
diff --git a/src/lib/stream/chacha/chacha_avx2/info.txt b/src/lib/stream/chacha/chacha_avx2/info.txt
index 3ec1e39d5..cb34095b1 100644
--- a/src/lib/stream/chacha/chacha_avx2/info.txt
+++ b/src/lib/stream/chacha/chacha_avx2/info.txt
@@ -3,3 +3,7 @@ CHACHA_AVX2 -> 20180418
</defines>
need_isa avx2
+
+<requires>
+simd_avx2
+</requires>
diff --git a/src/scripts/test_all_configs.py b/src/scripts/test_all_configs.py
index f90d7722e..efa07430a 100755
--- a/src/scripts/test_all_configs.py
+++ b/src/scripts/test_all_configs.py
@@ -49,15 +49,18 @@ def try_to_run(cmdline):
if failed:
print("FAILURE")
+ print(stdout)
print(stdout.decode('ascii'))
print(stderr.decode('ascii'))
sys.stdout.flush()
+ #sys.exit(1)
return not failed
-def run_test_build(configure_py, modules, include, run_tests=False):
- config = [configure_py]
+def run_test_build(configure_py, modules, include, jobs, run_tests):
+ config = [configure_py, '--without-documentation']
+ print(modules)
if include:
config.append('--minimized')
if modules:
@@ -68,13 +71,13 @@ def run_test_build(configure_py, modules, include, run_tests=False):
if try_to_run(config) is False:
return False
- if try_to_run(['make', '-j', str(get_concurrency())]) is False:
+ if try_to_run(['make', '-j', str(jobs)]) is False:
return False
if run_tests is False:
return True
- return try_to_run(['./botan-test'])
+ return try_to_run(['./botan-test', '--test-threads=%d' % (jobs)])
def main(args):
@@ -83,6 +86,10 @@ def main(args):
parser = optparse.OptionParser()
parser.add_option('--run-tests', default=False, action='store_true')
+ parser.add_option('--jobs', default=get_concurrency(),
+ help="jobs to run (default %default)")
+
+ jobs = get_concurrency()
(options, args) = parser.parse_args(args)
@@ -92,7 +99,7 @@ def main(args):
modules = get_module_list(configure_py)
cant_disable = ['block', 'hash', 'hex', 'mac', 'modes', 'rng', 'stream', 'utils', 'cpuid', 'entropy']
- always_include = ['sha2_32', 'sha2_64', 'aes']
+ always_include = ['thread_utils', 'sha2_64']#, 'sha2_64', 'aes']
failed = []
@@ -103,17 +110,19 @@ def main(args):
extra = []
if module == 'auto_rng':
extra.append('dev_random')
- if run_test_build(configure_py, [module] + always_include + extra, True, run_tests) is False:
+ if run_test_build(configure_py, [module] + always_include + extra, True, jobs, run_tests) is False:
failed.append(module)
for module in sorted(modules):
if module in cant_disable or module in always_include:
continue
- if run_test_build(configure_py, [module], False, run_tests) is False:
+ if run_test_build(configure_py, [module], False, jobs, run_tests) is False:
failed.append(module)
- print("Failed building with %s", ' '.join(failed))
-
+ if len(failed) > 0:
+ print("Failed building with %s" % (' '.join(failed)))
+ else:
+ print("All configurations ok")
if __name__ == '__main__':
sys.exit(main(sys.argv))
diff --git a/src/tests/test_c25519.cpp b/src/tests/test_c25519.cpp
index 88352f7ce..0b81b0aa5 100644
--- a/src/tests/test_c25519.cpp
+++ b/src/tests/test_c25519.cpp
@@ -83,7 +83,7 @@ class Curve25519_Roundtrip_Test final : public Test
Botan::Curve25519_PrivateKey a_priv_gen(Test::rng());
Botan::Curve25519_PrivateKey b_priv_gen(Test::rng());
-#if defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_AEAD_GCM)
+#if defined(BOTAN_HAS_PKCS5_PBES2) && defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_AEAD_GCM)
// Then serialize to encrypted storage
const std::string a_pass = "alice pass";
diff --git a/src/tests/test_ecies.cpp b/src/tests/test_ecies.cpp
index 5c95e9a0c..5dd70afd7 100644
--- a/src/tests/test_ecies.cpp
+++ b/src/tests/test_ecies.cpp
@@ -237,7 +237,7 @@ class ECIES_Tests final : public Text_Based_Test
BOTAN_REGISTER_TEST("ecies", ECIES_Tests);
-#if defined(BOTAN_HAS_KDF1_18033) && defined(BOTAN_HAS_HMAC) && defined(BOTAN_HAS_AES)
+#if defined(BOTAN_HAS_KDF1_18033) && defined(BOTAN_HAS_HMAC) && defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_SHA2_64)
Test::Result test_other_key_not_set()
{
diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp
index ce9dc94d5..2e59faec2 100644
--- a/src/tests/test_ffi.cpp
+++ b/src/tests/test_ffi.cpp
@@ -1511,9 +1511,15 @@ class FFI_Unit_Tests final : public Test
const std::string pbe_hash = "SHA-512";
#endif
+#if defined(BOTAN_HAS_GCM)
+ const std::string pbe_cipher = "AES-256/GCM";
+#else
+ const std::string pbe_cipher = "AES-256/CBC";
+#endif
+
TEST_FFI_OK(botan_privkey_export_encrypted_pbkdf_msec,
(priv, privkey.data(), &privkey_len, rng, "password",
- pbkdf_msec, &pbkdf_iters_out, "AES-256/GCM", pbe_hash.c_str(), 0));
+ pbkdf_msec, &pbkdf_iters_out, pbe_cipher.c_str(), pbe_hash.c_str(), 0));
if(pbe_hash == "Scrypt")
{
diff --git a/src/tests/test_kdf.cpp b/src/tests/test_kdf.cpp
index 24211a32d..865a713d0 100644
--- a/src/tests/test_kdf.cpp
+++ b/src/tests/test_kdf.cpp
@@ -12,6 +12,7 @@
#if defined(BOTAN_HAS_HKDF)
#include <botan/hkdf.h>
+ #include <botan/hash.h>
#endif
namespace Botan_Tests {
@@ -74,6 +75,14 @@ class HKDF_Expand_Label_Tests final : public Text_Based_Test
const std::string label = vars.get_req_str("Label");
const std::vector<uint8_t> expected = vars.get_req_bin("Output");
+ auto hash = Botan::HashFunction::create(hash_name);
+
+ if(!hash)
+ {
+ result.test_note("Skipping test due to missing hash");
+ return result;
+ }
+
Botan::secure_vector<uint8_t> output =
Botan::hkdf_expand_label(hash_name,
secret.data(), secret.size(),
diff --git a/src/tests/test_pk_pad.cpp b/src/tests/test_pk_pad.cpp
index 5d56acbc8..7c92cf876 100644
--- a/src/tests/test_pk_pad.cpp
+++ b/src/tests/test_pk_pad.cpp
@@ -115,12 +115,17 @@ class EMSA_unit_tests final : public Test
{
try
{
+ const std::string hash_to_use = Botan::hash_for_emsa(pad);
std::unique_ptr<Botan::EMSA> emsa_1(
- Botan::get_emsa(pad + "(" + Botan::hash_for_emsa(pad) + ")"));
+ Botan::get_emsa(pad + "(" + hash_to_use + ")"));
std::unique_ptr<Botan::EMSA> emsa_2(Botan::get_emsa(emsa_1->name()));
name_tests.test_eq("EMSA_name_test for " + pad,
emsa_1->name(), emsa_2->name());
}
+ catch(Botan::Lookup_Error&)
+ {
+ name_tests.test_note("Skipping test due to missing hash");
+ }
catch(const std::exception& e)
{
name_tests.test_failure("EMSA_name_test for " + pad + ": " + e.what());
@@ -137,6 +142,10 @@ class EMSA_unit_tests final : public Test
name_tests.test_failure("EMSA_name_test for " + pad + ": " +
"Could create EMSA with fantasy hash YYZ");
}
+ catch(Botan::Lookup_Error&)
+ {
+ name_tests.test_note("Skipping test due to missing hash");
+ }
catch(const std::exception& e)
{
name_tests.test_eq("EMSA_name_test for " + pad,
@@ -154,6 +163,10 @@ class EMSA_unit_tests final : public Test
name_tests.test_eq("EMSA_name_test for " + pad,
emsa_1->name(), emsa_2->name());
}
+ catch(Botan::Lookup_Error&)
+ {
+ name_tests.test_note("Skipping test due to missing hash");
+ }
catch(const std::exception& e)
{
name_tests.test_failure("EMSA_name_test for " + pad + ": " + e.what());
diff --git a/src/tests/test_siv.cpp b/src/tests/test_siv.cpp
index d7380a9ba..9810a68a5 100644
--- a/src/tests/test_siv.cpp
+++ b/src/tests/test_siv.cpp
@@ -34,8 +34,15 @@ class SIV_Tests final : public Text_Based_Test
Test::Result result(algo + "/SIV");
- std::unique_ptr<Botan::SIV_Mode> siv(
- new Botan::SIV_Encryption(Botan::BlockCipher::create(algo).release()));
+ auto cipher = Botan::BlockCipher::create(algo);
+
+ if(!cipher)
+ {
+ result.test_note("Skipping test due to missing cipher");
+ return result;
+ }
+
+ std::unique_ptr<Botan::SIV_Mode> siv(new Botan::SIV_Encryption(cipher.release()));
siv->set_key(key);
diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp
index e50f21aba..28b09324f 100644
--- a/src/tests/unit_tls.cpp
+++ b/src/tests/unit_tls.cpp
@@ -847,7 +847,7 @@ class TLS_Unit_Tests final : public Test
test_all_versions("AES-128 RSA", results, *client_ses, *server_ses, *creds, "RSA", "AES-128", "SHA-256 SHA-1", etm_setting);
test_all_versions("AES-128 ECDH", results, *client_ses, *server_ses, *creds, "ECDH", "AES-128", "SHA-256 SHA-1", etm_setting);
-#if defined(BOTAN_HAS_CAMELLIA)
+#if defined(BOTAN_HAS_CAMELLIA) && defined(BOTAN_HAS_TLS_CBC)
test_all_versions("Camellia-128 RSA", results, *client_ses, *server_ses,
*creds, "RSA", "Camellia-128", "SHA-256 SHA-1", etm_setting);
test_all_versions("Camellia-256 RSA SHA-2", results, *client_ses, *server_ses,
@@ -903,8 +903,10 @@ class TLS_Unit_Tests final : public Test
client_ses->remove_all();
-#if defined(BOTAN_HAS_CAMELLIA)
+#if defined(BOTAN_HAS_CAMELLIA) && defined(BOTAN_HAS_TLS_CBC)
test_modern_versions("Camellia-256 SHA-2", results, *client_ses, *server_ses, *creds, "RSA", "Camellia-256", "SHA-384 SHA-256");
+#endif
+#if defined(BOTAN_HAS_CAMELLIA) && defined(BOTAN_HAS_GCM)
test_modern_versions("Camellia-128/GCM ECDH", results, *client_ses, *server_ses, *creds, "ECDH", "Camellia-128/GCM", "AEAD");
#endif