diff options
author | René Korthaus <[email protected]> | 2016-11-12 20:30:40 +0100 |
---|---|---|
committer | René Korthaus <[email protected]> | 2016-11-12 20:30:40 +0100 |
commit | da497797cc7de2b64b63006a0108f785e4a360c1 (patch) | |
tree | 4e4f09e862d3a1ce14217694ff77c5e90ccc1885 /src/lib/kdf/kdf.cpp | |
parent | 37c1a62525c74461693789f983a41c80697ff4a3 (diff) |
Add full HKDF implementation
Adds the full HKDF as class HKDF, renames the existing HKDF,
which only implemented the expansion step, to HKDF_Expand
and adds the extraction step as HKDF_Extract.
The latter two are usually only used seperately in
protocols such as TLS. A normal user would go for the
full HKDF.
Diffstat (limited to 'src/lib/kdf/kdf.cpp')
-rw-r--r-- | src/lib/kdf/kdf.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/kdf/kdf.cpp b/src/lib/kdf/kdf.cpp index 94694c70c..501f81717 100644 --- a/src/lib/kdf/kdf.cpp +++ b/src/lib/kdf/kdf.cpp @@ -77,6 +77,22 @@ std::unique_ptr<KDF> KDF::create(const std::string& algo_spec, return kdf_create_mac_or_hash<HKDF>(req.arg(0)); } } + + if(req.algo_name() == "HKDF_Extract" && req.arg_count() == 1) + { + if(provider.empty() || provider == "base") + { + return kdf_create_mac_or_hash<HKDF_Extract>(req.arg(0)); + } + } + + if(req.algo_name() == "HKDF_Expand" && req.arg_count() == 1) + { + if(provider.empty() || provider == "base") + { + return kdf_create_mac_or_hash<HKDF_Expand>(req.arg(0)); + } + } #endif #if defined(BOTAN_HAS_KDF2) |