1 #include <openssl/engine.h>
2 
3 #ifndef ENGINE_CMD_BASE
4 # error did not get engine.h
5 #endif
6 
7 #define TEST_ENGINE_ID      "testsetengine"
8 #define TEST_ENGINE_NAME    "dummy test engine"
9 
10 #ifdef _WIN32
11 # define DEFAULT_VISIBILITY __declspec(dllexport)
12 #else
13 # define DEFAULT_VISIBILITY __attribute__((visibility("default")))
14 #endif
15 
16 namespace {
17 
EngineInit(ENGINE* engine)18 int EngineInit(ENGINE* engine) {
19   return 1;
20 }
21 
EngineFinish(ENGINE* engine)22 int EngineFinish(ENGINE* engine) {
23   return 1;
24 }
25 
EngineDestroy(ENGINE* engine)26 int EngineDestroy(ENGINE* engine) {
27   return 1;
28 }
29 
bind_fn(ENGINE* engine, const char* id)30 int bind_fn(ENGINE* engine, const char* id) {
31   ENGINE_set_id(engine, TEST_ENGINE_ID);
32   ENGINE_set_name(engine, TEST_ENGINE_NAME);
33   ENGINE_set_init_function(engine, EngineInit);
34   ENGINE_set_finish_function(engine, EngineFinish);
35   ENGINE_set_destroy_function(engine, EngineDestroy);
36   return 1;
37 }
38 
39 extern "C" {
40   DEFAULT_VISIBILITY IMPLEMENT_DYNAMIC_CHECK_FN();
41   DEFAULT_VISIBILITY IMPLEMENT_DYNAMIC_BIND_FN(bind_fn);
42 }
43 
44 }  // anonymous namespace
45