aboutsummaryrefslogtreecommitdiffstats
path: root/src/selftest
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-17 21:48:55 +0000
committerlloyd <[email protected]>2010-06-17 21:48:55 +0000
commitc06b260b3328c5ce4be44c4f1a88feb55ee3dbc4 (patch)
tree41b05df5982b5b2e8a23b55972263d2172d6a9fd /src/selftest
parent0eecae9f21172c0a74ad62acaf77148c94a25be7 (diff)
parent3dde5683f69b9cb9f558bfb18087ce35fbbec78a (diff)
propagate from branch 'net.randombit.botan' (head 294e2082ce9231d6165276e2f2a4153a0116aca3)
to branch 'net.randombit.botan.c++0x' (head 0b695fad10f924601e07b009fcd781191fafcb28)
Diffstat (limited to 'src/selftest')
-rw-r--r--src/selftest/selftest.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/selftest/selftest.cpp b/src/selftest/selftest.cpp
index a11accbd3..783fa3b00 100644
--- a/src/selftest/selftest.cpp
+++ b/src/selftest/selftest.cpp
@@ -49,8 +49,9 @@ algorithm_kat(const SCAN_Name& algo_name,
const std::string input = search_map(vars, std::string("input"));
const std::string output = search_map(vars, std::string("output"));
- const std::string key = search_map(vars, std::string("key"));
- const std::string iv = search_map(vars, std::string("iv"));
+
+ SymmetricKey key(search_map(vars, std::string("key")));
+ InitializationVector iv(search_map(vars, std::string("iv")));
for(u32bit i = 0; i != providers.size(); ++i)
{
@@ -96,10 +97,18 @@ algorithm_kat(const SCAN_Name& algo_name,
}
enc->set_key(key);
- enc->set_iv(iv);
+
+ if(enc->valid_iv_length(iv.length()))
+ enc->set_iv(iv);
+ else if(!enc->valid_iv_length(0))
+ throw Invalid_IV_Length(algo, iv.length());
dec->set_key(key);
- dec->set_iv(iv);
+
+ if(dec->valid_iv_length(iv.length()))
+ dec->set_iv(iv);
+ else if(!dec->valid_iv_length(0))
+ throw Invalid_IV_Length(algo, iv.length());
bool enc_ok = test_filter_kat(enc, input, output);
bool dec_ok = test_filter_kat(dec, output, input);