aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/tests.cpp
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2016-12-20 18:29:00 +0100
committerRenĂ© Korthaus <[email protected]>2017-01-02 10:39:37 +0100
commitcea400532dde96207a383912060cf0a2f4a247f5 (patch)
tree206a082a1c41f5a21c311ef5d8795fd62ea9b673 /src/tests/tests.cpp
parent6e4bd1f365a98517397aa11a44006c9ebd934bec (diff)
Add positive DH test vectors from NIST CAVP
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r--src/tests/tests.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index a6b6bf802..e18603b2d 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -672,6 +672,27 @@ Botan::BigInt Text_Based_Test::get_req_bn(const VarMap& vars,
throw Test_Error("Test invalid bigint input '" + i->second + "' for key " + key);
}
}
+
+Botan::BigInt Text_Based_Test::get_opt_bn(const VarMap& vars,
+ const std::string& key,
+ const Botan::BigInt& def_value) const
+
+ {
+ auto i = vars.find(key);
+ if(i == vars.end())
+ {
+ return def_value;
+ }
+
+ try
+ {
+ return Botan::BigInt(i->second);
+ }
+ catch(std::exception&)
+ {
+ throw Test_Error("Test invalid bigint input '" + i->second + "' for key " + key);
+ }
+ }
#endif
std::string Text_Based_Test::get_next_line()