diff options
author | Jack Lloyd <[email protected]> | 2016-11-26 11:38:01 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-26 11:38:01 -0500 |
commit | 345f0881bc44b7a8344ea943e96b1dad4a8d484b (patch) | |
tree | d7d30b2e13abe660713eafed3e034ebf1494e7f8 /src/tests/test_pbkdf.cpp | |
parent | d695dfadc0daf8290d344f82697d456fd011d153 (diff) |
Add test for various functions previously missed (T::clone, PBKDF::name, AEAD::output_length)
Fix a bug in CCM, GCM, and OCB decryption which caused `output_length(tag_size())`
to fail even though empty plaintexts are certainly defined for all three modes.
Diffstat (limited to 'src/tests/test_pbkdf.cpp')
-rw-r--r-- | src/tests/test_pbkdf.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/tests/test_pbkdf.cpp b/src/tests/test_pbkdf.cpp index 393a96243..af2cdd498 100644 --- a/src/tests/test_pbkdf.cpp +++ b/src/tests/test_pbkdf.cpp @@ -24,6 +24,12 @@ class PBKDF_KAT_Tests : public Text_Based_Test Test::Result run_one_test(const std::string& pbkdf_name, const VarMap& vars) override { + const size_t outlen = get_req_sz(vars, "OutputLen"); + const size_t iterations = get_req_sz(vars, "Iterations"); + const std::vector<uint8_t> salt = get_req_bin(vars, "Salt"); + const std::string passphrase = get_req_str(vars, "Passphrase"); + const std::vector<uint8_t> expected = get_req_bin(vars, "Output"); + Test::Result result(pbkdf_name); std::unique_ptr<Botan::PBKDF> pbkdf(Botan::PBKDF::create(pbkdf_name)); @@ -33,11 +39,7 @@ class PBKDF_KAT_Tests : public Text_Based_Test return result; } - const size_t outlen = get_req_sz(vars, "OutputLen"); - const size_t iterations = get_req_sz(vars, "Iterations"); - const std::vector<uint8_t> salt = get_req_bin(vars, "Salt"); - const std::string passphrase = get_req_str(vars, "Passphrase"); - const std::vector<uint8_t> expected = get_req_bin(vars, "Output"); + result.test_eq("Expected name", pbkdf->name(), pbkdf_name); const Botan::secure_vector<byte> derived = pbkdf->derive_key(outlen, passphrase, salt.data(), salt.size(), iterations).bits_of(); |