OGLplus  (0.59.0) a C++ wrapper for rendering APIs

c_api.hpp
Go to the documentation of this file.
1 #ifndef EAGINE_SSL_API_C_API_HPP
9 #define EAGINE_SSL_API_C_API_HPP
10 
11 #include "api_traits.hpp"
12 #include "config.hpp"
13 #include <eagine/nothing.hpp>
14 #include <eagine/preprocessor.hpp>
15 
16 #ifndef EAGINE_SSL_STATIC_FUNC
17 #if EAGINE_HAS_SSL
18 #define EAGINE_SSL_STATIC_FUNC(NAME) &::NAME
19 #else
20 #define EAGINE_SSL_STATIC_FUNC(NAME) nullptr
21 #endif
22 #endif
23 
24 namespace eagine::sslp {
25 //------------------------------------------------------------------------------
26 template <typename Traits>
27 struct basic_ssl_c_api {
28 
29  using this_api = basic_ssl_c_api;
30  using api_traits = Traits;
31 
32  static constexpr bool has_api = ssl_types::has_api;
33  using ui_method_type = ssl_types::ui_method_type;
34  using engine_type = ssl_types::engine_type;
35  using bio_method_type = ssl_types::bio_method_type;
36  using bio_type = ssl_types::bio_type;
37  using evp_pkey_ctx_type = ssl_types::evp_pkey_ctx_type;
38  using evp_pkey_type = ssl_types::evp_pkey_type;
39  using evp_cipher_ctx_type = ssl_types::evp_cipher_ctx_type;
40  using evp_cipher_type = ssl_types::evp_cipher_type;
41  using evp_md_ctx_type = ssl_types::evp_md_ctx_type;
42  using evp_md_type = ssl_types::evp_md_type;
43  using x509_lookup_method_type = ssl_types::x509_lookup_method_type;
44  using x509_lookup_type = ssl_types::x509_lookup_type;
45  using x509_store_ctx_type = ssl_types::x509_store_ctx_type;
46  using x509_store_type = ssl_types::x509_store_type;
47  using x509_crl_type = ssl_types::x509_crl_type;
48  using x509_type = ssl_types::x509_type;
49  using x509_stack_type = ssl_types::x509_stack_type;
50 
51  using passwd_callback_type = int(char*, int, int, void*);
52 
53  using x509_store_ctx_verify_callback_type = int(int, x509_store_ctx_type*);
54 
55 #ifdef __GNUC__
56  EAGINE_DIAG_PUSH()
57  EAGINE_DIAG_OFF(address)
58 #endif
59  template <
60  typename Signature,
61  c_api_function_ptr<api_traits, nothing_t, Signature> Function>
62  using ssl_api_function = eagine::opt_c_api_function<
63  api_traits,
64  nothing_t,
65  Signature,
66  Function,
67  has_api,
68  bool(Function)>;
69 #ifdef __GNUC__
70  EAGINE_DIAG_POP()
71 #endif
72 
73  // error
74  ssl_api_function<unsigned long(), EAGINE_SSL_STATIC_FUNC(ERR_get_error)>
75  err_get_error;
76 
77  ssl_api_function<unsigned long(), EAGINE_SSL_STATIC_FUNC(ERR_peek_error)>
78  err_peek_error;
79 
80  ssl_api_function<
81  void(unsigned long, char*, size_t),
82  EAGINE_SSL_STATIC_FUNC(ERR_error_string_n)>
83  err_error_string_n;
84 
85  // ui method
86  ssl_api_function<const ui_method_type*(), EAGINE_SSL_STATIC_FUNC(UI_null)>
87  ui_null;
88 
89  ssl_api_function<ui_method_type*(), EAGINE_SSL_STATIC_FUNC(UI_OpenSSL)>
90  ui_openssl;
91 
92  ssl_api_function<
93  const ui_method_type*(),
94  EAGINE_SSL_STATIC_FUNC(UI_get_default_method)>
95  ui_get_default_method;
96 
97  // engine
98  ssl_api_function<void(), EAGINE_SSL_STATIC_FUNC(ENGINE_load_builtin_engines)>
99  engine_load_builtin_engines;
100 
101  ssl_api_function<engine_type*(), EAGINE_SSL_STATIC_FUNC(ENGINE_get_first)>
102  engine_get_first;
103 
104  ssl_api_function<engine_type*(), EAGINE_SSL_STATIC_FUNC(ENGINE_get_last)>
105  engine_get_last;
106 
107  ssl_api_function<
108  engine_type*(engine_type*),
109  EAGINE_SSL_STATIC_FUNC(ENGINE_get_next)>
110  engine_get_next;
111 
112  ssl_api_function<
113  engine_type*(engine_type*),
114  EAGINE_SSL_STATIC_FUNC(ENGINE_get_prev)>
115  engine_get_prev;
116 
117  ssl_api_function<engine_type*(), EAGINE_SSL_STATIC_FUNC(ENGINE_new)>
118  engine_new;
119 
120  ssl_api_function<
121  engine_type*(const char*),
122  EAGINE_SSL_STATIC_FUNC(ENGINE_by_id)>
123  engine_by_id;
124 
125  ssl_api_function<int(engine_type*), EAGINE_SSL_STATIC_FUNC(ENGINE_up_ref)>
126  engine_up_ref;
127 
128  ssl_api_function<int(engine_type*), EAGINE_SSL_STATIC_FUNC(ENGINE_free)>
129  engine_free;
130 
131  ssl_api_function<int(engine_type*), EAGINE_SSL_STATIC_FUNC(ENGINE_init)>
132  engine_init;
133 
134  ssl_api_function<int(engine_type*), EAGINE_SSL_STATIC_FUNC(ENGINE_finish)>
135  engine_finish;
136 
137  ssl_api_function<
138  const char*(const engine_type*),
139  EAGINE_SSL_STATIC_FUNC(ENGINE_get_id)>
140  engine_get_id;
141 
142  ssl_api_function<
143  const char*(const engine_type*),
144  EAGINE_SSL_STATIC_FUNC(ENGINE_get_name)>
145  engine_get_name;
146 
147  ssl_api_function<
148  int(engine_type*),
149  EAGINE_SSL_STATIC_FUNC(ENGINE_set_default_RSA)>
150  engine_set_default_rsa;
151 
152  ssl_api_function<
153  int(engine_type*),
154  EAGINE_SSL_STATIC_FUNC(ENGINE_set_default_DSA)>
155  engine_set_default_dsa;
156 
157  ssl_api_function<
158  int(engine_type*),
159  EAGINE_SSL_STATIC_FUNC(ENGINE_set_default_DH)>
160  engine_set_default_dh;
161 
162  ssl_api_function<
163  int(engine_type*),
164  EAGINE_SSL_STATIC_FUNC(ENGINE_set_default_RAND)>
165  engine_set_default_rand;
166 
167  ssl_api_function<
168  int(engine_type*),
169  EAGINE_SSL_STATIC_FUNC(ENGINE_set_default_ciphers)>
170  engine_set_default_ciphers;
171 
172  ssl_api_function<
173  int(engine_type*),
174  EAGINE_SSL_STATIC_FUNC(ENGINE_set_default_digests)>
175  engine_set_default_digests;
176 
177  ssl_api_function<
178  evp_pkey_type*(engine_type*, const char*, ui_method_type*, void*),
179  EAGINE_SSL_STATIC_FUNC(ENGINE_load_private_key)>
180  engine_load_private_key;
181 
182  ssl_api_function<
183  evp_pkey_type*(engine_type*, const char*, ui_method_type*, void*),
184  EAGINE_SSL_STATIC_FUNC(ENGINE_load_public_key)>
185  engine_load_public_key;
186 
187  // bio
188  ssl_api_function<
189  bio_type*(const bio_method_type*),
190  EAGINE_SSL_STATIC_FUNC(BIO_new)>
191  bio_new;
192 
193  ssl_api_function<
194  bio_type*(const void*, int),
195  EAGINE_SSL_STATIC_FUNC(BIO_new_mem_buf)>
196  bio_new_mem_buf;
197 
198  ssl_api_function<int(bio_type*), EAGINE_SSL_STATIC_FUNC(BIO_up_ref)>
199  bio_up_ref;
200 
201  ssl_api_function<int(bio_type*), EAGINE_SSL_STATIC_FUNC(BIO_free)> bio_free;
202 
203  ssl_api_function<void(bio_type*), EAGINE_SSL_STATIC_FUNC(BIO_free_all)>
204  bio_free_all;
205 
206  // random
207  ssl_api_function<
208  int(unsigned char*, int num),
209  EAGINE_SSL_STATIC_FUNC(RAND_bytes)>
210  rand_bytes;
211 
212  // pkey
213  ssl_api_function<evp_pkey_type*(), EAGINE_SSL_STATIC_FUNC(EVP_PKEY_new)>
214  evp_pkey_new;
215 
216  ssl_api_function<int(evp_pkey_type*), EAGINE_SSL_STATIC_FUNC(EVP_PKEY_up_ref)>
217  evp_pkey_up_ref;
218 
219  ssl_api_function<void(evp_pkey_type*), EAGINE_SSL_STATIC_FUNC(EVP_PKEY_free)>
220  evp_pkey_free;
221 
222  ssl_api_function<
223  const evp_cipher_type*(),
224  EAGINE_SSL_STATIC_FUNC(EVP_aes_128_ctr)>
225  evp_aes_128_ctr;
226 
227  ssl_api_function<
228  const evp_cipher_type*(),
229  EAGINE_SSL_STATIC_FUNC(EVP_aes_128_ccm)>
230  evp_aes_128_ccm;
231 
232  ssl_api_function<
233  const evp_cipher_type*(),
234  EAGINE_SSL_STATIC_FUNC(EVP_aes_128_gcm)>
235  evp_aes_128_gcm;
236 
237  ssl_api_function<
238  const evp_cipher_type*(),
239  EAGINE_SSL_STATIC_FUNC(EVP_aes_128_xts)>
240  evp_aes_128_xts;
241 
242  ssl_api_function<
243  const evp_cipher_type*(),
244  EAGINE_SSL_STATIC_FUNC(EVP_aes_192_ecb)>
245  evp_aes_192_ecb;
246 
247  ssl_api_function<
248  const evp_cipher_type*(),
249  EAGINE_SSL_STATIC_FUNC(EVP_aes_192_cbc)>
250  evp_aes_192_cbc;
251 
252  ssl_api_function<
253  evp_cipher_ctx_type*(),
254  EAGINE_SSL_STATIC_FUNC(EVP_CIPHER_CTX_new)>
255  evp_cipher_ctx_new;
256 
257  ssl_api_function<
258  int(evp_cipher_ctx_type*),
259  EAGINE_SSL_STATIC_FUNC(EVP_CIPHER_CTX_reset)>
260  evp_cipher_ctx_reset;
261 
262  ssl_api_function<
263  void(evp_cipher_ctx_type*),
264  EAGINE_SSL_STATIC_FUNC(EVP_CIPHER_CTX_free)>
265  evp_cipher_ctx_free;
266 
267  ssl_api_function<
268  int(
269  evp_cipher_ctx_type*,
270  const evp_cipher_type*,
271  const unsigned char*,
272  const unsigned char*,
273  int),
274  EAGINE_SSL_STATIC_FUNC(EVP_CipherInit)>
275  evp_cipher_init;
276 
277  ssl_api_function<
278  int(
279  evp_cipher_ctx_type*,
280  const evp_cipher_type*,
281  engine_type*,
282  const unsigned char*,
283  const unsigned char*,
284  int),
285  EAGINE_SSL_STATIC_FUNC(EVP_CipherInit_ex)>
286  evp_cipher_init_ex;
287 
288  ssl_api_function<
289  int(evp_cipher_ctx_type*, unsigned char*, int*, const unsigned char*, int),
290  EAGINE_SSL_STATIC_FUNC(EVP_CipherUpdate)>
291  evp_cipher_update;
292 
293  ssl_api_function<
294  int(evp_cipher_ctx_type*, unsigned char*, int*),
295  EAGINE_SSL_STATIC_FUNC(EVP_CipherFinal_ex)>
296  evp_cipher_final;
297 
298  ssl_api_function<
299  int(evp_cipher_ctx_type*, unsigned char*, int*),
300  EAGINE_SSL_STATIC_FUNC(EVP_CipherFinal_ex)>
301  evp_cipher_final_ex;
302 
303  ssl_api_function<
304  int(
305  evp_cipher_ctx_type*,
306  const evp_cipher_type*,
307  const unsigned char*,
308  const unsigned char*),
309  EAGINE_SSL_STATIC_FUNC(EVP_EncryptInit)>
310  evp_encrypt_init;
311 
312  ssl_api_function<
313  int(
314  evp_cipher_ctx_type*,
315  const evp_cipher_type*,
316  engine_type*,
317  const unsigned char*,
318  const unsigned char*),
319  EAGINE_SSL_STATIC_FUNC(EVP_EncryptInit_ex)>
320  evp_encrypt_init_ex;
321 
322  ssl_api_function<
323  int(evp_cipher_ctx_type*, unsigned char*, int*, const unsigned char*, int),
324  EAGINE_SSL_STATIC_FUNC(EVP_EncryptUpdate)>
325  evp_encrypt_update;
326 
327  ssl_api_function<
328  int(evp_cipher_ctx_type*, unsigned char*, int*),
329  EAGINE_SSL_STATIC_FUNC(EVP_EncryptFinal_ex)>
330  evp_encrypt_final;
331 
332  ssl_api_function<
333  int(evp_cipher_ctx_type*, unsigned char*, int*),
334  EAGINE_SSL_STATIC_FUNC(EVP_EncryptFinal_ex)>
335  evp_encrypt_final_ex;
336 
337  ssl_api_function<
338  int(
339  evp_cipher_ctx_type*,
340  const evp_cipher_type*,
341  const unsigned char*,
342  const unsigned char*),
343  EAGINE_SSL_STATIC_FUNC(EVP_DecryptInit)>
344  evp_decrypt_init;
345 
346  ssl_api_function<
347  int(
348  evp_cipher_ctx_type*,
349  const evp_cipher_type*,
350  engine_type*,
351  const unsigned char*,
352  const unsigned char*),
353  EAGINE_SSL_STATIC_FUNC(EVP_DecryptInit_ex)>
354  evp_decrypt_init_ex;
355 
356  ssl_api_function<
357  int(evp_cipher_ctx_type*, unsigned char*, int*, const unsigned char*, int),
358  EAGINE_SSL_STATIC_FUNC(EVP_DecryptUpdate)>
359  evp_decrypt_update;
360 
361  ssl_api_function<
362  int(evp_cipher_ctx_type*, unsigned char*, int*),
363  EAGINE_SSL_STATIC_FUNC(EVP_DecryptFinal_ex)>
364  evp_decrypt_final;
365 
366  ssl_api_function<
367  int(evp_cipher_ctx_type*, unsigned char*, int*),
368  EAGINE_SSL_STATIC_FUNC(EVP_DecryptFinal_ex)>
369  evp_decrypt_final_ex;
370 
371  ssl_api_function<const evp_md_type*(), EAGINE_SSL_STATIC_FUNC(EVP_md_null)>
372  evp_md_null;
373 
374  ssl_api_function<const evp_md_type*(), EAGINE_SSL_STATIC_FUNC(EVP_md5)>
375  evp_md5;
376 
377  ssl_api_function<const evp_md_type*(), EAGINE_SSL_STATIC_FUNC(EVP_sha1)>
378  evp_sha1;
379 
380  ssl_api_function<const evp_md_type*(), EAGINE_SSL_STATIC_FUNC(EVP_sha224)>
381  evp_sha224;
382 
383  ssl_api_function<const evp_md_type*(), EAGINE_SSL_STATIC_FUNC(EVP_sha256)>
384  evp_sha256;
385 
386  ssl_api_function<const evp_md_type*(), EAGINE_SSL_STATIC_FUNC(EVP_sha384)>
387  evp_sha384;
388 
389  ssl_api_function<const evp_md_type*(), EAGINE_SSL_STATIC_FUNC(EVP_sha512)>
390  evp_sha512;
391 
392  ssl_api_function<
393  const evp_md_type*(const char*),
394  EAGINE_SSL_STATIC_FUNC(EVP_get_digestbyname)>
395  evp_get_digest_by_name;
396 
397  ssl_api_function<int(const evp_md_type*), EAGINE_SSL_STATIC_FUNC(EVP_MD_size)>
398  evp_md_size;
399 
400  ssl_api_function<
401  int(const evp_md_type*),
402  EAGINE_SSL_STATIC_FUNC(EVP_MD_block_size)>
403  evp_md_block_size;
404 
405  ssl_api_function<evp_md_ctx_type*(), EAGINE_SSL_STATIC_FUNC(EVP_MD_CTX_new)>
406  evp_md_ctx_new;
407 
408  ssl_api_function<
409  int(evp_md_ctx_type*),
410  EAGINE_SSL_STATIC_FUNC(EVP_MD_CTX_reset)>
411  evp_md_ctx_reset;
412 
413  ssl_api_function<
414  void(evp_md_ctx_type*),
415  EAGINE_SSL_STATIC_FUNC(EVP_MD_CTX_free)>
416  evp_md_ctx_free;
417 
418  ssl_api_function<
419  int(evp_md_ctx_type*, const evp_md_type*),
420  EAGINE_SSL_STATIC_FUNC(EVP_DigestInit)>
421  evp_digest_init;
422 
423  ssl_api_function<
424  int(evp_md_ctx_type*, const evp_md_type*, engine_type*),
425  EAGINE_SSL_STATIC_FUNC(EVP_DigestInit_ex)>
426  evp_digest_init_ex;
427 
428  ssl_api_function<
429  int(evp_md_ctx_type*, const void*, size_t),
430  EAGINE_SSL_STATIC_FUNC(EVP_DigestUpdate)>
431  evp_digest_update;
432 
433  ssl_api_function<
434  int(evp_md_ctx_type*, unsigned char*, unsigned int*),
435  EAGINE_SSL_STATIC_FUNC(EVP_DigestFinal_ex)>
436  evp_digest_final;
437 
438  ssl_api_function<
439  int(evp_md_ctx_type*, unsigned char*, unsigned int*),
440  EAGINE_SSL_STATIC_FUNC(EVP_DigestFinal_ex)>
441  evp_digest_final_ex;
442 
443  ssl_api_function<
444  int(
445  evp_md_ctx_type*,
446  evp_pkey_ctx_type**,
447  const evp_md_type*,
448  engine_type*,
449  evp_pkey_type*),
450  EAGINE_SSL_STATIC_FUNC(EVP_DigestSignInit)>
451  evp_digest_sign_init;
452 
453  ssl_api_function<
454  int(evp_md_ctx_type*, const void*, size_t),
455  EAGINE_SSL_STATIC_FUNC(EVP_DigestUpdate)>
456  evp_digest_sign_update;
457 
458  ssl_api_function<
459  int(evp_md_ctx_type*, unsigned char*, size_t*),
460  EAGINE_SSL_STATIC_FUNC(EVP_DigestSignFinal)>
461  evp_digest_sign_final;
462 
463  ssl_api_function<
464  int(
465  evp_md_ctx_type*,
466  evp_pkey_ctx_type**,
467  const evp_md_type*,
468  engine_type*,
469  evp_pkey_type*),
470  EAGINE_SSL_STATIC_FUNC(EVP_DigestVerifyInit)>
471  evp_digest_verify_init;
472 
473  ssl_api_function<
474  int(evp_md_ctx_type*, const void*, size_t),
475  EAGINE_SSL_STATIC_FUNC(EVP_DigestUpdate)>
476  evp_digest_verify_update;
477 
478  ssl_api_function<
479  int(evp_md_ctx_type*, const unsigned char*, size_t),
480  EAGINE_SSL_STATIC_FUNC(EVP_DigestVerifyFinal)>
481  evp_digest_verify_final;
482 
483  // x509 lookup
484  ssl_api_function<
485  x509_lookup_method_type*(),
486  EAGINE_SSL_STATIC_FUNC(X509_LOOKUP_hash_dir)>
487  x509_lookup_hash_dir;
488 
489  ssl_api_function<
490  x509_lookup_method_type*(),
491  EAGINE_SSL_STATIC_FUNC(X509_LOOKUP_file)>
492  x509_lookup_file;
493 
494  // x509 store context
495  ssl_api_function<
496  x509_store_ctx_type*(),
497  EAGINE_SSL_STATIC_FUNC(X509_STORE_CTX_new)>
498  x509_store_ctx_new;
499 
500  ssl_api_function<
501  int(x509_store_ctx_type*, x509_store_type*, x509_type*, x509_stack_type*),
502  EAGINE_SSL_STATIC_FUNC(X509_STORE_CTX_init)>
503  x509_store_ctx_init;
504 
505  ssl_api_function<
506  void(x509_store_ctx_type*, x509_stack_type*),
507  EAGINE_SSL_STATIC_FUNC(X509_STORE_CTX_set0_trusted_stack)>
508  x509_store_ctx_set0_trusted_stack;
509 
510  ssl_api_function<
511  void(x509_store_ctx_type*, x509_stack_type*),
512  EAGINE_SSL_STATIC_FUNC(X509_STORE_CTX_set0_verified_chain)>
513  x509_store_ctx_set0_verified_chain;
514 
515  ssl_api_function<
516  void(x509_store_ctx_type*, x509_stack_type*),
517  EAGINE_SSL_STATIC_FUNC(X509_STORE_CTX_set0_untrusted)>
518  x509_store_ctx_set0_untrusted;
519 
520  ssl_api_function<
521  void(x509_store_ctx_type*),
522  EAGINE_SSL_STATIC_FUNC(X509_STORE_CTX_cleanup)>
523  x509_store_ctx_cleanup;
524 
525  ssl_api_function<
526  void(x509_store_ctx_type*),
527  EAGINE_SSL_STATIC_FUNC(X509_STORE_CTX_free)>
528  x509_store_ctx_free;
529 
530  ssl_api_function<
531  int(x509_store_ctx_type*),
532  EAGINE_SSL_STATIC_FUNC(X509_verify_cert)>
533  x509_verify_cert;
534 
535  // x509 store
536  ssl_api_function<x509_store_type*(), EAGINE_SSL_STATIC_FUNC(X509_STORE_new)>
537  x509_store_new;
538 
539  ssl_api_function<
540  int(x509_store_type*),
541  EAGINE_SSL_STATIC_FUNC(X509_STORE_up_ref)>
542  x509_store_up_ref;
543 
544  ssl_api_function<
545  int(x509_store_type*),
546  EAGINE_SSL_STATIC_FUNC(X509_STORE_lock)>
547  x509_store_lock;
548 
549  ssl_api_function<
550  int(x509_store_type*),
551  EAGINE_SSL_STATIC_FUNC(X509_STORE_unlock)>
552  x509_store_unlock;
553 
554  ssl_api_function<
555  void(x509_store_type*),
556  EAGINE_SSL_STATIC_FUNC(X509_STORE_free)>
557  x509_store_free;
558 
559  ssl_api_function<
560  int(x509_store_type*, x509_type*),
561  EAGINE_SSL_STATIC_FUNC(X509_STORE_add_cert)>
562  x509_store_add_cert;
563 
564  ssl_api_function<
565  int(x509_store_type*, x509_crl_type*),
566  EAGINE_SSL_STATIC_FUNC(X509_STORE_add_crl)>
567  x509_store_add_crl;
568 
569  ssl_api_function<
570  int(x509_store_type*, const char*, const char*),
571  EAGINE_SSL_STATIC_FUNC(X509_STORE_load_locations)>
572  x509_store_load_locations;
573 
574  // x509_crl
575  ssl_api_function<x509_crl_type*(), EAGINE_SSL_STATIC_FUNC(X509_CRL_new)>
576  x509_crl_new;
577 
578  ssl_api_function<void(x509_crl_type*), EAGINE_SSL_STATIC_FUNC(X509_CRL_free)>
579  x509_crl_free;
580 
581  // x509
582  ssl_api_function<x509_type*(), EAGINE_SSL_STATIC_FUNC(X509_new)> x509_new;
583 
584  ssl_api_function<
585  evp_pkey_type*(x509_type*),
586  EAGINE_SSL_STATIC_FUNC(X509_get_pubkey)>
587  x509_get_pubkey;
588 
589  ssl_api_function<
590  evp_pkey_type*(const x509_type*),
591  EAGINE_SSL_STATIC_FUNC(X509_get0_pubkey)>
592  x509_get0_pubkey;
593 
594  ssl_api_function<void(x509_type*), EAGINE_SSL_STATIC_FUNC(X509_free)>
595  x509_free;
596 
597  // pem
598  ssl_api_function<
599  evp_pkey_type*(bio_type*, evp_pkey_type**, passwd_callback_type*, void*),
600  EAGINE_SSL_STATIC_FUNC(PEM_read_bio_PrivateKey)>
601  pem_read_bio_private_key;
602 
603  ssl_api_function<
604  evp_pkey_type*(bio_type*, evp_pkey_type**, passwd_callback_type*, void*),
605  EAGINE_SSL_STATIC_FUNC(PEM_read_bio_PUBKEY)>
606  pem_read_bio_pubkey;
607 
608  ssl_api_function<
609  x509_crl_type*(bio_type*, x509_crl_type**, passwd_callback_type*, void*),
610  EAGINE_SSL_STATIC_FUNC(PEM_read_bio_X509_CRL)>
611  pem_read_bio_x509_crl;
612 
613  ssl_api_function<
614  x509_type*(bio_type*, x509_type**, passwd_callback_type*, void*),
615  EAGINE_SSL_STATIC_FUNC(PEM_read_bio_X509)>
616  pem_read_bio_x509;
617 
618  constexpr basic_ssl_c_api(api_traits& traits)
619  : err_get_error("ERR_get_error", traits, *this)
620  , err_peek_error("ERR_peek_error", traits, *this)
621  , err_error_string_n("ERR_error_string_n", traits, *this)
622  , ui_null("UI_null", traits, *this)
623  , ui_openssl("UI_OpenSSL", traits, *this)
624  , ui_get_default_method("UI_get_default_method", traits, *this)
625  , engine_load_builtin_engines("ENGINE_load_builtin_engines", traits, *this)
626  , engine_get_first("ENGINE_get_first", traits, *this)
627  , engine_get_last("ENGINE_get_last", traits, *this)
628  , engine_get_next("ENGINE_get_next", traits, *this)
629  , engine_get_prev("ENGINE_get_prev", traits, *this)
630  , engine_new("ENGINE_new", traits, *this)
631  , engine_by_id("ENGINE_by_id", traits, *this)
632  , engine_up_ref("ENGINE_up_ref", traits, *this)
633  , engine_free("ENGINE_free", traits, *this)
634  , engine_init("ENGINE_init", traits, *this)
635  , engine_finish("ENGINE_finish", traits, *this)
636  , engine_get_id("ENGINE_get_id", traits, *this)
637  , engine_get_name("ENGINE_get_name", traits, *this)
638  , engine_set_default_rsa("ENGINE_set_default_RSA", traits, *this)
639  , engine_set_default_dsa("ENGINE_set_default_DSA", traits, *this)
640  , engine_set_default_dh("ENGINE_set_default_DH", traits, *this)
641  , engine_set_default_rand("ENGINE_set_default_RAND", traits, *this)
642  , engine_set_default_ciphers("ENGINE_set_default_CIPHERS", traits, *this)
643  , engine_set_default_digests("ENGINE_set_default_DIGESTS", traits, *this)
644  , engine_load_private_key("ENGINE_load_private_key", traits, *this)
645  , engine_load_public_key("ENGINE_load_public_key", traits, *this)
646  , bio_new("BIO_new", traits, *this)
647  , bio_new_mem_buf("BIO_new_mem_buf", traits, *this)
648  , bio_up_ref("BIO_up_ref", traits, *this)
649  , bio_free("BIO_free", traits, *this)
650  , bio_free_all("BIO_free_all", traits, *this)
651  , rand_bytes("RAND_bytes", traits, *this)
652  , evp_pkey_new("EVP_PKEY_new", traits, *this)
653  , evp_pkey_up_ref("EVP_PKEY_up_ref", traits, *this)
654  , evp_pkey_free("EVP_PKEY_free", traits, *this)
655  , evp_aes_128_ctr("evp_aes_128_ctr", traits, *this)
656  , evp_aes_128_ccm("evp_aes_128_ccm", traits, *this)
657  , evp_aes_128_gcm("evp_aes_128_gcm", traits, *this)
658  , evp_aes_128_xts("evp_aes_128_xts", traits, *this)
659  , evp_aes_192_ecb("evp_aes_192_ecb", traits, *this)
660  , evp_aes_192_cbc("evp_aes_192_cbc", traits, *this)
661  , evp_cipher_ctx_new("EVP_CIPHER_CTX_new", traits, *this)
662  , evp_cipher_ctx_reset("EVP_CIPHER_CTX_reset", traits, *this)
663  , evp_cipher_ctx_free("EVP_CIPHER_CTX_free", traits, *this)
664  , evp_cipher_init("EVP_CipherInit", traits, *this)
665  , evp_cipher_init_ex("EVP_CipherInit_ex", traits, *this)
666  , evp_cipher_update("EVP_CipherUpdate", traits, *this)
667  , evp_cipher_final("EVP_CipherFinal", traits, *this)
668  , evp_cipher_final_ex("EVP_CipherFinal_ex", traits, *this)
669  , evp_encrypt_init("EVP_EncryptInit", traits, *this)
670  , evp_encrypt_init_ex("EVP_EncryptInit_ex", traits, *this)
671  , evp_encrypt_update("EVP_EncryptUpdate", traits, *this)
672  , evp_encrypt_final("EVP_EncryptFinal", traits, *this)
673  , evp_encrypt_final_ex("EVP_EncryptFinal_ex", traits, *this)
674  , evp_decrypt_init("EVP_DecryptInit", traits, *this)
675  , evp_decrypt_init_ex("EVP_DecryptInit_ex", traits, *this)
676  , evp_decrypt_update("EVP_DecryptUpdate", traits, *this)
677  , evp_decrypt_final("EVP_DecryptFinal", traits, *this)
678  , evp_decrypt_final_ex("EVP_DecryptFinal_ex", traits, *this)
679  , evp_md_null("EVP_md_null", traits, *this)
680  , evp_md5("EVP_md5", traits, *this)
681  , evp_sha1("EVP_sha1", traits, *this)
682  , evp_sha224("EVP_sha224", traits, *this)
683  , evp_sha256("EVP_sha256", traits, *this)
684  , evp_sha384("EVP_sha384", traits, *this)
685  , evp_sha512("EVP_sha512", traits, *this)
686  , evp_get_digest_by_name("EVP_get_digestbyname", traits, *this)
687  , evp_md_size("EVP_MD_size", traits, *this)
688  , evp_md_block_size("EVP_MD_block_size", traits, *this)
689  , evp_md_ctx_new("EVP_MD_CTX_new", traits, *this)
690  , evp_md_ctx_reset("EVP_MD_CTX_reset", traits, *this)
691  , evp_md_ctx_free("EVP_MD_CTX_free", traits, *this)
692  , evp_digest_init("EVP_DigestInit", traits, *this)
693  , evp_digest_init_ex("EVP_DigestInit_ex", traits, *this)
694  , evp_digest_update("EVP_DigestUpdate", traits, *this)
695  , evp_digest_final("EVP_DigestFinal", traits, *this)
696  , evp_digest_final_ex("EVP_DigestFinal_ex", traits, *this)
697  , evp_digest_sign_init("EVP_DigestSignInit", traits, *this)
698  , evp_digest_sign_update("EVP_DigestSignUpdate", traits, *this)
699  , evp_digest_sign_final("EVP_DigestSignFinal", traits, *this)
700  , evp_digest_verify_init("EVP_DigestVerifyInit", traits, *this)
701  , evp_digest_verify_update("EVP_DigestVerifyUpdate", traits, *this)
702  , evp_digest_verify_final("EVP_DigestVerifyFinal", traits, *this)
703  , x509_lookup_hash_dir("X509_LOOKUP_hash_dir", traits, *this)
704  , x509_lookup_file("X509_LOOKUP_file", traits, *this)
705  , x509_store_ctx_new("X509_STORE_CTX_new", traits, *this)
706  , x509_store_ctx_init("X509_STORE_CTX_init", traits, *this)
707  , x509_store_ctx_set0_trusted_stack(
708  "X509_STORE_CTX_set0_trusted_stack",
709  traits,
710  *this)
711  , x509_store_ctx_set0_verified_chain(
712  "X509_STORE_CTX_set0_verified_chain",
713  traits,
714  *this)
715  , x509_store_ctx_set0_untrusted(
716  "X509_STORE_CTX_set0_untrusted",
717  traits,
718  *this)
719  , x509_store_ctx_cleanup("X509_STORE_CTX_cleanup", traits, *this)
720  , x509_store_ctx_free("X509_STORE_CTX_free", traits, *this)
721  , x509_verify_cert("X509_verify_cert", traits, *this)
722  , x509_store_new("X509_STORE_new", traits, *this)
723  , x509_store_up_ref("X509_STORE_up_ref", traits, *this)
724  , x509_store_lock("X509_STORE_lock", traits, *this)
725  , x509_store_unlock("X509_STORE_unlock", traits, *this)
726  , x509_store_free("X509_STORE_free", traits, *this)
727  , x509_store_add_cert("X509_STORE_add_cert", traits, *this)
728  , x509_store_add_crl("X509_STORE_add_crl", traits, *this)
729  , x509_store_load_locations("X509_STORE_load_locations", traits, *this)
730  , x509_crl_new("X509_crl_new", traits, *this)
731  , x509_crl_free("X509_crl_free", traits, *this)
732  , x509_new("X509_new", traits, *this)
733  , x509_get_pubkey("X509_get_pubkey", traits, *this)
734  , x509_get0_pubkey("X509_get0_pubkey", traits, *this)
735  , x509_free("X509_free", traits, *this)
736  , pem_read_bio_private_key("PEM_read_bio_PrivateKey", traits, *this)
737  , pem_read_bio_pubkey("PEM_read_bio_PUBKEY", traits, *this)
738  , pem_read_bio_x509_crl("PEM_read_bio_X509_CRL", traits, *this)
739  , pem_read_bio_x509("PEM_read_bio_X509", traits, *this) {}
740 };
741 //------------------------------------------------------------------------------
742 using ssl_c_api = basic_ssl_c_api<ssl_api_traits>;
743 //------------------------------------------------------------------------------
744 } // namespace eagine::sslp
745 
746 #endif
std::conditional_t< IsAvailable, std::conditional_t< IsStatic, static_c_api_function< ApiTraits, Tag, Signature, function >, dynamic_c_api_function< ApiTraits, Tag, Signature > >, unimplemented_c_api_function< ApiTraits, Tag, Signature > > opt_c_api_function
Template alias used for switching between static and dynamic function.
Definition: c_api_wrap.hpp:1096
basic_address< false > address
Type alias for non-const memory address values.
Definition: address.hpp:203

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).