aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_modes.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-07 11:03:55 +0000
committerlloyd <[email protected]>2014-01-07 11:03:55 +0000
commitc109c7f84fcef6ba895c6293508b2deae0e803c1 (patch)
tree35ba7b55914023a77ecfbcf5dee2befcc4e275d1 /src/tests/test_modes.cpp
parenta7e3abf95fd1bc3df45be6fc9cb82e28e0a727ea (diff)
Rename test sources
Diffstat (limited to 'src/tests/test_modes.cpp')
-rw-r--r--src/tests/test_modes.cpp87
1 files changed, 0 insertions, 87 deletions
diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp
deleted file mode 100644
index 30c3c92db..000000000
--- a/src/tests/test_modes.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "tests.h"
-
-#include <botan/hex.h>
-#include <botan/lookup.h>
-#include <botan/cipher_mode.h>
-#include <botan/filters.h>
-#include <iostream>
-#include <fstream>
-#include <memory>
-
-using namespace Botan;
-
-namespace {
-
-secure_vector<byte> run_mode(const std::string& algo,
- Cipher_Dir dir,
- const secure_vector<byte>& pt,
- const secure_vector<byte>& nonce,
- const secure_vector<byte>& key)
- {
-#if 0
- std::unique_ptr<Cipher_Mode> cipher(get_cipher(algo, dir));
-
- cipher->set_key(key);
- cipher->start_vec(nonce);
-
- secure_vector<byte> ct = pt;
- cipher->finish(ct);
-#endif
-
- Pipe pipe(get_cipher(algo, SymmetricKey(key), InitializationVector(nonce), dir));
-
- pipe.process_msg(pt);
-
- return pipe.read_all();
- }
-
-size_t mode_test(const std::string& algo,
- const std::string& pt,
- const std::string& ct,
- const std::string& key_hex,
- const std::string& nonce_hex)
- {
- auto nonce = hex_decode_locked(nonce_hex);
- auto key = hex_decode_locked(key_hex);
-
- size_t fails = 0;
-
- const std::string ct2 = hex_encode(run_mode(algo,
- ENCRYPTION,
- hex_decode_locked(pt),
- nonce,
- key));
-
- if(ct != ct2)
- {
- std::cout << algo << " got ct " << ct2 << " expected " << ct << "\n";
- ++fails;
- }
-
- const std::string pt2 = hex_encode(run_mode(algo,
- DECRYPTION,
- hex_decode_locked(ct),
- nonce,
- key));
-
- if(pt != pt2)
- {
- std::cout << algo << " got pt " << pt2 << " expected " << pt << "\n";
- ++fails;
- }
-
- return fails;
- }
-
-}
-
-size_t test_modes()
- {
- std::ifstream vec(TEST_DATA_DIR "/modes.vec");
-
- return run_tests_bb(vec, "Mode", "Out", true,
- [](std::map<std::string, std::string> m)
- {
- return mode_test(m["Mode"], m["In"], m["Out"], m["Key"], m["Nonce"]);
- });
- }