summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/store/str_meth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/store/str_meth.c')
-rw-r--r--src/lib/libcrypto/store/str_meth.c243
1 files changed, 145 insertions, 98 deletions
diff --git a/src/lib/libcrypto/store/str_meth.c b/src/lib/libcrypto/store/str_meth.c
index 0401aaa129..9457087757 100644
--- a/src/lib/libcrypto/store/str_meth.c
+++ b/src/lib/libcrypto/store/str_meth.c
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -60,189 +60,236 @@
60#include <openssl/buffer.h> 60#include <openssl/buffer.h>
61#include "str_locl.h" 61#include "str_locl.h"
62 62
63STORE_METHOD *STORE_create_method(char *name) 63STORE_METHOD *
64 { 64STORE_create_method(char *name)
65{
65 STORE_METHOD *store_method = calloc(1, sizeof(STORE_METHOD)); 66 STORE_METHOD *store_method = calloc(1, sizeof(STORE_METHOD));
66 67
67 if (store_method) 68 if (store_method)
68 store_method->name = BUF_strdup(name); 69 store_method->name = BUF_strdup(name);
69 70
70 return store_method; 71 return store_method;
71 } 72}
72 73
73/* BIG FSCKING WARNING!!!! If you use this on a statically allocated method 74/* BIG FSCKING WARNING!!!! If you use this on a statically allocated method
74 (that is, it hasn't been allocated using STORE_create_method(), you deserve 75 (that is, it hasn't been allocated using STORE_create_method(), you deserve
75 anything Murphy can throw at you and more! You have been warned. */ 76 anything Murphy can throw at you and more! You have been warned. */
76void STORE_destroy_method(STORE_METHOD *store_method) 77void
77 { 78STORE_destroy_method(STORE_METHOD *store_method)
78 if (!store_method) return; 79{
80 if (!store_method)
81 return;
79 free(store_method->name); 82 free(store_method->name);
80 store_method->name = NULL; 83 store_method->name = NULL;
81 free(store_method); 84 free(store_method);
82 } 85}
83 86
84int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f) 87int
85 { 88STORE_method_set_initialise_function(STORE_METHOD *sm,
89 STORE_INITIALISE_FUNC_PTR init_f)
90{
86 sm->init = init_f; 91 sm->init = init_f;
87 return 1; 92 return 1;
88 } 93}
89 94
90int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f) 95int
91 { 96STORE_method_set_cleanup_function(STORE_METHOD *sm,
97 STORE_CLEANUP_FUNC_PTR clean_f)
98{
92 sm->clean = clean_f; 99 sm->clean = clean_f;
93 return 1; 100 return 1;
94 } 101}
95 102
96int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f) 103int
97 { 104STORE_method_set_generate_function(STORE_METHOD *sm,
105 STORE_GENERATE_OBJECT_FUNC_PTR generate_f)
106{
98 sm->generate_object = generate_f; 107 sm->generate_object = generate_f;
99 return 1; 108 return 1;
100 } 109}
101 110
102int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f) 111int
103 { 112STORE_method_set_get_function(STORE_METHOD *sm,
113 STORE_GET_OBJECT_FUNC_PTR get_f)
114{
104 sm->get_object = get_f; 115 sm->get_object = get_f;
105 return 1; 116 return 1;
106 } 117}
107 118
108int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f) 119int
109 { 120STORE_method_set_store_function(STORE_METHOD *sm,
121 STORE_STORE_OBJECT_FUNC_PTR store_f)
122{
110 sm->store_object = store_f; 123 sm->store_object = store_f;
111 return 1; 124 return 1;
112 } 125}
113 126
114int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR modify_f) 127int
115 { 128STORE_method_set_modify_function(STORE_METHOD *sm,
129 STORE_MODIFY_OBJECT_FUNC_PTR modify_f)
130{
116 sm->modify_object = modify_f; 131 sm->modify_object = modify_f;
117 return 1; 132 return 1;
118 } 133}
119 134
120int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f) 135int
121 { 136STORE_method_set_revoke_function(STORE_METHOD *sm,
137 STORE_HANDLE_OBJECT_FUNC_PTR revoke_f)
138{
122 sm->revoke_object = revoke_f; 139 sm->revoke_object = revoke_f;
123 return 1; 140 return 1;
124 } 141}
125 142
126int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f) 143int
127 { 144STORE_method_set_delete_function(STORE_METHOD *sm,
145 STORE_HANDLE_OBJECT_FUNC_PTR delete_f)
146{
128 sm->delete_object = delete_f; 147 sm->delete_object = delete_f;
129 return 1; 148 return 1;
130 } 149}
131 150
132int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f) 151int
133 { 152STORE_method_set_list_start_function(STORE_METHOD *sm,
153 STORE_START_OBJECT_FUNC_PTR list_start_f)
154{
134 sm->list_object_start = list_start_f; 155 sm->list_object_start = list_start_f;
135 return 1; 156 return 1;
136 } 157}
137 158
138int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f) 159int
139 { 160STORE_method_set_list_next_function(STORE_METHOD *sm,
161 STORE_NEXT_OBJECT_FUNC_PTR list_next_f)
162{
140 sm->list_object_next = list_next_f; 163 sm->list_object_next = list_next_f;
141 return 1; 164 return 1;
142 } 165}
143 166
144int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f) 167int
145 { 168STORE_method_set_list_end_function(STORE_METHOD *sm,
169 STORE_END_OBJECT_FUNC_PTR list_end_f)
170{
146 sm->list_object_end = list_end_f; 171 sm->list_object_end = list_end_f;
147 return 1; 172 return 1;
148 } 173}
149 174
150int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR update_f) 175int
151 { 176STORE_method_set_update_store_function(STORE_METHOD *sm,
177 STORE_GENERIC_FUNC_PTR update_f)
178{
152 sm->update_store = update_f; 179 sm->update_store = update_f;
153 return 1; 180 return 1;
154 } 181}
155 182
156int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR lock_f) 183int
157 { 184STORE_method_set_lock_store_function(STORE_METHOD *sm,
185 STORE_GENERIC_FUNC_PTR lock_f)
186{
158 sm->lock_store = lock_f; 187 sm->lock_store = lock_f;
159 return 1; 188 return 1;
160 } 189}
161 190
162int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR unlock_f) 191int
163 { 192STORE_method_set_unlock_store_function(STORE_METHOD *sm,
193 STORE_GENERIC_FUNC_PTR unlock_f)
194{
164 sm->unlock_store = unlock_f; 195 sm->unlock_store = unlock_f;
165 return 1; 196 return 1;
166 } 197}
167 198
168int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f) 199int
169 { 200STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f)
201{
170 sm->ctrl = ctrl_f; 202 sm->ctrl = ctrl_f;
171 return 1; 203 return 1;
172 } 204}
173 205
174STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm) 206STORE_INITIALISE_FUNC_PTR
175 { 207STORE_method_get_initialise_function(STORE_METHOD *sm)
208{
176 return sm->init; 209 return sm->init;
177 } 210}
178 211
179STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm) 212STORE_CLEANUP_FUNC_PTR
180 { 213STORE_method_get_cleanup_function(STORE_METHOD *sm)
214{
181 return sm->clean; 215 return sm->clean;
182 } 216}
183 217
184STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm) 218STORE_GENERATE_OBJECT_FUNC_PTR
185 { 219STORE_method_get_generate_function(STORE_METHOD *sm)
220{
186 return sm->generate_object; 221 return sm->generate_object;
187 } 222}
188 223
189STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm) 224STORE_GET_OBJECT_FUNC_PTR
190 { 225STORE_method_get_get_function(STORE_METHOD *sm)
226{
191 return sm->get_object; 227 return sm->get_object;
192 } 228}
193 229
194STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm) 230STORE_STORE_OBJECT_FUNC_PTR
195 { 231STORE_method_get_store_function(STORE_METHOD *sm)
232{
196 return sm->store_object; 233 return sm->store_object;
197 } 234}
198 235
199STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm) 236STORE_MODIFY_OBJECT_FUNC_PTR
200 { 237STORE_method_get_modify_function(STORE_METHOD *sm)
238{
201 return sm->modify_object; 239 return sm->modify_object;
202 } 240}
203 241
204STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm) 242STORE_HANDLE_OBJECT_FUNC_PTR
205 { 243STORE_method_get_revoke_function(STORE_METHOD *sm)
244{
206 return sm->revoke_object; 245 return sm->revoke_object;
207 } 246}
208 247
209STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm) 248STORE_HANDLE_OBJECT_FUNC_PTR
210 { 249STORE_method_get_delete_function(STORE_METHOD *sm)
250{
211 return sm->delete_object; 251 return sm->delete_object;
212 } 252}
213 253
214STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm) 254STORE_START_OBJECT_FUNC_PTR
215 { 255STORE_method_get_list_start_function(STORE_METHOD *sm)
256{
216 return sm->list_object_start; 257 return sm->list_object_start;
217 } 258}
218 259
219STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm) 260STORE_NEXT_OBJECT_FUNC_PTR
220 { 261STORE_method_get_list_next_function(STORE_METHOD *sm)
262{
221 return sm->list_object_next; 263 return sm->list_object_next;
222 } 264}
223 265
224STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm) 266STORE_END_OBJECT_FUNC_PTR
225 { 267STORE_method_get_list_end_function(STORE_METHOD *sm)
268{
226 return sm->list_object_end; 269 return sm->list_object_end;
227 } 270}
228 271
229STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm) 272STORE_GENERIC_FUNC_PTR
230 { 273STORE_method_get_update_store_function(STORE_METHOD *sm)
274{
231 return sm->update_store; 275 return sm->update_store;
232 } 276}
233 277
234STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm) 278STORE_GENERIC_FUNC_PTR
235 { 279STORE_method_get_lock_store_function(STORE_METHOD *sm)
280{
236 return sm->lock_store; 281 return sm->lock_store;
237 } 282}
238 283
239STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm) 284STORE_GENERIC_FUNC_PTR
240 { 285STORE_method_get_unlock_store_function(STORE_METHOD *sm)
286{
241 return sm->unlock_store; 287 return sm->unlock_store;
242 } 288}
243 289
244STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm) 290STORE_CTRL_FUNC_PTR
245 { 291STORE_method_get_ctrl_function(STORE_METHOD *sm)
292{
246 return sm->ctrl; 293 return sm->ctrl;
247 } 294}
248 295