aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/kdf/kdf.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-05-06 16:33:37 -0400
committerJack Lloyd <[email protected]>2017-05-06 16:33:37 -0400
commit2a351e58a23cf3113342ce07b3d8baa8c235c94f (patch)
tree527eb6a70607e7603af075e8c1434e76f0a86f8f /src/lib/kdf/kdf.cpp
parent96bb42fcc3082867baf2a4820e2a452af4916f22 (diff)
parent6e088a36210f620352e07f6f52a047a813dab1a3 (diff)
Merge GH #1040 Add SP800-56A KDF
Diffstat (limited to 'src/lib/kdf/kdf.cpp')
-rw-r--r--src/lib/kdf/kdf.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/kdf/kdf.cpp b/src/lib/kdf/kdf.cpp
index 0e9d840c1..695523d8e 100644
--- a/src/lib/kdf/kdf.cpp
+++ b/src/lib/kdf/kdf.cpp
@@ -42,6 +42,10 @@
#include <botan/sp800_108.h>
#endif
+#if defined(BOTAN_HAS_SP800_56A)
+#include <botan/sp800_56a.h>
+#endif
+
#if defined(BOTAN_HAS_SP800_56C)
#include <botan/sp800_56c.h>
#endif
@@ -185,6 +189,16 @@ std::unique_ptr<KDF> KDF::create(const std::string& algo_spec,
}
#endif
+#if defined(BOTAN_HAS_SP800_56A)
+ if(req.algo_name() == "SP800-56A" && req.arg_count() == 1)
+ {
+ if(auto hash = HashFunction::create(req.arg(0)))
+ return std::unique_ptr<KDF>(new SP800_56A<HashFunction>(hash.release()));
+ if(auto mac = MessageAuthenticationCode::create(req.arg(0)))
+ return std::unique_ptr<KDF>(new SP800_56A<MessageAuthenticationCode>(mac.release()));
+ }
+#endif
+
#if defined(BOTAN_HAS_SP800_56C)
if(req.algo_name() == "SP800-56C" && req.arg_count() == 1)
{