diff options
39 files changed, 129 insertions, 149 deletions
diff --git a/src/tests/test_aead.cpp b/src/tests/test_aead.cpp index 18e4417a8..306589b93 100644 --- a/src/tests/test_aead.cpp +++ b/src/tests/test_aead.cpp @@ -20,9 +20,7 @@ namespace { class AEAD_Tests : public Text_Based_Test { public: - AEAD_Tests() : - Text_Based_Test("aead", {"Key", "Nonce", "In", "Out"}, {"AD"}) - {} + AEAD_Tests() : Text_Based_Test("aead", "Key,Nonce,In,Out", "AD") {} Test::Result test_enc(const std::vector<uint8_t>& key, const std::vector<uint8_t>& nonce, const std::vector<uint8_t>& input, const std::vector<uint8_t>& expected, diff --git a/src/tests/test_bigint.cpp b/src/tests/test_bigint.cpp index 9cadee998..e73bbd08d 100644 --- a/src/tests/test_bigint.cpp +++ b/src/tests/test_bigint.cpp @@ -177,7 +177,7 @@ BOTAN_REGISTER_TEST("bigint_unit", BigInt_Unit_Tests); class BigInt_Add_Test : public Text_Based_Test { public: - BigInt_Add_Test() : Text_Based_Test("bn/add.vec", {"In1","In2","Output"}) {} + BigInt_Add_Test() : Text_Based_Test("bn/add.vec", "In1,In2,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -211,7 +211,7 @@ BOTAN_REGISTER_TEST("bn_add", BigInt_Add_Test); class BigInt_Sub_Test : public Text_Based_Test { public: - BigInt_Sub_Test() : Text_Based_Test("bn/sub.vec", {"In1","In2","Output"}) {} + BigInt_Sub_Test() : Text_Based_Test("bn/sub.vec", "In1,In2,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -238,7 +238,7 @@ BOTAN_REGISTER_TEST("bn_sub", BigInt_Sub_Test); class BigInt_Mul_Test : public Text_Based_Test { public: - BigInt_Mul_Test() : Text_Based_Test("bn/mul.vec", {"In1","In2","Output"}) {} + BigInt_Mul_Test() : Text_Based_Test("bn/mul.vec", "In1,In2,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -268,7 +268,7 @@ BOTAN_REGISTER_TEST("bn_mul", BigInt_Mul_Test); class BigInt_Sqr_Test : public Text_Based_Test { public: - BigInt_Sqr_Test() : Text_Based_Test("bn/sqr.vec", {"Input","Output"}) {} + BigInt_Sqr_Test() : Text_Based_Test("bn/sqr.vec", "Input,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -289,7 +289,7 @@ BOTAN_REGISTER_TEST("bn_sqr", BigInt_Sqr_Test); class BigInt_Div_Test : public Text_Based_Test { public: - BigInt_Div_Test() : Text_Based_Test("bn/divide.vec", {"In1","In2","Output"}) {} + BigInt_Div_Test() : Text_Based_Test("bn/divide.vec", "In1,In2,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -314,7 +314,7 @@ BOTAN_REGISTER_TEST("bn_div", BigInt_Div_Test); class BigInt_Mod_Test : public Text_Based_Test { public: - BigInt_Mod_Test() : Text_Based_Test("bn/mod.vec", {"In1","In2","Output"}) {} + BigInt_Mod_Test() : Text_Based_Test("bn/mod.vec", "In1,In2,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -348,7 +348,7 @@ BOTAN_REGISTER_TEST("bn_mod", BigInt_Mod_Test); class BigInt_Lshift_Test : public Text_Based_Test { public: - BigInt_Lshift_Test() : Text_Based_Test("bn/lshift.vec", {"Value","Shift","Output"}) {} + BigInt_Lshift_Test() : Text_Based_Test("bn/lshift.vec", "Value,Shift,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -373,7 +373,7 @@ BOTAN_REGISTER_TEST("bn_lshift", BigInt_Lshift_Test); class BigInt_Rshift_Test : public Text_Based_Test { public: - BigInt_Rshift_Test() : Text_Based_Test("bn/rshift.vec", {"Value","Shift","Output"}) {} + BigInt_Rshift_Test() : Text_Based_Test("bn/rshift.vec", "Value,Shift,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -398,7 +398,7 @@ BOTAN_REGISTER_TEST("bn_rshift", BigInt_Rshift_Test); class BigInt_Powmod_Test : public Text_Based_Test { public: - BigInt_Powmod_Test() : Text_Based_Test("bn/powmod.vec", {"Base","Exponent","Modulus","Output"}) {} + BigInt_Powmod_Test() : Text_Based_Test("bn/powmod.vec", "Base,Exponent,Modulus,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -445,7 +445,7 @@ BOTAN_REGISTER_TEST("bn_powmod", BigInt_Powmod_Test); class BigInt_IsPrime_Test : public Text_Based_Test { public: - BigInt_IsPrime_Test() : Text_Based_Test("bn/isprime.vec", {"Value","IsPrime"}) {} + BigInt_IsPrime_Test() : Text_Based_Test("bn/isprime.vec", "Value,IsPrime") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -465,7 +465,7 @@ BOTAN_REGISTER_TEST("bn_isprime", BigInt_IsPrime_Test); class BigInt_Ressol_Test : public Text_Based_Test { public: - BigInt_Ressol_Test() : Text_Based_Test("bn/ressol.vec", {"Input","Modulus","Output"}) {} + BigInt_Ressol_Test() : Text_Based_Test("bn/ressol.vec", "Input,Modulus,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -494,7 +494,7 @@ BOTAN_REGISTER_TEST("bn_ressol", BigInt_Ressol_Test); class BigInt_InvMod_Test : public Text_Based_Test { public: - BigInt_InvMod_Test() : Text_Based_Test("bn/invmod.vec", {"Input","Modulus","Output"}) {} + BigInt_InvMod_Test() : Text_Based_Test("bn/invmod.vec", "Input,Modulus,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -536,7 +536,7 @@ BOTAN_REGISTER_TEST("bn_invmod", BigInt_InvMod_Test); class DSA_ParamGen_Test : public Text_Based_Test { public: - DSA_ParamGen_Test() : Text_Based_Test("bn/dsa_gen.vec", {"P","Q","Seed"}) {} + DSA_ParamGen_Test() : Text_Based_Test("bn/dsa_gen.vec", "P,Q,Seed") {} Test::Result run_one_test(const std::string& header, const VarMap& vars) override { diff --git a/src/tests/test_block.cpp b/src/tests/test_block.cpp index 91e171b09..20d887794 100644 --- a/src/tests/test_block.cpp +++ b/src/tests/test_block.cpp @@ -12,7 +12,7 @@ namespace Botan_Tests { class Block_Cipher_Tests : public Text_Based_Test { public: - Block_Cipher_Tests() : Text_Based_Test("block", {"Key", "In", "Out"}) {} + Block_Cipher_Tests() : Text_Based_Test("block", "Key,In,Out") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override { diff --git a/src/tests/test_c25519.cpp b/src/tests/test_c25519.cpp index 25e053857..6790b3c4e 100644 --- a/src/tests/test_c25519.cpp +++ b/src/tests/test_c25519.cpp @@ -21,7 +21,7 @@ class Curve25519_Sclarmult_Tests : public Text_Based_Test public: Curve25519_Sclarmult_Tests() : Text_Based_Test( "pubkey/c25519_scalar.vec", - {"Secret","Basepoint","Out"}) + "Secret,Basepoint,Out") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override diff --git a/src/tests/test_dh.cpp b/src/tests/test_dh.cpp index 486e6dfe0..93ac25cee 100644 --- a/src/tests/test_dh.cpp +++ b/src/tests/test_dh.cpp @@ -24,8 +24,8 @@ class Diffie_Hellman_KAT_Tests : public PK_Key_Agreement_Test Diffie_Hellman_KAT_Tests() : PK_Key_Agreement_Test( "Diffie-Hellman", "pubkey/dh.vec", - {"P", "G", "X", "Y", "Msg", "OutLen", "K"}, - {"KDF"}) + "P,G,X,Y,Msg,OutLen,K", + "KDF") {} std::string default_kdf(const VarMap&) const override { return "Raw"; } diff --git a/src/tests/test_dlies.cpp b/src/tests/test_dlies.cpp index ea7117a43..9f19724b1 100644 --- a/src/tests/test_dlies.cpp +++ b/src/tests/test_dlies.cpp @@ -25,7 +25,7 @@ class DLIES_KAT_Tests : public Text_Based_Test public: DLIES_KAT_Tests() : Text_Based_Test( "pubkey/dlies.vec", - {"Kdf", "Mac", "MacKeyLen", "IV", "Group", "X1", "X2", "Msg", "Ciphertext"}) + "Kdf,Mac,MacKeyLen,IV,Group,X1,X2,Msg,Ciphertext") {} Test::Result run_one_test(const std::string& cipher_algo, const VarMap& vars) override diff --git a/src/tests/test_dsa.cpp b/src/tests/test_dsa.cpp index 851665db2..69680f477 100644 --- a/src/tests/test_dsa.cpp +++ b/src/tests/test_dsa.cpp @@ -24,11 +24,12 @@ class DSA_KAT_Tests : public PK_Signature_Generation_Test "DSA", #if defined(BOTAN_HAS_RFC6979_GENERATOR) "pubkey/dsa_rfc6979.vec", - {"P", "Q", "G", "X", "Hash", "Msg", "Signature"}) + "P,Q,G,X,Hash,Msg,Signature", #else "pubkey/dsa_prob.vec", - {"P", "Q", "G", "X", "Hash", "Msg", "Nonce", "Signature"}) + "P,Q,G,X,Hash,Msg,Nonce,Signature", #endif + "") {} bool clear_between_callbacks() const override { return false; } diff --git a/src/tests/test_ecc_pointmul.cpp b/src/tests/test_ecc_pointmul.cpp index a0ee37c2d..b3ba2396a 100644 --- a/src/tests/test_ecc_pointmul.cpp +++ b/src/tests/test_ecc_pointmul.cpp @@ -21,10 +21,7 @@ namespace { class ECC_Pointmult_Tests : public Text_Based_Test { public: - ECC_Pointmult_Tests() : Text_Based_Test( - "pubkey/ecc.vec", - {"m", "X", "Y"}) - {} + ECC_Pointmult_Tests() : Text_Based_Test("pubkey/ecc.vec", "m,X,Y") {} Test::Result run_one_test(const std::string& group_id, const VarMap& vars) override { diff --git a/src/tests/test_ecdh.cpp b/src/tests/test_ecdh.cpp index 5bdce4144..270e50db3 100644 --- a/src/tests/test_ecdh.cpp +++ b/src/tests/test_ecdh.cpp @@ -24,8 +24,8 @@ class ECDH_KAT_Tests : public PK_Key_Agreement_Test ECDH_KAT_Tests() : PK_Key_Agreement_Test( "ECDH", "pubkey/ecdh.vec", - {"Group", "Secret", "CounterKey", "K"}, - {"KDF"}) + "Group,Secret,CounterKey,K", + "KDF") {} std::string default_kdf(const VarMap&) const override { return "Raw"; } diff --git a/src/tests/test_ecdsa.cpp b/src/tests/test_ecdsa.cpp index d8695e37f..90899e183 100644 --- a/src/tests/test_ecdsa.cpp +++ b/src/tests/test_ecdsa.cpp @@ -27,10 +27,10 @@ class ECDSA_Signature_KAT_Tests : public PK_Signature_Generation_Test "ECDSA", #if defined(BOTAN_HAS_RFC6979_GENERATOR) "pubkey/ecdsa_rfc6979.vec", - {"Group", "X", "Hash", "Msg", "Signature"}) + "Group,X,Hash,Msg,Signature") #else "pubkey/ecdsa_prob.vec", - {"Group", "X", "Hash", "Msg", "Nonce", "Signature"}) + "Group,X,Hash,Msg,Nonce,Signature") #endif {} diff --git a/src/tests/test_ecgdsa.cpp b/src/tests/test_ecgdsa.cpp index 08c3777b4..e59b4dff6 100644 --- a/src/tests/test_ecgdsa.cpp +++ b/src/tests/test_ecgdsa.cpp @@ -26,7 +26,7 @@ class ECGDSA_Signature_KAT_Tests : public PK_Signature_Generation_Test ECGDSA_Signature_KAT_Tests() : PK_Signature_Generation_Test( "ECGDSA", "pubkey/ecgdsa.vec", - {"Group", "X", "Hash", "Msg", "Nonce", "Signature"}) + "Group,X,Hash,Msg,Nonce,Signature") {} bool clear_between_callbacks() const override { return false; } diff --git a/src/tests/test_ecies.cpp b/src/tests/test_ecies.cpp index f900eccb0..c126ed2c8 100644 --- a/src/tests/test_ecies.cpp +++ b/src/tests/test_ecies.cpp @@ -106,9 +106,8 @@ class ECIES_ISO_Tests : public Text_Based_Test public: ECIES_ISO_Tests() : Text_Based_Test( "pubkey/ecies-18033.vec", - { "format", "p", "a", "b", "mu", "nu", "gx", "gy", "hx", "hy", "x", "r", "C0", "K" }) - { - } + "format,p,a,b,mu,nu,gx,gy,hx,hy,x,r,C0,K") + {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -203,11 +202,10 @@ class ECIES_Tests : public Text_Based_Test { public: ECIES_Tests() : Text_Based_Test( - "pubkey/ecies.vec", - { "Curve", "PrivateKey", "OtherPrivateKey", "Kdf", "Dem", "DemKeyLen", "Iv", "Mac", "MacKeyLen", "Format", - "CofactorMode", "OldCofactorMode", "CheckMode", "SingleHashMode", "Label", "Plaintext", "Ciphertext" }) - { - } + "pubkey/ecies.vec", + "Curve,PrivateKey,OtherPrivateKey,Kdf,Dem,DemKeyLen,Iv,Mac,MacKeyLen,Format", + "CofactorMode,OldCofactorMode,CheckMode,SingleHashMode,Label,Plaintext,Ciphertext") + {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { diff --git a/src/tests/test_eckcdsa.cpp b/src/tests/test_eckcdsa.cpp index c2c391c2f..83db0364d 100644 --- a/src/tests/test_eckcdsa.cpp +++ b/src/tests/test_eckcdsa.cpp @@ -26,7 +26,7 @@ class ECKCDSA_Signature_KAT_Tests : public PK_Signature_Generation_Test ECKCDSA_Signature_KAT_Tests() : PK_Signature_Generation_Test( "ECKCDSA", "pubkey/eckcdsa.vec", - {"Group", "X", "Hash", "Msg", "Nonce", "Signature"}) + "Group,X,Hash,Msg,Nonce,Signature") {} bool clear_between_callbacks() const override { return false; } diff --git a/src/tests/test_elg.cpp b/src/tests/test_elg.cpp index f740be7f6..8219b0490 100644 --- a/src/tests/test_elg.cpp +++ b/src/tests/test_elg.cpp @@ -23,8 +23,8 @@ class ElGamal_KAT_Tests : public PK_Encryption_Decryption_Test ElGamal_KAT_Tests() : PK_Encryption_Decryption_Test( "ElGamal", "pubkey/elgamal.vec", - {"P", "G", "X", "Msg", "Nonce", "Ciphertext"}, - {"Padding"}) + "P,G,X,Msg,Nonce,Ciphertext", + "Padding") {} std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override diff --git a/src/tests/test_fpe.cpp b/src/tests/test_fpe.cpp index e2a7c6e68..a88b793c7 100644 --- a/src/tests/test_fpe.cpp +++ b/src/tests/test_fpe.cpp @@ -17,7 +17,7 @@ namespace Botan_Tests { class FPE_FE1_Tests : public Text_Based_Test { public: - FPE_FE1_Tests() : Text_Based_Test("fpe_fe1.vec", {"Mod", "In", "Out", "Key", "Tweak"}) {} + FPE_FE1_Tests() : Text_Based_Test("fpe_fe1.vec", "Mod,In,Out,Key,Tweak") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { diff --git a/src/tests/test_gost_3410.cpp b/src/tests/test_gost_3410.cpp index 70eb28870..55750d416 100644 --- a/src/tests/test_gost_3410.cpp +++ b/src/tests/test_gost_3410.cpp @@ -24,7 +24,7 @@ class GOST_3410_2001_Verification_Tests : public PK_Signature_Verification_Test GOST_3410_2001_Verification_Tests() : PK_Signature_Verification_Test( "GOST 34.10-2001", "pubkey/gost_3410_verify.vec", - {"Group", "Pubkey", "Hash", "Msg", "Signature"}) + "Group,Pubkey,Hash,Msg,Signature") {} std::unique_ptr<Botan::Public_Key> load_public_key(const VarMap& vars) override @@ -49,7 +49,7 @@ class GOST_3410_2001_Signature_Tests : public PK_Signature_Generation_Test GOST_3410_2001_Signature_Tests() : PK_Signature_Generation_Test( "GOST 34.10-2001", "pubkey/gost_3410_sign.vec", - {"Group", "Privkey", "Hash", "Nonce", "Msg", "Signature"}, {}) + "Group,Privkey,Hash,Nonce,Msg,Signature") {} std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override diff --git a/src/tests/test_hash.cpp b/src/tests/test_hash.cpp index 2ff74d1f2..fd255131b 100644 --- a/src/tests/test_hash.cpp +++ b/src/tests/test_hash.cpp @@ -15,7 +15,7 @@ namespace { class Hash_Function_Tests : public Text_Based_Test { public: - Hash_Function_Tests() : Text_Based_Test("hash", {"In", "Out"}) {} + Hash_Function_Tests() : Text_Based_Test("hash", "In,Out") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override { diff --git a/src/tests/test_kdf.cpp b/src/tests/test_kdf.cpp index ec3688fef..2d58914fe 100644 --- a/src/tests/test_kdf.cpp +++ b/src/tests/test_kdf.cpp @@ -19,8 +19,8 @@ class KDF_KAT_Tests : public Text_Based_Test { public: KDF_KAT_Tests() : Text_Based_Test("kdf", - {"OutputLen", "Salt", "Secret", "Label", "Output"}, - {"IKM","XTS"}) + "OutputLen,Salt,Secret,Label,Output", + "IKM,XTS") {} Test::Result run_one_test(const std::string& kdf_name, const VarMap& vars) override diff --git a/src/tests/test_keywrap.cpp b/src/tests/test_keywrap.cpp index cdc4b2b67..46f37d4dd 100644 --- a/src/tests/test_keywrap.cpp +++ b/src/tests/test_keywrap.cpp @@ -20,9 +20,7 @@ namespace { class RFC3394_Keywrap_Tests : public Text_Based_Test { public: - RFC3394_Keywrap_Tests() : Text_Based_Test("rfc3394.vec", - {"Key", "KEK", "Output"}) - {} + RFC3394_Keywrap_Tests() : Text_Based_Test("rfc3394.vec", "Key,KEK,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { diff --git a/src/tests/test_mac.cpp b/src/tests/test_mac.cpp index be897143b..8fb3b38c2 100644 --- a/src/tests/test_mac.cpp +++ b/src/tests/test_mac.cpp @@ -20,8 +20,7 @@ namespace { class Message_Auth_Tests : public Text_Based_Test { public: - Message_Auth_Tests() : - Text_Based_Test("mac", {"Key", "In", "Out"}, {"IV"}) {} + Message_Auth_Tests() : Text_Based_Test("mac", "Key,In,Out", "IV") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override { diff --git a/src/tests/test_mceliece.cpp b/src/tests/test_mceliece.cpp index 05a7448ff..22bdd95fe 100644 --- a/src/tests/test_mceliece.cpp +++ b/src/tests/test_mceliece.cpp @@ -38,11 +38,10 @@ class McEliece_Keygen_Encrypt_Test : public Text_Based_Test { public: McEliece_Keygen_Encrypt_Test() : - Text_Based_Test("McEliece", - "pubkey/mce.vec", - {"McElieceSeed", "KeyN","KeyT","PublicKeyFingerprint", - "PrivateKeyFingerprint", "EncryptPRNGSeed", - "SharedKey", "Ciphertext" }) + Text_Based_Test("pubkey/mce.vec", + "McElieceSeed,KeyN,KeyT,PublicKeyFingerprint,PrivateKeyFingerprint," + "EncryptPRNGSeed,SharedKey,Ciphertext", + "") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp index 3926cd4d5..480b15527 100644 --- a/src/tests/test_modes.cpp +++ b/src/tests/test_modes.cpp @@ -19,7 +19,7 @@ class Cipher_Mode_Tests : public Text_Based_Test { public: Cipher_Mode_Tests() : - Text_Based_Test("modes", {"Key", "Nonce", "In", "Out"}) + Text_Based_Test("modes", "Key,Nonce,In,Out") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override diff --git a/src/tests/test_newhope.cpp b/src/tests/test_newhope.cpp index 3d470597c..ddd5a8101 100644 --- a/src/tests/test_newhope.cpp +++ b/src/tests/test_newhope.cpp @@ -89,7 +89,10 @@ class NEWHOPE_RNG : public Botan::RandomNumberGenerator class NEWHOPE_Tests : public Text_Based_Test { public: - NEWHOPE_Tests() : Text_Based_Test("pubkey/newhope.vec", {"DRBG_SeedA", "H_OutputA", "DRBG_SeedB", "H_OutputB", "SharedKey"}) {} + NEWHOPE_Tests() : Text_Based_Test( + "pubkey/newhope.vec", + "DRBG_SeedA,H_OutputA,DRBG_SeedB,H_OutputB,SharedKey") + {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { diff --git a/src/tests/test_ocb.cpp b/src/tests/test_ocb.cpp index b9195a4e6..c477ed3a3 100644 --- a/src/tests/test_ocb.cpp +++ b/src/tests/test_ocb.cpp @@ -21,7 +21,7 @@ class OCB_Long_KAT_Tests : public Text_Based_Test { public: OCB_Long_KAT_Tests() : Text_Based_Test("ocb_long.vec", - {"Keylen", "Taglen", "Output"}) {} + "Keylen,Taglen,Output") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { diff --git a/src/tests/test_pad.cpp b/src/tests/test_pad.cpp index c27e2607f..1eb8b615f 100644 --- a/src/tests/test_pad.cpp +++ b/src/tests/test_pad.cpp @@ -18,7 +18,7 @@ class Cipher_Mode_Padding_Tests : public Text_Based_Test { public: Cipher_Mode_Padding_Tests() : - Text_Based_Test("", "pad.vec", {"In", "Blocksize"}, {"Out"}) + Text_Based_Test("pad.vec", "In,Blocksize", "Out") {} Test::Result run_one_test(const std::string& header, const VarMap& vars) override diff --git a/src/tests/test_passhash.cpp b/src/tests/test_passhash.cpp index a77fe6532..bfd17a443 100644 --- a/src/tests/test_passhash.cpp +++ b/src/tests/test_passhash.cpp @@ -22,7 +22,7 @@ namespace { class Bcrypt_Tests : public Text_Based_Test { public: - Bcrypt_Tests() : Text_Based_Test("bcrypt.vec", {"Password","Passhash"}) {} + Bcrypt_Tests() : Text_Based_Test("bcrypt.vec", "Password,Passhash") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { @@ -56,7 +56,7 @@ BOTAN_REGISTER_TEST("bcrypt", Bcrypt_Tests); class Passhash9_Tests : public Text_Based_Test { public: - Passhash9_Tests() : Text_Based_Test("passhash9.vec", {"Password","Passhash"}) {} + Passhash9_Tests() : Text_Based_Test("passhash9.vec", "Password,Passhash") {} Test::Result run_one_test(const std::string&, const VarMap& vars) override { diff --git a/src/tests/test_pbkdf.cpp b/src/tests/test_pbkdf.cpp index 0ff502a9a..a4db5d8e0 100644 --- a/src/tests/test_pbkdf.cpp +++ b/src/tests/test_pbkdf.cpp @@ -19,7 +19,7 @@ class PBKDF_KAT_Tests : public Text_Based_Test { public: PBKDF_KAT_Tests() : Text_Based_Test("pbkdf", - {"OutputLen", "Iterations", "Salt", "Passphrase", "Output"}) + "OutputLen,Iterations,Salt,Passphrase,Output") {} Test::Result run_one_test(const std::string& pbkdf_name, const VarMap& vars) override diff --git a/src/tests/test_pk_pad.cpp b/src/tests/test_pk_pad.cpp index d237b7561..33277da2b 100644 --- a/src/tests/test_pk_pad.cpp +++ b/src/tests/test_pk_pad.cpp @@ -20,8 +20,8 @@ class EME_Decoding_Tests : public Text_Based_Test public: EME_Decoding_Tests() : Text_Based_Test("pk_pad_eme", - std::vector<std::string>{"RawCiphertext","ValidInput"}, - std::vector<std::string>{"Plaintext"}) {} + "RawCiphertext,ValidInput", + "Plaintext") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override { diff --git a/src/tests/test_pubkey.h b/src/tests/test_pubkey.h index 35457f67a..b86b98bf9 100644 --- a/src/tests/test_pubkey.h +++ b/src/tests/test_pubkey.h @@ -17,14 +17,31 @@ namespace Botan_Tests { -class PK_Signature_Generation_Test : public Text_Based_Test +class PK_Test : public Text_Based_Test + { + public: + PK_Test(const std::string& algo, + const std::string& test_src, + const std::string& required_keys, + const std::string& optional_keys = {}) : + Text_Based_Test(test_src, required_keys, optional_keys), + m_algo(algo) + {} + + std::string algo_name() const { return m_algo; } + + private: + std::string m_algo; + }; + +class PK_Signature_Generation_Test : public PK_Test { public: PK_Signature_Generation_Test(const std::string& algo, const std::string& test_src, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys = {}) : - Text_Based_Test(algo, test_src, required_keys, optional_keys) {} + const std::string& required_keys, + const std::string& optional_keys = "") : + PK_Test(algo, test_src, required_keys, optional_keys) {} virtual std::string default_padding(const VarMap&) const { @@ -35,21 +52,21 @@ class PK_Signature_Generation_Test : public Text_Based_Test virtual Botan::RandomNumberGenerator* test_rng(const std::vector<uint8_t>& nonce) const { - return new Fixed_Output_RNG(nonce); + return new Fixed_Output_RNG(nonce); } private: Test::Result run_one_test(const std::string&, const VarMap& vars) override; }; -class PK_Signature_Verification_Test : public Text_Based_Test +class PK_Signature_Verification_Test : public PK_Test { public: PK_Signature_Verification_Test(const std::string& algo, const std::string& test_src, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys = {}) : - Text_Based_Test(algo, test_src, required_keys, optional_keys) {} + const std::string& required_keys, + const std::string& optional_keys = "") : + PK_Test(algo, test_src, required_keys, optional_keys) {} virtual std::string default_padding(const VarMap&) const { @@ -61,14 +78,14 @@ class PK_Signature_Verification_Test : public Text_Based_Test Test::Result run_one_test(const std::string& header, const VarMap& vars) override; }; -class PK_Encryption_Decryption_Test : public Text_Based_Test +class PK_Encryption_Decryption_Test : public PK_Test { public: PK_Encryption_Decryption_Test(const std::string& algo, const std::string& test_src, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys = {}) : - Text_Based_Test(algo, test_src, required_keys, optional_keys) {} + const std::string& required_keys, + const std::string& optional_keys = "") : + PK_Test(algo, test_src, required_keys, optional_keys) {} virtual std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) = 0; @@ -77,14 +94,14 @@ class PK_Encryption_Decryption_Test : public Text_Based_Test Test::Result run_one_test(const std::string& header, const VarMap& vars) override; }; -class PK_Key_Agreement_Test : public Text_Based_Test +class PK_Key_Agreement_Test : public PK_Test { public: PK_Key_Agreement_Test(const std::string& algo, const std::string& test_src, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys = {}) : - Text_Based_Test(algo, test_src, required_keys, optional_keys) {} + const std::string& required_keys, + const std::string& optional_keys = "") : + PK_Test(algo, test_src, required_keys, optional_keys) {} virtual std::unique_ptr<Botan::Private_Key> load_our_key(const std::string& header, const VarMap& vars) = 0; @@ -98,16 +115,14 @@ class PK_Key_Agreement_Test : public Text_Based_Test Test::Result run_one_test(const std::string& header, const VarMap& vars) override; }; -class PK_KEM_Test : public Text_Based_Test +class PK_KEM_Test : public PK_Test { public: - //using Text_Based_Test::Text_Based_Test; - PK_KEM_Test(const std::string& algo, const std::string& test_src, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys = {}) : - Text_Based_Test(algo, test_src, required_keys, optional_keys) {} + const std::string& required_keys, + const std::string& optional_keys = "") : + PK_Test(algo, test_src, required_keys, optional_keys) {} virtual std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) = 0; private: diff --git a/src/tests/test_rfc6979.cpp b/src/tests/test_rfc6979.cpp index 8076ae70d..e7605b580 100644 --- a/src/tests/test_rfc6979.cpp +++ b/src/tests/test_rfc6979.cpp @@ -22,8 +22,7 @@ namespace { class RFC6979_KAT_Tests : public Text_Based_Test { public: - RFC6979_KAT_Tests() : Text_Based_Test("rfc6979.vec", - {"Q", "X", "H", "K"}) {} + RFC6979_KAT_Tests() : Text_Based_Test("rfc6979.vec", "Q,X,H,K") {} Test::Result run_one_test(const std::string& hash, const VarMap& vars) override { diff --git a/src/tests/test_rng.cpp b/src/tests/test_rng.cpp index 25640f726..1b51b2fad 100644 --- a/src/tests/test_rng.cpp +++ b/src/tests/test_rng.cpp @@ -37,8 +37,8 @@ class HMAC_DRBG_Tests : public Text_Based_Test { public: HMAC_DRBG_Tests() : Text_Based_Test("hmac_drbg.vec", - {"EntropyInput", "EntropyInputReseed", "Out"}, - {"AdditionalInput1", "AdditionalInput2"}) {} + "EntropyInput,EntropyInputReseed,Out", + "AdditionalInput1,AdditionalInput2") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override { diff --git a/src/tests/test_rsa.cpp b/src/tests/test_rsa.cpp index 5feb8a14f..af37a2afb 100644 --- a/src/tests/test_rsa.cpp +++ b/src/tests/test_rsa.cpp @@ -23,8 +23,8 @@ class RSA_ES_KAT_Tests : public PK_Encryption_Decryption_Test RSA_ES_KAT_Tests() : PK_Encryption_Decryption_Test( "RSA", "pubkey/rsaes.vec", - {"E", "P", "Q", "Msg", "Ciphertext"}, - {"Padding", "Nonce"}) + "E,P,Q,Msg,Ciphertext", + "Padding,Nonce") {} std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override @@ -41,8 +41,10 @@ class RSA_ES_KAT_Tests : public PK_Encryption_Decryption_Test class RSA_KEM_Tests : public PK_KEM_Test { public: - RSA_KEM_Tests() : PK_KEM_Test("RSA", "pubkey/rsa_kem.vec", - {"E", "P", "Q", "R", "C0", "KDF", "OutLen", "K"}) + RSA_KEM_Tests() : PK_KEM_Test( + "RSA", + "pubkey/rsa_kem.vec", + "E,P,Q,R,C0,KDF,OutLen,K") {} std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override @@ -63,8 +65,8 @@ class RSA_Signature_KAT_Tests : public PK_Signature_Generation_Test RSA_Signature_KAT_Tests() : PK_Signature_Generation_Test( "RSA", "pubkey/rsa_sig.vec", - {"E", "P", "Q", "Msg", "Signature"}, - {"Padding", "Nonce"}) + "E,P,Q,Msg,Signature", + "Padding,Nonce") {} std::string default_padding(const VarMap&) const override { return "Raw"; } @@ -86,8 +88,8 @@ class RSA_Signature_Verify_Tests : public PK_Signature_Verification_Test RSA_Signature_Verify_Tests() : PK_Signature_Verification_Test( "RSA", "pubkey/rsa_verify.vec", - {"E", "N", "Msg", "Signature"}, - {"Padding"}) + "E,N,Msg,Signature", + "Padding") {} std::string default_padding(const VarMap&) const override { return "Raw"; } diff --git a/src/tests/test_stream.cpp b/src/tests/test_stream.cpp index 0af0be12c..9250f4e2f 100644 --- a/src/tests/test_stream.cpp +++ b/src/tests/test_stream.cpp @@ -17,8 +17,7 @@ namespace Botan_Tests { class Stream_Cipher_Tests : public Text_Based_Test { public: - Stream_Cipher_Tests(): Text_Based_Test("stream", - std::vector<std::string>{"Key", "Out"}, {"In", "Nonce", "Seek"}) {} + Stream_Cipher_Tests(): Text_Based_Test("stream", "Key,Out", "In,Nonce,Seek") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override { diff --git a/src/tests/test_tls_messages.cpp b/src/tests/test_tls_messages.cpp index 250ce23f5..66c422909 100644 --- a/src/tests/test_tls_messages.cpp +++ b/src/tests/test_tls_messages.cpp @@ -46,7 +46,7 @@ class TLS_Message_Parsing_Test : public Text_Based_Test { public: TLS_Message_Parsing_Test() : - Text_Based_Test("tls", {"Buffer", "Protocol", "Ciphersuite", "AdditionalData", "Exception"}) + Text_Based_Test("tls", "Buffer,Protocol,Ciphersuite,AdditionalData,Exception") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp index 6edd7fd81..d4d8bc0da 100644 --- a/src/tests/test_utils.cpp +++ b/src/tests/test_utils.cpp @@ -23,8 +23,7 @@ namespace { class Utility_Function_Tests : public Text_Based_Test { public: - Utility_Function_Tests() : Text_Based_Test("util.vec", - {"In1","In2","Out"}) + Utility_Function_Tests() : Text_Based_Test("util.vec","In1,In2,Out") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override @@ -179,8 +178,7 @@ BOTAN_REGISTER_TEST("util", Utility_Function_Tests); class Date_Format_Tests : public Text_Based_Test { public: - Date_Format_Tests() : Text_Based_Test("dates.vec", - std::vector<std::string>{"Date"}) + Date_Format_Tests() : Text_Based_Test("dates.vec", "Date") {} std::vector<uint32_t> parse_date(const std::string& s) @@ -250,10 +248,7 @@ BOTAN_REGISTER_TEST("util_dates", Date_Format_Tests); class Base64_Tests : public Text_Based_Test { public: - Base64_Tests() : Text_Based_Test("base64.vec", - std::vector<std::string>({"Base64"}), - {"Binary"}) - {} + Base64_Tests() : Text_Based_Test("base64.vec", "Base64", "Binary") {} Test::Result run_one_test(const std::string& type, const VarMap& vars) override { @@ -331,8 +326,7 @@ BOTAN_REGISTER_TEST("base64", Base64_Tests); class Charset_Tests : public Text_Based_Test { public: - Charset_Tests() : Text_Based_Test("charset.vec", - { "In","Out" }) + Charset_Tests() : Text_Based_Test("charset.vec", "In,Out") {} Test::Result run_one_test(const std::string& type, const VarMap& vars) override diff --git a/src/tests/test_workfactor.cpp b/src/tests/test_workfactor.cpp index b0a140692..a9f9fd062 100644 --- a/src/tests/test_workfactor.cpp +++ b/src/tests/test_workfactor.cpp @@ -16,8 +16,8 @@ namespace Botan_Tests { class PK_Workfactor_Tests : public Text_Based_Test { public: - PK_Workfactor_Tests() : Text_Based_Test("pubkey/workfactor.vec", - {"ParamSize", "Workfactor"}) + PK_Workfactor_Tests() : + Text_Based_Test("pubkey/workfactor.vec", "ParamSize,Workfactor") {} Test::Result run_one_test(const std::string& type, const VarMap& vars) override diff --git a/src/tests/test_xmss.cpp b/src/tests/test_xmss.cpp index 4e6483ba1..73b23483e 100644 --- a/src/tests/test_xmss.cpp +++ b/src/tests/test_xmss.cpp @@ -24,8 +24,7 @@ class XMSS_Signature_Tests : public PK_Signature_Generation_Test XMSS_Signature_Tests() : PK_Signature_Generation_Test( "XMSS", "pubkey/xmss_sig.vec", - {"Params", "Msg", "PrivateKey", "Signature"}, - {}) + "Params,Msg,PrivateKey,Signature") {} std::string default_padding(const VarMap& vars) const override @@ -49,8 +48,7 @@ class XMSS_Signature_Verify_Tests : public PK_Signature_Verification_Test XMSS_Signature_Verify_Tests() : PK_Signature_Verification_Test( "XMSS", "pubkey/xmss_verify.vec", - {"Params", "Msg", "PublicKey", "Signature"}, - {}) + "Params,Msg,PublicKey,Signature") {} std::string default_padding(const VarMap& vars) const override diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index b78b7a2e2..81da95736 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -547,27 +547,15 @@ std::string Test::random_password() } Text_Based_Test::Text_Based_Test(const std::string& data_src, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys) : + const std::string& required_keys_str, + const std::string& optional_keys_str) : m_data_src(data_src) { - if(required_keys.empty()) + if(required_keys_str.empty()) throw Test_Error("Invalid test spec"); - m_required_keys.insert(required_keys.begin(), required_keys.end()); - m_optional_keys.insert(optional_keys.begin(), optional_keys.end()); - m_output_key = required_keys.at(required_keys.size() - 1); - } - -Text_Based_Test::Text_Based_Test(const std::string& algo, - const std::string& data_src, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys) : - m_algo(algo), - m_data_src(data_src) - { - if(required_keys.empty()) - throw Test_Error("Invalid test spec"); + std::vector<std::string> required_keys = Botan::split_on(required_keys_str, ','); + std::vector<std::string> optional_keys = Botan::split_on(optional_keys_str, ','); m_required_keys.insert(required_keys.begin(), required_keys.end()); m_optional_keys.insert(optional_keys.begin(), optional_keys.end()); diff --git a/src/tests/tests.h b/src/tests/tests.h index 51b59d972..ce6431e35 100644 --- a/src/tests/tests.h +++ b/src/tests/tests.h @@ -408,13 +408,8 @@ class Text_Based_Test : public Test { public: Text_Based_Test(const std::string& input_file, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys = {}); - - Text_Based_Test(const std::string& algo, - const std::string& input_file, - const std::vector<std::string>& required_keys, - const std::vector<std::string>& optional_keys = {}); + const std::string& required_keys, + const std::string& optional_keys = ""); virtual bool clear_between_callbacks() const { return true; } @@ -444,10 +439,7 @@ class Text_Based_Test : public Test size_t get_req_sz(const VarMap& vars, const std::string& key) const; size_t get_opt_sz(const VarMap& vars, const std::string& key, const size_t def_value) const; - - std::string algo_name() const { return m_algo; } private: - std::string m_algo; std::string m_data_src; std::set<std::string> m_required_keys; std::set<std::string> m_optional_keys; |