aboutsummaryrefslogtreecommitdiff
path: root/src/include/microhttpd_tls.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/microhttpd_tls.h')
-rw-r--r--src/include/microhttpd_tls.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/include/microhttpd_tls.h b/src/include/microhttpd_tls.h
new file mode 100644
index 00000000..cbb50aa2
--- /dev/null
+++ b/src/include/microhttpd_tls.h
@@ -0,0 +1,104 @@
1#ifndef MICROHTTPD_TLS_H
2#define MICROHTTPD_TLS_H
3
4/**
5 * Version of the TLS ABI.
6 */
7#define MHD_TLS_ABI_VERSION 0
8
9/**
10 * Version of the TLS ABI as a string.
11 * Must match #MHD_TLS_ABI_VERSION!
12 */
13#define MHD_TLS_ABI_VERSION_STR "0"
14
15
16/**
17 * Callback functions to use for TLS operations.
18 */
19struct MHD_TLS_Plugin
20{
21 /**
22 * Closure with plugin's internal state, opaque to MHD.
23 */
24 void *cls;
25
26 /**
27 * Destroy the plugin, we are done with it.
28 */
29 void
30 (*done)(struct MHD_TLS_Plugin *plugin);
31
32 /**
33 * Initialize key and certificate data from memory.
34 *
35 * @param cls the @e cls of this struct
36 * @param mem_key private key (key.pem) to be used by the
37 * HTTPS daemon. Must be the actual data in-memory, not a filename.
38 * @param mem_cert certificate (cert.pem) to be used by the
39 * HTTPS daemon. Must be the actual data in-memory, not a filename.
40 * @param pass passphrase phrase to decrypt 'key.pem', NULL
41 * if @param mem_key is in cleartext already
42 * @return #MHD_SC_OK upon success; TODO: define failure modes
43 */
44 enum MHD_StatusCode
45 (*init_kcp)(void *cls,
46 const char *mem_key,
47 const char *mem_cert,
48 const char *pass);
49
50
51 /**
52 * Initialize DH parameters.
53 *
54 * @param cls the @e cls of this struct
55 * @param dh parameters to use
56 * @return #MHD_SC_OK upon success; TODO: define failure modes
57 */
58 enum MHD_StatusCode
59 (*init_dhparams)(void *cls,
60 const char *dh);
61
62
63 /**
64 * Initialize certificate to use for client authentication.
65 *
66 * @param cls the @e cls of this struct
67 * @param mem_trust client certificate
68 * @return #MHD_SC_OK upon success; TODO: define failure modes
69 */
70 enum MHD_StatusCode
71 (*init_mem_trust)(void *cls,
72 const char *mem_trust);
73
74
75 /**
76 * TODO: More functions here....
77 */
78
79};
80
81
82/**
83 * Signature of the initialization function each TLS plugin must
84 * export.
85 *
86 * @param ciphers desired cipher suite
87 * @return NULL on errors (in particular, invalid cipher suite)
88 */
89typedef struct MHD_TLS_Plugin *
90MHD_TLS_PluginInit (const char *ciphers);
91
92
93/**
94 * Define function to be exported from the TLS plugin.
95 *
96 * @a body function body that receives `ciphers` argument
97 * and must return the plugin API, or NULL on error.
98 */
99#define MHD_TLS_INIT(body) \
100 struct MHD_TLS_Plugin * \
101 MHD_TLS_init_ ## MHD_TLS_ABI_VERSION (const char *ciphers) \\
102 { body }
103
104#endif