blob: 836e9b9821f2bee3317595a8acd10bb349b50b2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/*
* KDF Retrieval
* (C) 1999-2007 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#include <botan/kdf.h>
#include <botan/internal/kdf_utils.h>
#if defined(BOTAN_HAS_HKDF)
#include <botan/hkdf.h>
#endif
#if defined(BOTAN_HAS_KDF1)
#include <botan/kdf1.h>
#endif
#if defined(BOTAN_HAS_KDF2)
#include <botan/kdf2.h>
#endif
#if defined(BOTAN_HAS_TLS_V10_PRF)
#include <botan/prf_tls.h>
#endif
#if defined(BOTAN_HAS_TLS_V12_PRF)
#include <botan/prf_tls.h>
#endif
#if defined(BOTAN_HAS_X942_PRF)
#include <botan/prf_x942.h>
#endif
namespace Botan {
KDF::~KDF() {}
KDF* get_kdf(const std::string& algo_spec)
{
SCAN_Name request(algo_spec);
if(request.algo_name() == "Raw")
return nullptr; // No KDF
if(KDF* kdf = make_a<KDF>(algo_spec))
return kdf;
throw Algorithm_Not_Found(algo_spec);
}
#if defined(BOTAN_HAS_HKDF)
BOTAN_REGISTER_NAMED_T(KDF, "HKDF", HKDF, HKDF::make);
#endif
#if defined(BOTAN_HAS_KDF1)
BOTAN_REGISTER_KDF_1HASH(KDF1, "KDF1");
#endif
#if defined(BOTAN_HAS_KDF2)
BOTAN_REGISTER_KDF_1HASH(KDF2, "KDF2");
#endif
#if defined(BOTAN_HAS_TLS_V10_PRF)
BOTAN_REGISTER_KDF_NOARGS(TLS_PRF, "TLS-PRF");
#endif
#if defined(BOTAN_HAS_TLS_V12_PRF)
BOTAN_REGISTER_NAMED_T(KDF, "TLS-12-PRF", TLS_12_PRF, TLS_12_PRF::make);
#endif
#if defined(BOTAN_HAS_X942_PRF)
BOTAN_REGISTER_KDF_NAMED_1STR(X942_PRF, "X9.42-PRF");
#endif
}
|