aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pbkdf/pbkdf.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-22 18:49:30 -0400
committerJack Lloyd <[email protected]>2017-09-22 18:49:30 -0400
commitf8f2912d24bad8b162b89e34ab62c415aef98843 (patch)
treef318dc75953a8b92fef0420855ea3cdcd40ca265 /src/lib/pbkdf/pbkdf.cpp
parent00bf32562653b468b1b7a2b3ed3eb10f95bf230e (diff)
Cryptobox code modernization
Only encrypt so it's easy to verify everything still works.
Diffstat (limited to 'src/lib/pbkdf/pbkdf.cpp')
-rw-r--r--src/lib/pbkdf/pbkdf.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/pbkdf/pbkdf.cpp b/src/lib/pbkdf/pbkdf.cpp
index 40610998b..d2dfc3d41 100644
--- a/src/lib/pbkdf/pbkdf.cpp
+++ b/src/lib/pbkdf/pbkdf.cpp
@@ -68,6 +68,18 @@ std::unique_ptr<PBKDF> PBKDF::create(const std::string& algo_spec,
return nullptr;
}
+//static
+std::unique_ptr<PBKDF>
+PBKDF::create_or_throw(const std::string& algo,
+ const std::string& provider)
+ {
+ if(auto pbkdf = PBKDF::create(algo, provider))
+ {
+ return pbkdf;
+ }
+ throw Lookup_Error("PBKDF", algo, provider);
+ }
+
std::vector<std::string> PBKDF::providers(const std::string& algo_spec)
{
return probe_providers_of<PBKDF>(algo_spec, { "base", "openssl" });