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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
/*
* Algorithm Lookup
* (C) 1999-2007,2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_LOOKUP_H__
#define BOTAN_LOOKUP_H__
#include <botan/block_cipher.h>
#include <botan/stream_cipher.h>
#include <botan/hash.h>
#include <botan/mac.h>
#include <botan/exceptn.h>
#include <string>
#include <vector>
#include <memory>
namespace Botan {
/*
* As of 1.11.26 this header is deprecated. Instead use the calls T::create and
* T::providers (as demonstrated in the implementation below).
*/
/*
* Get an algorithm object
* NOTE: these functions create and return new objects, letting the
* caller assume ownership of them
*/
/**
* Block cipher factory method.
*
* @param algo_spec the name of the desired block cipher
* @return pointer to the block cipher object
*/
BOTAN_DEPRECATED("Use BlockCipher::create")
inline BlockCipher* get_block_cipher(const std::string& algo_spec,
const std::string& provider = "")
{
return BlockCipher::create(algo_spec, provider).release();
}
BOTAN_DEPRECATED("Use BlockCipher::create")
inline std::unique_ptr<BlockCipher> make_block_cipher(const std::string& algo_spec,
const std::string& provider = "")
{
std::unique_ptr<BlockCipher> p(BlockCipher::create(algo_spec, provider));
if(p)
return p;
throw Algorithm_Not_Found(algo_spec);
}
BOTAN_DEPRECATED("Use BlockCipher::providers")
inline std::vector<std::string> get_block_cipher_providers(const std::string& algo_spec)
{
return BlockCipher::providers(algo_spec);
}
/**
* Stream cipher factory method.
*
* @param algo_spec the name of the desired stream cipher
* @return pointer to the stream cipher object
*/
BOTAN_DEPRECATED("Use StreamCipher::create")
inline StreamCipher* get_stream_cipher(const std::string& algo_spec,
const std::string& provider = "")
{
return StreamCipher::create(algo_spec, provider).release();
}
BOTAN_DEPRECATED("Use StreamCipher::create")
inline std::unique_ptr<StreamCipher> make_stream_cipher(const std::string& algo_spec,
const std::string& provider = "")
{
std::unique_ptr<StreamCipher> p(StreamCipher::create(algo_spec, provider));
if(p)
return p;
throw Algorithm_Not_Found(algo_spec);
}
BOTAN_DEPRECATED("Use StreamCipher::providers")
inline std::vector<std::string> get_stream_cipher_providers(const std::string& algo_spec)
{
return StreamCipher::providers(algo_spec);
}
/**
* Hash function factory method.
*
* @param algo_spec the name of the desired hash function
* @return pointer to the hash function object
*/
BOTAN_DEPRECATED("Use HashFunction::create")
inline HashFunction* get_hash_function(const std::string& algo_spec,
const std::string& provider = "")
{
return HashFunction::create(algo_spec, provider).release();
}
BOTAN_DEPRECATED("Use HashFunction::create")
inline std::unique_ptr<HashFunction> make_hash_function(const std::string& algo_spec,
const std::string& provider = "")
{
std::unique_ptr<HashFunction> p(HashFunction::create(algo_spec, provider));
if(p)
return p;
throw Algorithm_Not_Found(algo_spec);
}
BOTAN_DEPRECATED("Use HashFunction::create")
inline HashFunction* get_hash(const std::string& algo_spec,
const std::string& provider = "")
{
return HashFunction::create(algo_spec, provider).release();
}
BOTAN_DEPRECATED("Use HashFunction::providers")
inline std::vector<std::string> get_hash_function_providers(const std::string& algo_spec)
{
return HashFunction::providers(algo_spec);
}
/**
* MAC factory method.
*
* @param algo_spec the name of the desired MAC
* @return pointer to the MAC object
*/
BOTAN_DEPRECATED("MessageAuthenticationCode::create")
inline MessageAuthenticationCode* get_mac(const std::string& algo_spec,
const std::string& provider = "")
{
return MessageAuthenticationCode::create(algo_spec, provider).release();
}
BOTAN_DEPRECATED("MessageAuthenticationCode::create")
inline std::unique_ptr<MessageAuthenticationCode> make_message_auth(const std::string& algo_spec,
const std::string& provider = "")
{
std::unique_ptr<MessageAuthenticationCode> p(MessageAuthenticationCode::create(algo_spec, provider));
if(p)
return p;
throw Algorithm_Not_Found(algo_spec);
}
BOTAN_DEPRECATED("MessageAuthenticationCode::providers")
inline std::vector<std::string> get_mac_providers(const std::string& algo_spec)
{
return MessageAuthenticationCode::providers(algo_spec);
}
}
#endif
|