71std::unique_ptr<KDF>
KDF::create(std::string_view algo_spec, std::string_view provider) {
74#if defined(BOTAN_HAS_HKDF)
76 if(provider.empty() || provider ==
"base") {
77 return kdf_create_mac_or_hash<HKDF>(req.
arg(0));
82 if(provider.empty() || provider ==
"base") {
83 return kdf_create_mac_or_hash<HKDF_Extract>(req.
arg(0));
88 if(provider.empty() || provider ==
"base") {
89 return kdf_create_mac_or_hash<HKDF_Expand>(req.
arg(0));
94#if defined(BOTAN_HAS_KDF2)
96 if(provider.empty() || provider ==
"base") {
98 return std::make_unique<KDF2>(std::move(hash));
104#if defined(BOTAN_HAS_KDF1_18033)
106 if(provider.empty() || provider ==
"base") {
108 return std::make_unique<KDF1_18033>(std::move(hash));
114#if defined(BOTAN_HAS_KDF1)
116 if(provider.empty() || provider ==
"base") {
118 return std::make_unique<KDF1>(std::move(hash));
124#if defined(BOTAN_HAS_TLS_V12_PRF)
126 if(provider.empty() || provider ==
"base") {
127 return kdf_create_mac_or_hash<TLS_12_PRF>(req.
arg(0));
132#if defined(BOTAN_HAS_X942_PRF)
134 if(provider.empty() || provider ==
"base") {
135 return std::make_unique<X942_PRF>(req.
arg(0));
140#if defined(BOTAN_HAS_SP800_108)
142 if(provider.empty() || provider ==
"base") {
143 return kdf_create_mac_or_hash<SP800_108_Counter>(req.
arg(0));
148 if(provider.empty() || provider ==
"base") {
149 return kdf_create_mac_or_hash<SP800_108_Feedback>(req.
arg(0));
154 if(provider.empty() || provider ==
"base") {
155 return kdf_create_mac_or_hash<SP800_108_Pipeline>(req.
arg(0));
160#if defined(BOTAN_HAS_SP800_56A)
163 return std::make_unique<SP800_56C_One_Step_Hash>(std::move(hash));
165 if(req.
arg(0) ==
"KMAC-128") {
166 return std::make_unique<SP800_56C_One_Step_KMAC128>();
168 if(req.
arg(0) ==
"KMAC-256") {
169 return std::make_unique<SP800_56C_One_Step_KMAC256>();
172 return std::make_unique<SP800_56C_One_Step_HMAC>(std::move(mac));
177#if defined(BOTAN_HAS_SP800_56C)
179 std::unique_ptr<KDF> exp(kdf_create_mac_or_hash<SP800_108_Feedback>(req.
arg(0)));
182 return std::make_unique<SP800_56C_Two_Step>(std::move(mac), std::move(exp));
186 return std::make_unique<SP800_56C_Two_Step>(std::move(mac), std::move(exp));
virtual void kdf(uint8_t key[], size_t key_len, const uint8_t secret[], size_t secret_len, const uint8_t salt[], size_t salt_len, const uint8_t label[], size_t label_len) const =0