aboutsummaryrefslogtreecommitdiffstats
path: root/src/selftest
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-03-27 16:49:14 +0000
committerlloyd <[email protected]>2013-03-27 16:49:14 +0000
commit91840883da6009ee17c81749e5077e610532654d (patch)
treea5c055eaebf80efbd9240f1694534102bd13f583 /src/selftest
parente7d24d7884025c2051450a9c9d9ce0f944a8fa4a (diff)
Fix macro check in selftest
Diffstat (limited to 'src/selftest')
-rw-r--r--src/selftest/info.txt1
-rw-r--r--src/selftest/selftest.cpp18
2 files changed, 9 insertions, 10 deletions
diff --git a/src/selftest/info.txt b/src/selftest/info.txt
index 1a53ea021..e4e9f28dc 100644
--- a/src/selftest/info.txt
+++ b/src/selftest/info.txt
@@ -3,5 +3,6 @@ define SELFTESTS
<requires>
algo_factory
filters
+aead_filt
core_engine
</requires>
diff --git a/src/selftest/selftest.cpp b/src/selftest/selftest.cpp
index 4be4f8751..b989d889d 100644
--- a/src/selftest/selftest.cpp
+++ b/src/selftest/selftest.cpp
@@ -12,8 +12,6 @@
#include <botan/internal/core_engine.h>
#include <botan/internal/stl_util.h>
-#include <iostream>
-
namespace Botan {
namespace {
@@ -126,18 +124,18 @@ algorithm_kat_detailed(const SCAN_Name& algo_name,
else if(!dec->valid_iv_length(0))
throw Invalid_IV_Length(algo, iv.length());
-#if defined(BOTAN_HAS_AEAD)
+ const std::vector<byte> ad = hex_decode(search_map(vars, std::string("ad")));
- if(AEAD_Filter* enc_aead = dynamic_cast<AEAD_Filter*>(enc))
+ if(!ad.empty())
{
- const std::vector<byte> ad = hex_decode(search_map(vars, std::string("ad")));
-
- enc_aead->set_associated_data(&ad[0], ad.size());
+ if(AEAD_Filter* enc_aead = dynamic_cast<AEAD_Filter*>(enc))
+ {
+ enc_aead->set_associated_data(&ad[0], ad.size());
- if(AEAD_Filter* dec_aead = dynamic_cast<AEAD_Filter*>(dec))
- dec_aead->set_associated_data(&ad[0], ad.size());
+ if(AEAD_Filter* dec_aead = dynamic_cast<AEAD_Filter*>(dec))
+ dec_aead->set_associated_data(&ad[0], ad.size());
+ }
}
-#endif
all_results[provider + " (encrypt)"] = test_filter_kat(enc, input, output);
all_results[provider + " (decrypt)"] = test_filter_kat(dec, output, input);