1*0a6a1f1dSLionel Sambuc /* $NetBSD: engine.c,v 1.3 2014/04/24 13:45:34 pettai Exp $ */
2ebfedea0SLionel Sambuc
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc * Copyright (c) 2006 Kungliga Tekniska Högskolan
5ebfedea0SLionel Sambuc * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc * All rights reserved.
7ebfedea0SLionel Sambuc *
8ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc * are met:
11ebfedea0SLionel Sambuc *
12ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc *
15ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc *
19ebfedea0SLionel Sambuc * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc * may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc * without specific prior written permission.
22ebfedea0SLionel Sambuc *
23ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc * SUCH DAMAGE.
34ebfedea0SLionel Sambuc */
35ebfedea0SLionel Sambuc
36ebfedea0SLionel Sambuc #include <config.h>
37ebfedea0SLionel Sambuc
38ebfedea0SLionel Sambuc #include <stdio.h>
39ebfedea0SLionel Sambuc #include <stdlib.h>
40ebfedea0SLionel Sambuc #include <string.h>
41ebfedea0SLionel Sambuc
42ebfedea0SLionel Sambuc #include <engine.h>
43ebfedea0SLionel Sambuc
44ebfedea0SLionel Sambuc #ifdef HAVE_DLFCN_H
45ebfedea0SLionel Sambuc #include <dlfcn.h>
46ebfedea0SLionel Sambuc #ifndef RTLD_NOW
47ebfedea0SLionel Sambuc #define RTLD_NOW 0
48ebfedea0SLionel Sambuc #endif
49ebfedea0SLionel Sambuc #endif
50ebfedea0SLionel Sambuc
51ebfedea0SLionel Sambuc struct hc_engine {
52ebfedea0SLionel Sambuc int references;
53ebfedea0SLionel Sambuc char *name;
54ebfedea0SLionel Sambuc char *id;
55ebfedea0SLionel Sambuc void (*destroy)(ENGINE *);
56ebfedea0SLionel Sambuc const RSA_METHOD *rsa;
57ebfedea0SLionel Sambuc const DH_METHOD *dh;
58ebfedea0SLionel Sambuc const RAND_METHOD *rand;
59ebfedea0SLionel Sambuc };
60ebfedea0SLionel Sambuc
61ebfedea0SLionel Sambuc ENGINE *
ENGINE_new(void)62ebfedea0SLionel Sambuc ENGINE_new(void)
63ebfedea0SLionel Sambuc {
64ebfedea0SLionel Sambuc ENGINE *engine;
65ebfedea0SLionel Sambuc
66ebfedea0SLionel Sambuc engine = calloc(1, sizeof(*engine));
67ebfedea0SLionel Sambuc engine->references = 1;
68ebfedea0SLionel Sambuc
69ebfedea0SLionel Sambuc return engine;
70ebfedea0SLionel Sambuc }
71ebfedea0SLionel Sambuc
72ebfedea0SLionel Sambuc int
ENGINE_free(ENGINE * engine)73ebfedea0SLionel Sambuc ENGINE_free(ENGINE *engine)
74ebfedea0SLionel Sambuc {
75ebfedea0SLionel Sambuc return ENGINE_finish(engine);
76ebfedea0SLionel Sambuc }
77ebfedea0SLionel Sambuc
78ebfedea0SLionel Sambuc int
ENGINE_finish(ENGINE * engine)79ebfedea0SLionel Sambuc ENGINE_finish(ENGINE *engine)
80ebfedea0SLionel Sambuc {
81ebfedea0SLionel Sambuc if (engine->references-- <= 0)
82ebfedea0SLionel Sambuc abort();
83ebfedea0SLionel Sambuc if (engine->references > 0)
84ebfedea0SLionel Sambuc return 1;
85ebfedea0SLionel Sambuc
86ebfedea0SLionel Sambuc if (engine->name)
87ebfedea0SLionel Sambuc free(engine->name);
88ebfedea0SLionel Sambuc if (engine->id)
89ebfedea0SLionel Sambuc free(engine->id);
90ebfedea0SLionel Sambuc if(engine->destroy)
91ebfedea0SLionel Sambuc (*engine->destroy)(engine);
92ebfedea0SLionel Sambuc
93*0a6a1f1dSLionel Sambuc memset(engine, 0, sizeof(*engine));
94ebfedea0SLionel Sambuc engine->references = -1;
95ebfedea0SLionel Sambuc
96ebfedea0SLionel Sambuc
97ebfedea0SLionel Sambuc free(engine);
98ebfedea0SLionel Sambuc return 1;
99ebfedea0SLionel Sambuc }
100ebfedea0SLionel Sambuc
101ebfedea0SLionel Sambuc int
ENGINE_up_ref(ENGINE * engine)102ebfedea0SLionel Sambuc ENGINE_up_ref(ENGINE *engine)
103ebfedea0SLionel Sambuc {
104ebfedea0SLionel Sambuc if (engine->references < 0)
105ebfedea0SLionel Sambuc abort();
106ebfedea0SLionel Sambuc engine->references++;
107ebfedea0SLionel Sambuc return 1;
108ebfedea0SLionel Sambuc }
109ebfedea0SLionel Sambuc
110ebfedea0SLionel Sambuc int
ENGINE_set_id(ENGINE * engine,const char * id)111ebfedea0SLionel Sambuc ENGINE_set_id(ENGINE *engine, const char *id)
112ebfedea0SLionel Sambuc {
113ebfedea0SLionel Sambuc engine->id = strdup(id);
114ebfedea0SLionel Sambuc return (engine->id == NULL) ? 0 : 1;
115ebfedea0SLionel Sambuc }
116ebfedea0SLionel Sambuc
117ebfedea0SLionel Sambuc int
ENGINE_set_name(ENGINE * engine,const char * name)118ebfedea0SLionel Sambuc ENGINE_set_name(ENGINE *engine, const char *name)
119ebfedea0SLionel Sambuc {
120ebfedea0SLionel Sambuc engine->name = strdup(name);
121ebfedea0SLionel Sambuc return (engine->name == NULL) ? 0 : 1;
122ebfedea0SLionel Sambuc }
123ebfedea0SLionel Sambuc
124ebfedea0SLionel Sambuc int
ENGINE_set_RSA(ENGINE * engine,const RSA_METHOD * method)125ebfedea0SLionel Sambuc ENGINE_set_RSA(ENGINE *engine, const RSA_METHOD *method)
126ebfedea0SLionel Sambuc {
127ebfedea0SLionel Sambuc engine->rsa = method;
128ebfedea0SLionel Sambuc return 1;
129ebfedea0SLionel Sambuc }
130ebfedea0SLionel Sambuc
131ebfedea0SLionel Sambuc int
ENGINE_set_DH(ENGINE * engine,const DH_METHOD * method)132ebfedea0SLionel Sambuc ENGINE_set_DH(ENGINE *engine, const DH_METHOD *method)
133ebfedea0SLionel Sambuc {
134ebfedea0SLionel Sambuc engine->dh = method;
135ebfedea0SLionel Sambuc return 1;
136ebfedea0SLionel Sambuc }
137ebfedea0SLionel Sambuc
138ebfedea0SLionel Sambuc int
ENGINE_set_destroy_function(ENGINE * e,void (* destroy)(ENGINE *))139ebfedea0SLionel Sambuc ENGINE_set_destroy_function(ENGINE *e, void (*destroy)(ENGINE *))
140ebfedea0SLionel Sambuc {
141ebfedea0SLionel Sambuc e->destroy = destroy;
142ebfedea0SLionel Sambuc return 1;
143ebfedea0SLionel Sambuc }
144ebfedea0SLionel Sambuc
145ebfedea0SLionel Sambuc const char *
ENGINE_get_id(const ENGINE * engine)146ebfedea0SLionel Sambuc ENGINE_get_id(const ENGINE *engine)
147ebfedea0SLionel Sambuc {
148ebfedea0SLionel Sambuc return engine->id;
149ebfedea0SLionel Sambuc }
150ebfedea0SLionel Sambuc
151ebfedea0SLionel Sambuc const char *
ENGINE_get_name(const ENGINE * engine)152ebfedea0SLionel Sambuc ENGINE_get_name(const ENGINE *engine)
153ebfedea0SLionel Sambuc {
154ebfedea0SLionel Sambuc return engine->name;
155ebfedea0SLionel Sambuc }
156ebfedea0SLionel Sambuc
157ebfedea0SLionel Sambuc const RSA_METHOD *
ENGINE_get_RSA(const ENGINE * engine)158ebfedea0SLionel Sambuc ENGINE_get_RSA(const ENGINE *engine)
159ebfedea0SLionel Sambuc {
160ebfedea0SLionel Sambuc return engine->rsa;
161ebfedea0SLionel Sambuc }
162ebfedea0SLionel Sambuc
163ebfedea0SLionel Sambuc const DH_METHOD *
ENGINE_get_DH(const ENGINE * engine)164ebfedea0SLionel Sambuc ENGINE_get_DH(const ENGINE *engine)
165ebfedea0SLionel Sambuc {
166ebfedea0SLionel Sambuc return engine->dh;
167ebfedea0SLionel Sambuc }
168ebfedea0SLionel Sambuc
169ebfedea0SLionel Sambuc const RAND_METHOD *
ENGINE_get_RAND(const ENGINE * engine)170ebfedea0SLionel Sambuc ENGINE_get_RAND(const ENGINE *engine)
171ebfedea0SLionel Sambuc {
172ebfedea0SLionel Sambuc return engine->rand;
173ebfedea0SLionel Sambuc }
174ebfedea0SLionel Sambuc
175ebfedea0SLionel Sambuc /*
176ebfedea0SLionel Sambuc *
177ebfedea0SLionel Sambuc */
178ebfedea0SLionel Sambuc
179ebfedea0SLionel Sambuc #define SG_default_engine(type) \
180ebfedea0SLionel Sambuc static ENGINE *type##_engine; \
181ebfedea0SLionel Sambuc int \
182ebfedea0SLionel Sambuc ENGINE_set_default_##type(ENGINE *engine) \
183ebfedea0SLionel Sambuc { \
184ebfedea0SLionel Sambuc if (type##_engine) \
185ebfedea0SLionel Sambuc ENGINE_finish(type##_engine); \
186ebfedea0SLionel Sambuc type##_engine = engine; \
187ebfedea0SLionel Sambuc if (type##_engine) \
188ebfedea0SLionel Sambuc ENGINE_up_ref(type##_engine); \
189ebfedea0SLionel Sambuc return 1; \
190ebfedea0SLionel Sambuc } \
191ebfedea0SLionel Sambuc ENGINE * \
192ebfedea0SLionel Sambuc ENGINE_get_default_##type(void) \
193ebfedea0SLionel Sambuc { \
194ebfedea0SLionel Sambuc if (type##_engine) \
195ebfedea0SLionel Sambuc ENGINE_up_ref(type##_engine); \
196ebfedea0SLionel Sambuc return type##_engine; \
197ebfedea0SLionel Sambuc }
198ebfedea0SLionel Sambuc
199ebfedea0SLionel Sambuc SG_default_engine(RSA)
200ebfedea0SLionel Sambuc SG_default_engine(DH)
201ebfedea0SLionel Sambuc
202ebfedea0SLionel Sambuc #undef SG_default_engine
203ebfedea0SLionel Sambuc
204ebfedea0SLionel Sambuc /*
205ebfedea0SLionel Sambuc *
206ebfedea0SLionel Sambuc */
207ebfedea0SLionel Sambuc
208ebfedea0SLionel Sambuc static ENGINE **engines;
209ebfedea0SLionel Sambuc static unsigned int num_engines;
210ebfedea0SLionel Sambuc
211ebfedea0SLionel Sambuc static int
add_engine(ENGINE * engine)212ebfedea0SLionel Sambuc add_engine(ENGINE *engine)
213ebfedea0SLionel Sambuc {
214ebfedea0SLionel Sambuc ENGINE **d, *dup;
215ebfedea0SLionel Sambuc
216ebfedea0SLionel Sambuc dup = ENGINE_by_id(engine->id);
217ebfedea0SLionel Sambuc if (dup)
218ebfedea0SLionel Sambuc return 0;
219ebfedea0SLionel Sambuc
220ebfedea0SLionel Sambuc d = realloc(engines, (num_engines + 1) * sizeof(*engines));
221ebfedea0SLionel Sambuc if (d == NULL)
222ebfedea0SLionel Sambuc return 1;
223ebfedea0SLionel Sambuc engines = d;
224ebfedea0SLionel Sambuc engines[num_engines++] = engine;
225ebfedea0SLionel Sambuc
226ebfedea0SLionel Sambuc return 1;
227ebfedea0SLionel Sambuc }
228ebfedea0SLionel Sambuc
229ebfedea0SLionel Sambuc void
ENGINE_load_builtin_engines(void)230ebfedea0SLionel Sambuc ENGINE_load_builtin_engines(void)
231ebfedea0SLionel Sambuc {
232ebfedea0SLionel Sambuc ENGINE *engine;
233ebfedea0SLionel Sambuc int ret;
234ebfedea0SLionel Sambuc
235ebfedea0SLionel Sambuc engine = ENGINE_new();
236ebfedea0SLionel Sambuc if (engine == NULL)
237ebfedea0SLionel Sambuc return;
238ebfedea0SLionel Sambuc
239ebfedea0SLionel Sambuc ENGINE_set_id(engine, "builtin");
240ebfedea0SLionel Sambuc ENGINE_set_name(engine,
241ebfedea0SLionel Sambuc "Heimdal crypto builtin (ltm) engine version " PACKAGE_VERSION);
242ebfedea0SLionel Sambuc ENGINE_set_RSA(engine, RSA_ltm_method());
243ebfedea0SLionel Sambuc ENGINE_set_DH(engine, DH_ltm_method());
244ebfedea0SLionel Sambuc
245ebfedea0SLionel Sambuc ret = add_engine(engine);
246ebfedea0SLionel Sambuc if (ret != 1)
247ebfedea0SLionel Sambuc ENGINE_finish(engine);
248ebfedea0SLionel Sambuc
249ebfedea0SLionel Sambuc #ifdef USE_HCRYPTO_TFM
250ebfedea0SLionel Sambuc /*
251ebfedea0SLionel Sambuc * TFM
252ebfedea0SLionel Sambuc */
253ebfedea0SLionel Sambuc
254ebfedea0SLionel Sambuc engine = ENGINE_new();
255ebfedea0SLionel Sambuc if (engine == NULL)
256ebfedea0SLionel Sambuc return;
257ebfedea0SLionel Sambuc
258ebfedea0SLionel Sambuc ENGINE_set_id(engine, "tfm");
259ebfedea0SLionel Sambuc ENGINE_set_name(engine,
260ebfedea0SLionel Sambuc "Heimdal crypto tfm engine version " PACKAGE_VERSION);
261ebfedea0SLionel Sambuc ENGINE_set_RSA(engine, RSA_tfm_method());
262ebfedea0SLionel Sambuc ENGINE_set_DH(engine, DH_tfm_method());
263ebfedea0SLionel Sambuc
264ebfedea0SLionel Sambuc ret = add_engine(engine);
265ebfedea0SLionel Sambuc if (ret != 1)
266ebfedea0SLionel Sambuc ENGINE_finish(engine);
267ebfedea0SLionel Sambuc #endif /* USE_HCRYPTO_TFM */
268ebfedea0SLionel Sambuc
269ebfedea0SLionel Sambuc #ifdef USE_HCRYPTO_LTM
270ebfedea0SLionel Sambuc /*
271ebfedea0SLionel Sambuc * ltm
272ebfedea0SLionel Sambuc */
273ebfedea0SLionel Sambuc
274ebfedea0SLionel Sambuc engine = ENGINE_new();
275ebfedea0SLionel Sambuc if (engine == NULL)
276ebfedea0SLionel Sambuc return;
277ebfedea0SLionel Sambuc
278ebfedea0SLionel Sambuc ENGINE_set_id(engine, "ltm");
279ebfedea0SLionel Sambuc ENGINE_set_name(engine,
280ebfedea0SLionel Sambuc "Heimdal crypto ltm engine version " PACKAGE_VERSION);
281ebfedea0SLionel Sambuc ENGINE_set_RSA(engine, RSA_ltm_method());
282ebfedea0SLionel Sambuc ENGINE_set_DH(engine, DH_ltm_method());
283ebfedea0SLionel Sambuc
284ebfedea0SLionel Sambuc ret = add_engine(engine);
285ebfedea0SLionel Sambuc if (ret != 1)
286ebfedea0SLionel Sambuc ENGINE_finish(engine);
287ebfedea0SLionel Sambuc #endif
288ebfedea0SLionel Sambuc
289ebfedea0SLionel Sambuc #ifdef HAVE_GMP
290ebfedea0SLionel Sambuc /*
291ebfedea0SLionel Sambuc * gmp
292ebfedea0SLionel Sambuc */
293ebfedea0SLionel Sambuc
294ebfedea0SLionel Sambuc engine = ENGINE_new();
295ebfedea0SLionel Sambuc if (engine == NULL)
296ebfedea0SLionel Sambuc return;
297ebfedea0SLionel Sambuc
298ebfedea0SLionel Sambuc ENGINE_set_id(engine, "gmp");
299ebfedea0SLionel Sambuc ENGINE_set_name(engine,
300ebfedea0SLionel Sambuc "Heimdal crypto gmp engine version " PACKAGE_VERSION);
301ebfedea0SLionel Sambuc ENGINE_set_RSA(engine, RSA_gmp_method());
302ebfedea0SLionel Sambuc
303ebfedea0SLionel Sambuc ret = add_engine(engine);
304ebfedea0SLionel Sambuc if (ret != 1)
305ebfedea0SLionel Sambuc ENGINE_finish(engine);
306ebfedea0SLionel Sambuc #endif
307ebfedea0SLionel Sambuc }
308ebfedea0SLionel Sambuc
309ebfedea0SLionel Sambuc ENGINE *
ENGINE_by_dso(const char * path,const char * id)310ebfedea0SLionel Sambuc ENGINE_by_dso(const char *path, const char *id)
311ebfedea0SLionel Sambuc {
312ebfedea0SLionel Sambuc #ifdef HAVE_DLOPEN
313ebfedea0SLionel Sambuc ENGINE *engine;
314ebfedea0SLionel Sambuc void *handle;
315ebfedea0SLionel Sambuc int ret;
316ebfedea0SLionel Sambuc
317ebfedea0SLionel Sambuc engine = calloc(1, sizeof(*engine));
318ebfedea0SLionel Sambuc if (engine == NULL)
319ebfedea0SLionel Sambuc return NULL;
320ebfedea0SLionel Sambuc
321ebfedea0SLionel Sambuc handle = dlopen(path, RTLD_NOW);
322ebfedea0SLionel Sambuc if (handle == NULL) {
323ebfedea0SLionel Sambuc /* printf("error: %s\n", dlerror()); */
324ebfedea0SLionel Sambuc free(engine);
325ebfedea0SLionel Sambuc return NULL;
326ebfedea0SLionel Sambuc }
327ebfedea0SLionel Sambuc
328ebfedea0SLionel Sambuc {
329ebfedea0SLionel Sambuc unsigned long version;
330ebfedea0SLionel Sambuc openssl_v_check v_check;
331ebfedea0SLionel Sambuc
332ebfedea0SLionel Sambuc v_check = (openssl_v_check)dlsym(handle, "v_check");
333ebfedea0SLionel Sambuc if (v_check == NULL) {
334ebfedea0SLionel Sambuc dlclose(handle);
335ebfedea0SLionel Sambuc free(engine);
336ebfedea0SLionel Sambuc return NULL;
337ebfedea0SLionel Sambuc }
338ebfedea0SLionel Sambuc
339ebfedea0SLionel Sambuc version = (*v_check)(OPENSSL_DYNAMIC_VERSION);
340ebfedea0SLionel Sambuc if (version == 0) {
341ebfedea0SLionel Sambuc dlclose(handle);
342ebfedea0SLionel Sambuc free(engine);
343ebfedea0SLionel Sambuc return NULL;
344ebfedea0SLionel Sambuc }
345ebfedea0SLionel Sambuc }
346ebfedea0SLionel Sambuc
347ebfedea0SLionel Sambuc {
348ebfedea0SLionel Sambuc openssl_bind_engine bind_engine;
349ebfedea0SLionel Sambuc
350ebfedea0SLionel Sambuc bind_engine = (openssl_bind_engine)dlsym(handle, "bind_engine");
351ebfedea0SLionel Sambuc if (bind_engine == NULL) {
352ebfedea0SLionel Sambuc dlclose(handle);
353ebfedea0SLionel Sambuc free(engine);
354ebfedea0SLionel Sambuc return NULL;
355ebfedea0SLionel Sambuc }
356ebfedea0SLionel Sambuc
357ebfedea0SLionel Sambuc ret = (*bind_engine)(engine, id, NULL); /* XXX fix third arg */
358ebfedea0SLionel Sambuc if (ret != 1) {
359ebfedea0SLionel Sambuc dlclose(handle);
360ebfedea0SLionel Sambuc free(engine);
361ebfedea0SLionel Sambuc return NULL;
362ebfedea0SLionel Sambuc }
363ebfedea0SLionel Sambuc }
364ebfedea0SLionel Sambuc
365ebfedea0SLionel Sambuc ENGINE_up_ref(engine);
366ebfedea0SLionel Sambuc
367ebfedea0SLionel Sambuc ret = add_engine(engine);
368ebfedea0SLionel Sambuc if (ret != 1) {
369ebfedea0SLionel Sambuc dlclose(handle);
370ebfedea0SLionel Sambuc ENGINE_finish(engine);
371ebfedea0SLionel Sambuc return NULL;
372ebfedea0SLionel Sambuc }
373ebfedea0SLionel Sambuc
374ebfedea0SLionel Sambuc return engine;
375ebfedea0SLionel Sambuc #else
376ebfedea0SLionel Sambuc return NULL;
377ebfedea0SLionel Sambuc #endif
378ebfedea0SLionel Sambuc }
379ebfedea0SLionel Sambuc
380ebfedea0SLionel Sambuc ENGINE *
ENGINE_by_id(const char * id)381ebfedea0SLionel Sambuc ENGINE_by_id(const char *id)
382ebfedea0SLionel Sambuc {
383ebfedea0SLionel Sambuc int i;
384ebfedea0SLionel Sambuc
385ebfedea0SLionel Sambuc for (i = 0; i < num_engines; i++) {
386ebfedea0SLionel Sambuc if (strcmp(id, engines[i]->id) == 0) {
387ebfedea0SLionel Sambuc ENGINE_up_ref(engines[i]);
388ebfedea0SLionel Sambuc return engines[i];
389ebfedea0SLionel Sambuc }
390ebfedea0SLionel Sambuc }
391ebfedea0SLionel Sambuc return NULL;
392ebfedea0SLionel Sambuc }
393ebfedea0SLionel Sambuc
394ebfedea0SLionel Sambuc void
ENGINE_add_conf_module(void)395ebfedea0SLionel Sambuc ENGINE_add_conf_module(void)
396ebfedea0SLionel Sambuc {
397ebfedea0SLionel Sambuc }
398