-
Notifications
You must be signed in to change notification settings - Fork 9
/
engine.c
33 lines (29 loc) · 852 Bytes
/
engine.c
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
/**
* Legacy concept for third-party loadable code.
*
* Per the upstream docs, "use providers instead".
*/
#include <openssl/engine.h>
#include <openssl/types.h>
#include <stdio.h>
static const char* id = "test-engine";
static const char* name = "OpenSSL Engine example";
/*
* The OpenSSL library will perform checks to verify that the
* Engine is compatible with this version of OpenSSL and finish
* with calling this function which is specified using the
* IMPLEMENT_DYNAMIC_BIND_FN macro.
*/
static int bind(ENGINE* e, const char* id) {
if (!ENGINE_set_id(e, id)) {
fprintf(stderr, "Filed to set engine id to %s\n", id);
return 0;
}
if (!ENGINE_set_name(e, name)) {
fprintf(stderr, "Filed to set engine name to %s\n", name);
return 0;
}
return 1;
}
IMPLEMENT_DYNAMIC_BIND_FN(bind)
IMPLEMENT_DYNAMIC_CHECK_FN()