aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tests/test_aead.cpp2
-rw-r--r--src/tests/test_block.cpp2
-rw-r--r--src/tests/test_c25519.cpp2
-rw-r--r--src/tests/test_dh.cpp2
-rw-r--r--src/tests/test_dlies.cpp2
-rw-r--r--src/tests/test_dsa.cpp2
-rw-r--r--src/tests/test_ecc_pointmul.cpp2
-rw-r--r--src/tests/test_ecdsa.cpp2
-rw-r--r--src/tests/test_elg.cpp2
-rw-r--r--src/tests/test_gost_3410.cpp2
-rw-r--r--src/tests/test_hash.cpp2
-rw-r--r--src/tests/test_kdf.cpp2
-rw-r--r--src/tests/test_mac.cpp2
-rw-r--r--src/tests/test_modes.cpp2
-rw-r--r--src/tests/test_nr.cpp2
-rw-r--r--src/tests/test_pbkdf.cpp2
-rw-r--r--src/tests/test_rsa.cpp6
-rw-r--r--src/tests/test_rw.cpp4
-rw-r--r--src/tests/tests.h6
-rw-r--r--src/tests/unit_ecdsa.cpp30
20 files changed, 38 insertions, 40 deletions
diff --git a/src/tests/test_aead.cpp b/src/tests/test_aead.cpp
index a149493f6..5fe4011fb 100644
--- a/src/tests/test_aead.cpp
+++ b/src/tests/test_aead.cpp
@@ -143,7 +143,7 @@ size_t test_aead()
});
};
- return run_tests_in_dir(TEST_DATA_DIR "aead", test);
+ return run_tests_in_dir(TEST_DATA_DIR "/aead", test);
}
#else
diff --git a/src/tests/test_block.cpp b/src/tests/test_block.cpp
index 50801cf21..509cf1c0c 100644
--- a/src/tests/test_block.cpp
+++ b/src/tests/test_block.cpp
@@ -81,5 +81,5 @@ size_t test_block()
});
};
- return run_tests_in_dir(TEST_DATA_DIR "block", test_bc);
+ return run_tests_in_dir(TEST_DATA_DIR "/block", test_bc);
}
diff --git a/src/tests/test_c25519.cpp b/src/tests/test_c25519.cpp
index d6f37451b..5531289a2 100644
--- a/src/tests/test_c25519.cpp
+++ b/src/tests/test_c25519.cpp
@@ -106,7 +106,7 @@ size_t test_curve25519()
size_t fails = 0;
- std::ifstream c25519_scalar(PK_TEST_DATA_DIR "/c25519_scalar.vec");
+ std::ifstream c25519_scalar(TEST_DATA_DIR_PK "/c25519_scalar.vec");
fails += run_tests_bb(c25519_scalar, "Curve25519 ScalarMult", "Out", true,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_dh.cpp b/src/tests/test_dh.cpp
index a546006a5..e48d41154 100644
--- a/src/tests/test_dh.cpp
+++ b/src/tests/test_dh.cpp
@@ -55,7 +55,7 @@ size_t test_dh()
{
size_t fails = 0;
- std::ifstream dh_sig(PK_TEST_DATA_DIR "/dh.vec");
+ std::ifstream dh_sig(TEST_DATA_DIR_PK "/dh.vec");
fails += run_tests_bb(dh_sig, "DH Kex", "K", true,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_dlies.cpp b/src/tests/test_dlies.cpp
index 40b48c61f..f282a9387 100644
--- a/src/tests/test_dlies.cpp
+++ b/src/tests/test_dlies.cpp
@@ -75,7 +75,7 @@ size_t test_dlies()
{
size_t fails = 0;
- std::ifstream dlies(PK_TEST_DATA_DIR "/dlies.vec");
+ std::ifstream dlies(TEST_DATA_DIR_PK "/dlies.vec");
fails += run_tests_bb(dlies, "DLIES Encryption", "Ciphertext", true,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_dsa.cpp b/src/tests/test_dsa.cpp
index 9ce496d80..37b2851af 100644
--- a/src/tests/test_dsa.cpp
+++ b/src/tests/test_dsa.cpp
@@ -52,7 +52,7 @@ size_t test_dsa()
{
size_t fails = 0;
- std::ifstream dsa_sig(PK_TEST_DATA_DIR "/dsa.vec");
+ std::ifstream dsa_sig(TEST_DATA_DIR_PK "/dsa.vec");
fails += run_tests_bb(dsa_sig, "DSA Signature", "Signature", false,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_ecc_pointmul.cpp b/src/tests/test_ecc_pointmul.cpp
index 585bd7da7..b8537ec64 100644
--- a/src/tests/test_ecc_pointmul.cpp
+++ b/src/tests/test_ecc_pointmul.cpp
@@ -59,7 +59,7 @@ size_t test_ecc_pointmul()
{
size_t fails = 0;
- std::ifstream ecc_mul(PK_TEST_DATA_DIR "/ecc.vec");
+ std::ifstream ecc_mul(TEST_DATA_DIR_PK "/ecc.vec");
fails += run_tests_bb(ecc_mul, "ECC Point Mult", "Y", false,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_ecdsa.cpp b/src/tests/test_ecdsa.cpp
index 22a36f1a3..a2ec8d115 100644
--- a/src/tests/test_ecdsa.cpp
+++ b/src/tests/test_ecdsa.cpp
@@ -48,7 +48,7 @@ size_t test_ecdsa()
{
size_t fails = 0;
- std::ifstream ecdsa_sig(PK_TEST_DATA_DIR "/ecdsa.vec");
+ std::ifstream ecdsa_sig(TEST_DATA_DIR_PK "/ecdsa.vec");
fails += run_tests_bb(ecdsa_sig, "ECDSA Signature", "Signature", false,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_elg.cpp b/src/tests/test_elg.cpp
index da5047cd0..7bfb02e46 100644
--- a/src/tests/test_elg.cpp
+++ b/src/tests/test_elg.cpp
@@ -55,7 +55,7 @@ size_t test_elgamal()
{
size_t fails = 0;
- std::ifstream elgamal_enc(PK_TEST_DATA_DIR "/elgamal.vec");
+ std::ifstream elgamal_enc(TEST_DATA_DIR_PK "/elgamal.vec");
fails += run_tests_bb(elgamal_enc, "ElGamal Encryption", "Ciphertext", true,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_gost_3410.cpp b/src/tests/test_gost_3410.cpp
index 3c83af805..2f59f7736 100644
--- a/src/tests/test_gost_3410.cpp
+++ b/src/tests/test_gost_3410.cpp
@@ -48,7 +48,7 @@ size_t test_gost_3410()
{
size_t fails = 0;
- std::ifstream ecdsa_sig(PK_TEST_DATA_DIR "/gost_3410.vec");
+ std::ifstream ecdsa_sig(TEST_DATA_DIR_PK "/gost_3410.vec");
fails += run_tests_bb(ecdsa_sig, "GOST-34.10 Signature", "Signature", true,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_hash.cpp b/src/tests/test_hash.cpp
index abc3a2f95..a69ba3ef3 100644
--- a/src/tests/test_hash.cpp
+++ b/src/tests/test_hash.cpp
@@ -101,5 +101,5 @@ size_t test_hash()
});
};
- return run_tests_in_dir(TEST_DATA_DIR "hash", test);
+ return run_tests_in_dir(TEST_DATA_DIR "/hash", test);
}
diff --git a/src/tests/test_kdf.cpp b/src/tests/test_kdf.cpp
index 1e333381c..65814f0d6 100644
--- a/src/tests/test_kdf.cpp
+++ b/src/tests/test_kdf.cpp
@@ -35,7 +35,7 @@ size_t test_kdf()
});
};
- return run_tests_in_dir(TEST_DATA_DIR "kdf", test);
+ return run_tests_in_dir(TEST_DATA_DIR "/kdf", test);
}
#else
diff --git a/src/tests/test_mac.cpp b/src/tests/test_mac.cpp
index 4d3833199..6ab87274f 100644
--- a/src/tests/test_mac.cpp
+++ b/src/tests/test_mac.cpp
@@ -93,7 +93,7 @@ size_t test_mac()
});
};
- return run_tests_in_dir(TEST_DATA_DIR "mac", test);
+ return run_tests_in_dir(TEST_DATA_DIR "/mac", test);
}
#else
diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp
index 2646c9059..bfbb46355 100644
--- a/src/tests/test_modes.cpp
+++ b/src/tests/test_modes.cpp
@@ -98,7 +98,7 @@ size_t test_modes()
});
};
- return run_tests_in_dir(TEST_DATA_DIR "modes", test);
+ return run_tests_in_dir(TEST_DATA_DIR "/modes", test);
}
#else
diff --git a/src/tests/test_nr.cpp b/src/tests/test_nr.cpp
index 1da12c8c8..334b10359 100644
--- a/src/tests/test_nr.cpp
+++ b/src/tests/test_nr.cpp
@@ -54,7 +54,7 @@ size_t test_nr()
{
size_t fails = 0;
- std::ifstream nr_sig(PK_TEST_DATA_DIR "/nr.vec");
+ std::ifstream nr_sig(TEST_DATA_DIR_PK "/nr.vec");
fails += run_tests_bb(nr_sig, "NR Signature", "Signature", true,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/test_pbkdf.cpp b/src/tests/test_pbkdf.cpp
index c60cf9d78..8f765fa1d 100644
--- a/src/tests/test_pbkdf.cpp
+++ b/src/tests/test_pbkdf.cpp
@@ -37,7 +37,7 @@ size_t test_pbkdf()
});
};
- return run_tests_in_dir(TEST_DATA_DIR "pbkdf", test);
+ return run_tests_in_dir(TEST_DATA_DIR "/pbkdf", test);
}
#else
diff --git a/src/tests/test_rsa.cpp b/src/tests/test_rsa.cpp
index 06944ac56..940525574 100644
--- a/src/tests/test_rsa.cpp
+++ b/src/tests/test_rsa.cpp
@@ -91,9 +91,9 @@ size_t rsa_sig_verify(const std::string& e,
size_t test_rsa()
{
- std::ifstream rsa_enc(PK_TEST_DATA_DIR "/rsaes.vec");
- std::ifstream rsa_sig(PK_TEST_DATA_DIR "/rsa_sig.vec");
- std::ifstream rsa_verify(PK_TEST_DATA_DIR "/rsa_verify.vec");
+ std::ifstream rsa_enc(TEST_DATA_DIR_PK "/rsaes.vec");
+ std::ifstream rsa_sig(TEST_DATA_DIR_PK "/rsa_sig.vec");
+ std::ifstream rsa_verify(TEST_DATA_DIR_PK "/rsa_verify.vec");
size_t fails = 0;
diff --git a/src/tests/test_rw.cpp b/src/tests/test_rw.cpp
index 431b070b2..286bcacdf 100644
--- a/src/tests/test_rw.cpp
+++ b/src/tests/test_rw.cpp
@@ -63,8 +63,8 @@ size_t test_rw()
{
size_t fails = 0;
- std::ifstream rw_sig(PK_TEST_DATA_DIR "/rw_sig.vec");
- std::ifstream rw_verify(PK_TEST_DATA_DIR "/rw_verify.vec");
+ std::ifstream rw_sig(TEST_DATA_DIR_PK "/rw_sig.vec");
+ std::ifstream rw_verify(TEST_DATA_DIR_PK "/rw_verify.vec");
fails += run_tests_bb(rw_sig, "RW Signature", "Signature", true,
[](std::map<std::string, std::string> m) -> size_t
diff --git a/src/tests/tests.h b/src/tests/tests.h
index d2fe0e69b..37d4a6fd3 100644
--- a/src/tests/tests.h
+++ b/src/tests/tests.h
@@ -47,9 +47,9 @@ void test_report(const std::string& name, size_t ran, size_t failed);
#define TEST(expr, msg) do { if(!(expr)) { ++fails; std::cout << msg; } while(0)
-#define LIB_SRC_DIR "lib/"
-#define TEST_DATA_DIR "src/tests/data/"
-#define PK_TEST_DATA_DIR "src/tests/data/pubkey"
+#define TEST_DATA_DIR "src/tests/data"
+#define TEST_DATA_DIR_PK "src/tests/data/pubkey"
+#define TEST_DATA_DIR_ECC "src/tests/data/ecc"
int test_main(int argc, char* argv[]);
diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp
index 53d12aeb7..6133fa576 100644
--- a/src/tests/unit_ecdsa.cpp
+++ b/src/tests/unit_ecdsa.cpp
@@ -30,8 +30,6 @@
using namespace Botan;
-#define ECC_TEST_DATA_DIR TEST_DATA_DIR "/ecc"
-
#define CHECK_MESSAGE(expr, print) try { if(!(expr)) { ++fails; std::cout << print << std::endl; } } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << std::endl; }
#define CHECK(expr) try { if(!(expr)) { ++fails; std::cout << #expr << std::endl; } } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << std::endl; }
@@ -100,7 +98,7 @@ size_t test_hash_larger_than_n(RandomNumberGenerator& rng)
#if defined(BOTAN_HAS_X509_CERTIFICATES)
size_t test_decode_ecdsa_X509()
{
- X509_Certificate cert(ECC_TEST_DATA_DIR "/CSCA.CSCA.csca-germany.1.crt");
+ X509_Certificate cert(TEST_DATA_DIR_ECC "/CSCA.CSCA.csca-germany.1.crt");
size_t fails = 0;
CHECK_MESSAGE(OIDS::lookup(cert.signature_algorithm().oid) == "ECDSA/EMSA1(SHA-224)", "error reading signature algorithm from x509 ecdsa certificate");
@@ -118,8 +116,8 @@ size_t test_decode_ecdsa_X509()
size_t test_decode_ver_link_SHA256()
{
- X509_Certificate root_cert(ECC_TEST_DATA_DIR "/root2_SHA256.cer");
- X509_Certificate link_cert(ECC_TEST_DATA_DIR "/link_SHA256.cer");
+ X509_Certificate root_cert(TEST_DATA_DIR_ECC "/root2_SHA256.cer");
+ X509_Certificate link_cert(TEST_DATA_DIR_ECC "/link_SHA256.cer");
size_t fails = 0;
std::unique_ptr<X509_PublicKey> pubkey(root_cert.subject_public_key());
@@ -130,8 +128,8 @@ size_t test_decode_ver_link_SHA256()
size_t test_decode_ver_link_SHA1()
{
- X509_Certificate root_cert(ECC_TEST_DATA_DIR "/root_SHA1.163.crt");
- X509_Certificate link_cert(ECC_TEST_DATA_DIR "/link_SHA1.166.crt");
+ X509_Certificate root_cert(TEST_DATA_DIR_ECC "/root_SHA1.163.crt");
+ X509_Certificate link_cert(TEST_DATA_DIR_ECC "/link_SHA1.166.crt");
size_t fails = 0;
std::unique_ptr<X509_PublicKey> pubkey(root_cert.subject_public_key());
@@ -242,14 +240,14 @@ size_t test_create_pkcs8(RandomNumberGenerator& rng)
//cout << "\nequal: " << (rsa_key == rsa_key2) << std::endl;
//DSA_PrivateKey key(DL_Group("dsa/jce/1024"));
- std::ofstream rsa_priv_key(ECC_TEST_DATA_DIR "/rsa_private.pkcs8.pem");
+ std::ofstream rsa_priv_key(TEST_DATA_DIR_ECC "/rsa_private.pkcs8.pem");
rsa_priv_key << PKCS8::PEM_encode(rsa_key);
EC_Group dom_pars(OID("1.3.132.0.8"));
ECDSA_PrivateKey key(rng, dom_pars);
// later used by other tests :(
- std::ofstream priv_key(ECC_TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem");
+ std::ofstream priv_key(TEST_DATA_DIR_ECC "/wo_dompar_private.pkcs8.pem");
priv_key << PKCS8::PEM_encode(key);
}
catch (std::exception& e)
@@ -267,14 +265,14 @@ size_t test_create_and_verify(RandomNumberGenerator& rng)
EC_Group dom_pars(OID("1.3.132.0.8"));
ECDSA_PrivateKey key(rng, dom_pars);
- std::ofstream priv_key(ECC_TEST_DATA_DIR "/dompar_private.pkcs8.pem");
+ std::ofstream priv_key(TEST_DATA_DIR_ECC "/dompar_private.pkcs8.pem");
priv_key << PKCS8::PEM_encode(key);
- std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(ECC_TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR_ECC "/wo_dompar_private.pkcs8.pem", rng));
ECDSA_PrivateKey* loaded_ec_key = dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get());
CHECK_MESSAGE(loaded_ec_key, "the loaded key could not be converted into an ECDSA_PrivateKey");
- std::unique_ptr<PKCS8_PrivateKey> loaded_key_1(PKCS8::load_key(ECC_TEST_DATA_DIR "/rsa_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key_1(PKCS8::load_key(TEST_DATA_DIR_ECC "/rsa_private.pkcs8.pem", rng));
ECDSA_PrivateKey* loaded_rsa_key = dynamic_cast<ECDSA_PrivateKey*>(loaded_key_1.get());
CHECK_MESSAGE(!loaded_rsa_key, "the loaded key is ECDSA_PrivateKey -> shouldn't be, is a RSA-Key");
@@ -390,7 +388,7 @@ size_t test_read_pkcs8(RandomNumberGenerator& rng)
try
{
- std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(ECC_TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR_ECC "/wo_dompar_private.pkcs8.pem", rng));
ECDSA_PrivateKey* ecdsa = dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get());
CHECK_MESSAGE(ecdsa, "the loaded key could not be converted into an ECDSA_PrivateKey");
@@ -411,7 +409,7 @@ size_t test_read_pkcs8(RandomNumberGenerator& rng)
try
{
- std::unique_ptr<PKCS8_PrivateKey> loaded_key_nodp(PKCS8::load_key(ECC_TEST_DATA_DIR "/nodompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key_nodp(PKCS8::load_key(TEST_DATA_DIR_ECC "/nodompar_private.pkcs8.pem", rng));
// anew in each test with unregistered domain-parameters
ECDSA_PrivateKey* ecdsa_nodp = dynamic_cast<ECDSA_PrivateKey*>(loaded_key_nodp.get());
CHECK_MESSAGE(ecdsa_nodp, "the loaded key could not be converted into an ECDSA_PrivateKey");
@@ -427,7 +425,7 @@ size_t test_read_pkcs8(RandomNumberGenerator& rng)
try
{
std::unique_ptr<PKCS8_PrivateKey> loaded_key_withdp(
- PKCS8::load_key(ECC_TEST_DATA_DIR "/withdompar_private.pkcs8.pem", rng));
+ PKCS8::load_key(TEST_DATA_DIR_ECC "/withdompar_private.pkcs8.pem", rng));
std::cout << "Unexpected success: loaded key with unknown OID" << std::endl;
++fails;
@@ -450,7 +448,7 @@ size_t test_ecc_key_with_rfc5915_extensions(RandomNumberGenerator& rng)
try
{
std::unique_ptr<PKCS8_PrivateKey> pkcs8(
- PKCS8::load_key(ECC_TEST_DATA_DIR "/ecc_private_with_rfc5915_ext.pem", rng));
+ PKCS8::load_key(TEST_DATA_DIR_ECC "/ecc_private_with_rfc5915_ext.pem", rng));
if(!dynamic_cast<ECDSA_PrivateKey*>(pkcs8.get()))
{