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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670 | /* GATE PROJECT LICENSE:
+----------------------------------------------------------------------------+
| Copyright(c) 2018-2025, Stefan Meislinger <sm@opengate.at> |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the following conditions are met:|
| |
| 1. Redistributions of source code must retain the above copyright notice, |
| this list of conditions and the following disclaimer. |
| 2. Redistributions in binary form must reproduce the above copyright |
| notice, this list of conditions and the following disclaimer in the |
| documentation and/or other materials provided with the distribution. |
| |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| THE POSSIBILITY OF SUCH DAMAGE. |
+----------------------------------------------------------------------------+
*/
#include "gate/net/platform/openssl_api.h"
#if defined(GATE_NET_SSL_SHAREDLIB)
struct lib_pair
{
char const* lib1;
char const* lib2;
};
static struct lib_pair ssl_lib_names[] = {
#if defined(GATE_SYS_WIN)
{ "libcrypto-1_1-x64.dll", "libssl-1_1-x64.dll" },
{ "libcrypto-1_1.dll", "libssl-1_1.dll" },
{ "libcrypto.dll", "libssl.dll" },
{ "libeay32.dll", "ssleay32.dll" }
#elif defined(GATE_SYS_DARWIN)
{ "libcrypto.dylib", "libssl.dylib" },
#else
{ "libcrypto.so.1.1", "libssl.so.1.1" },
{ "libcrypto.so", "libssl.so" }
#endif
};
static gate_size_t const ssl_lib_names_count = sizeof(ssl_lib_names) / sizeof(ssl_lib_names[0]);
static gate_result_t load_libssl_libs(gate_library_t* ptr_lib1, gate_library_t* ptr_lib2)
{
gate_result_t result;
gate_size_t ndx;
gate_library_t lib1, lib2;
gate_string_t libname;
for (ndx = 0; ndx != ssl_lib_names_count; ++ndx)
{
gate_string_create_static(&libname, ssl_lib_names[ndx].lib1);
result = gate_library_open(&libname, &lib1, GATE_LIBRARY_FLAG_DEFAULT);
if (GATE_FAILED(result))
{
continue;
}
if (ptr_lib2)
{
gate_string_create_static(&libname, ssl_lib_names[ndx].lib2);
result = gate_library_open(&libname, &lib2, GATE_LIBRARY_FLAG_DEFAULT);
if (GATE_FAILED(result))
{
gate_library_close(lib1);
continue;
}
*ptr_lib2 = lib2;
}
*ptr_lib1 = lib1;
return GATE_RESULT_OK;
}
return GATE_RESULT_FAILED;
}
static gate_result_t load_libssl_function(void* target_ptr, char const* name)
{
static gate_library_t lib1 = NULL, lib2 = NULL;
static gate_bool_t volatile libs_loaded = false;
gate_result_t ret;
do
{
if (!libs_loaded)
{
ret = load_libssl_libs(&lib1, &lib2);
if (GATE_FAILED(ret))
{
ret = load_libssl_libs(&lib1, NULL);
}
GATE_BREAK_IF_FAILED(ret);
libs_loaded = true;
}
ret = gate_library_get_function_name(lib1, name, target_ptr);
if (GATE_FAILED(ret) && lib2)
{
ret = gate_library_get_function_name(lib2, name, target_ptr);
}
} while (0);
return ret;
}
# define gate_get_libssl_function(func_ptr, func_name) \
ret = load_libssl_function(&func_ptr, #func_name ); \
if(GATE_FAILED(ret)) { break; }
# define gate_get_libssl_function_alt(func_ptr, func_name, alt_func_name) \
ret = load_libssl_function(&func_ptr, #func_name ); \
if(GATE_FAILED(ret)) { ret = load_libssl_function(&func_ptr, #alt_func_name ); } \
if(GATE_FAILED(ret)) { break; }
# define gate_get_libssl_function_optional(func_ptr, func_name) \
load_libssl_function(&func_ptr, #func_name )
#else
# define gate_get_libssl_function_static(func_ptr, func_name) (func_ptr) = & (func_name)
# define gate_get_libssl_function(func_ptr, func_name) gate_get_libssl_function_static(func_ptr, func_name)
# define gate_get_libssl_function_optional(func_ptr, func_name) gate_get_libssl_function(func_ptr, func_name)
# define gate_get_libssl_function_alt(func_ptr, func_name, alt_func_name) gate_get_libssl_function(func_ptr, func_name)
#endif
static gate_libcrypto_api_t glob_libcrypto;
static gate_libssl_api_t glob_libssl;
static gate_result_t load_libcrypto()
{
static volatile gate_bool_t libcrypto_loaded = false;
gate_result_t ret = GATE_RESULT_OK;
if (!libcrypto_loaded)
{
ret = GATE_RESULT_FAILED;<--- Variable 'ret' is reassigned a value before the old one has been used.<--- Variable 'ret' is reassigned a value before the old one has been used.
do
{
/* crypto functions: */
gate_get_libssl_function_optional(glob_libcrypto.api_OPENSSL_cleanup, OPENSSL_cleanup);
gate_get_libssl_function_optional(glob_libcrypto.api_OPENSSL_init_crypto, OPENSSL_init_crypto);
gate_get_libssl_function(glob_libcrypto.api_ERR_load_BIO_strings, ERR_load_BIO_strings);<--- Variable 'ret' is reassigned a value before the old one has been used.
gate_get_libssl_function(glob_libcrypto.api_ERR_clear_error, ERR_clear_error);
gate_get_libssl_function(glob_libcrypto.api_ERR_remove_thread_state, ERR_remove_thread_state);
gate_get_libssl_function(glob_libcrypto.api_BIO_s_mem, BIO_s_mem);
gate_get_libssl_function(glob_libcrypto.api_BIO_new_mem_buf, BIO_new_mem_buf);
gate_get_libssl_function(glob_libcrypto.api_BIO_new, BIO_new);
gate_get_libssl_function(glob_libcrypto.api_BIO_new_file, BIO_new_file);
gate_get_libssl_function(glob_libcrypto.api_BIO_ctrl, BIO_ctrl);
gate_get_libssl_function(glob_libcrypto.api_BIO_free_all, BIO_free_all);
gate_get_libssl_function(glob_libcrypto.api_BIO_free, BIO_free);
gate_get_libssl_function(glob_libcrypto.api_BIO_read, BIO_read);
gate_get_libssl_function(glob_libcrypto.api_BIO_test_flags, BIO_test_flags);
gate_get_libssl_function(glob_libcrypto.api_BIO_write, BIO_write);
gate_get_libssl_function(glob_libcrypto.api_BIO_new_bio_pair, BIO_new_bio_pair);
gate_get_libssl_function(glob_libcrypto.api_DH_new, DH_new);
gate_get_libssl_function(glob_libcrypto.api_DH_free, DH_free);
gate_get_libssl_function(glob_libcrypto.api_DH_generate_parameters_ex, DH_generate_parameters_ex);
gate_get_libssl_function(glob_libcrypto.api_DH_check, DH_check);
gate_get_libssl_function(glob_libcrypto.api_DH_generate_key, DH_generate_key);
gate_get_libssl_function(glob_libcrypto.api_PEM_read_bio_RSAPrivateKey, PEM_read_bio_RSAPrivateKey);
gate_get_libssl_function(glob_libcrypto.api_RSA_new, RSA_new);
gate_get_libssl_function(glob_libcrypto.api_RSA_size, RSA_size);
gate_get_libssl_function(glob_libcrypto.api_RSA_set0_key, RSA_set0_key);
gate_get_libssl_function(glob_libcrypto.api_RSA_set0_factors, RSA_set0_factors);
gate_get_libssl_function(glob_libcrypto.api_RSA_set0_crt_params, RSA_set0_crt_params);
gate_get_libssl_function(glob_libcrypto.api_RSA_get0_key, RSA_get0_key);
gate_get_libssl_function(glob_libcrypto.api_RSA_get0_factors, RSA_get0_factors);
gate_get_libssl_function(glob_libcrypto.api_RSA_sign, RSA_sign);
gate_get_libssl_function(glob_libcrypto.api_RSA_verify, RSA_verify);
gate_get_libssl_function(glob_libcrypto.api_RSA_free, RSA_free);
gate_get_libssl_function(glob_libcrypto.api_PEM_read_bio_X509, PEM_read_bio_X509);
gate_get_libssl_function(glob_libcrypto.api_PEM_read_bio_DSAPrivateKey, PEM_read_bio_DSAPrivateKey);
gate_get_libssl_function(glob_libcrypto.api_PEM_read_bio_ECPrivateKey, PEM_read_bio_ECPrivateKey);
gate_get_libssl_function(glob_libcrypto.api_PEM_read_bio_PrivateKey, PEM_read_bio_PrivateKey);
gate_get_libssl_function(glob_libcrypto.api_X509_free, X509_free);
gate_get_libssl_function(glob_libcrypto.api_X509_get_serialNumber, X509_get_serialNumber);
gate_get_libssl_function(glob_libcrypto.api_X509_get_subject_name, X509_get_subject_name);
gate_get_libssl_function(glob_libcrypto.api_X509_get_issuer_name, X509_get_issuer_name);
gate_get_libssl_function(glob_libcrypto.api_X509_NAME_print_ex, X509_NAME_print_ex);
gate_get_libssl_function(glob_libcrypto.api_X509_NAME_oneline, X509_NAME_oneline);
gate_get_libssl_function(glob_libcrypto.api_ASN1_TIME_new, ASN1_TIME_new);
gate_get_libssl_function(glob_libcrypto.api_ASN1_TIME_set_string, ASN1_TIME_set_string);
gate_get_libssl_function(glob_libcrypto.api_ASN1_STRING_free, ASN1_STRING_free);
gate_get_libssl_function(glob_libcrypto.api_ASN1_TIME_print, ASN1_TIME_print);
gate_get_libssl_function(glob_libcrypto.api_HMAC_CTX_new, HMAC_CTX_new);
gate_get_libssl_function(glob_libcrypto.api_HMAC_CTX_free, HMAC_CTX_free);
gate_get_libssl_function(glob_libcrypto.api_HMAC_Init_ex, HMAC_Init_ex);
gate_get_libssl_function(glob_libcrypto.api_HMAC_Update, HMAC_Update);
gate_get_libssl_function(glob_libcrypto.api_HMAC_Final, HMAC_Final);
gate_get_libssl_function(glob_libcrypto.api_EVP_md5, EVP_md5);
gate_get_libssl_function(glob_libcrypto.api_EVP_md5_sha1, EVP_md5_sha1);
gate_get_libssl_function(glob_libcrypto.api_EVP_sha1, EVP_sha1);
gate_get_libssl_function(glob_libcrypto.api_EVP_sha256, EVP_sha256);
gate_get_libssl_function(glob_libcrypto.api_EVP_sha512, EVP_sha512);
gate_get_libssl_function(glob_libcrypto.api_EVP_ripemd160, EVP_ripemd160);
gate_get_libssl_function(glob_libcrypto.api_EVP_get_digestbyname, EVP_get_digestbyname);
gate_get_libssl_function(glob_libcrypto.api_EVP_CIPHER_CTX_new, EVP_CIPHER_CTX_new);
gate_get_libssl_function(glob_libcrypto.api_EVP_CIPHER_CTX_free, EVP_CIPHER_CTX_free);
gate_get_libssl_function(glob_libcrypto.api_EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX_ctrl);
gate_get_libssl_function(glob_libcrypto.api_EVP_CipherInit, EVP_CipherInit);
gate_get_libssl_function(glob_libcrypto.api_EVP_Cipher, EVP_Cipher);
gate_get_libssl_function(glob_libcrypto.api_EVP_des_ede3_cbc, EVP_des_ede3_cbc);
gate_get_libssl_function(glob_libcrypto.api_EVP_rc4, EVP_rc4);
gate_get_libssl_function(glob_libcrypto.api_EVP_bf_cbc, EVP_bf_cbc);
gate_get_libssl_function(glob_libcrypto.api_EVP_cast5_cbc, EVP_cast5_cbc);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_128_cbc, EVP_aes_128_cbc);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_128_ctr, EVP_aes_128_ctr);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_128_gcm, EVP_aes_128_gcm);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_192_cbc, EVP_aes_192_cbc);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_192_ctr, EVP_aes_192_ctr);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_256_cbc, EVP_aes_256_cbc);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_256_ctr, EVP_aes_256_ctr);
gate_get_libssl_function(glob_libcrypto.api_EVP_aes_256_gcm, EVP_aes_256_gcm);
gate_get_libssl_function(glob_libcrypto.api_EVP_MD_CTX_new, EVP_MD_CTX_new);
gate_get_libssl_function(glob_libcrypto.api_EVP_MD_CTX_free, EVP_MD_CTX_free);
gate_get_libssl_function(glob_libcrypto.api_EVP_DigestInit, EVP_DigestInit);
gate_get_libssl_function(glob_libcrypto.api_EVP_DigestUpdate, EVP_DigestUpdate);
gate_get_libssl_function(glob_libcrypto.api_EVP_DigestFinal, EVP_DigestFinal);
gate_get_libssl_function(glob_libcrypto.api_EVP_DigestVerifyInit, EVP_DigestVerifyInit);
gate_get_libssl_function_optional(glob_libcrypto.api_EVP_DigestVerify, EVP_DigestVerify);
gate_get_libssl_function(glob_libcrypto.api_EVP_DigestSignInit, EVP_DigestSignInit);
gate_get_libssl_function_optional(glob_libcrypto.api_EVP_DigestSign, EVP_DigestSign);
gate_get_libssl_function_alt(glob_libcrypto.api_EVP_PKEY_id, EVP_PKEY_id, EVP_PKEY_get_id);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_set1_RSA, EVP_PKEY_set1_RSA);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_get1_RSA, EVP_PKEY_get1_RSA);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_set1_DSA, EVP_PKEY_set1_DSA);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_get1_DSA, EVP_PKEY_get1_DSA);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_set1_EC_KEY, EVP_PKEY_set1_EC_KEY);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_get1_EC_KEY, EVP_PKEY_get1_EC_KEY);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_new, EVP_PKEY_new);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_free, EVP_PKEY_free);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_CTX_new, EVP_PKEY_CTX_new);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_new_id);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_CTX_free, EVP_PKEY_CTX_free);
gate_get_libssl_function_optional(glob_libcrypto.api_EVP_PKEY_new_raw_private_key, EVP_PKEY_new_raw_private_key);
gate_get_libssl_function_optional(glob_libcrypto.api_EVP_PKEY_new_raw_public_key, EVP_PKEY_new_raw_public_key);
gate_get_libssl_function_optional(glob_libcrypto.api_EVP_PKEY_get_raw_private_key, EVP_PKEY_get_raw_private_key);
gate_get_libssl_function_optional(glob_libcrypto.api_EVP_PKEY_get_raw_public_key, EVP_PKEY_get_raw_public_key);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_derive_init, EVP_PKEY_derive_init);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_derive_set_peer, EVP_PKEY_derive_set_peer);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_derive, EVP_PKEY_derive);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_keygen_init, EVP_PKEY_keygen_init);
gate_get_libssl_function(glob_libcrypto.api_EVP_PKEY_keygen, EVP_PKEY_keygen);
gate_get_libssl_function(glob_libcrypto.api_DSA_SIG_new, DSA_SIG_new);
gate_get_libssl_function(glob_libcrypto.api_DSA_SIG_free, DSA_SIG_free);
gate_get_libssl_function(glob_libcrypto.api_DSA_SIG_get0, DSA_SIG_get0);
gate_get_libssl_function(glob_libcrypto.api_DSA_SIG_set0, DSA_SIG_set0);
gate_get_libssl_function(glob_libcrypto.api_DSA_do_sign, DSA_do_sign);
gate_get_libssl_function(glob_libcrypto.api_DSA_do_verify, DSA_do_verify);
gate_get_libssl_function(glob_libcrypto.api_DSA_new, DSA_new);
gate_get_libssl_function(glob_libcrypto.api_DSA_free, DSA_free);
gate_get_libssl_function(glob_libcrypto.api_DSA_get0_pqg, DSA_get0_pqg);
gate_get_libssl_function(glob_libcrypto.api_DSA_set0_pqg, DSA_set0_pqg);
gate_get_libssl_function(glob_libcrypto.api_DSA_get0_key, DSA_get0_key);
gate_get_libssl_function(glob_libcrypto.api_DSA_set0_key, DSA_set0_key);
gate_get_libssl_function(glob_libcrypto.api_EC_GROUP_get_curve_name, EC_GROUP_get_curve_name);
gate_get_libssl_function(glob_libcrypto.api_EC_GROUP_get_degree, EC_GROUP_get_degree);
gate_get_libssl_function(glob_libcrypto.api_EC_POINT_new, EC_POINT_new);
gate_get_libssl_function(glob_libcrypto.api_EC_POINT_free, EC_POINT_free);
gate_get_libssl_function(glob_libcrypto.api_EC_POINT_point2oct, EC_POINT_point2oct);
gate_get_libssl_function(glob_libcrypto.api_EC_POINT_oct2point, EC_POINT_oct2point);
gate_get_libssl_function(glob_libcrypto.api_EC_KEY_new_by_curve_name, EC_KEY_new_by_curve_name);
gate_get_libssl_function(glob_libcrypto.api_EC_KEY_free, EC_KEY_free);
gate_get_libssl_function(glob_libcrypto.api_EC_KEY_get0_group, EC_KEY_get0_group);
gate_get_libssl_function(glob_libcrypto.api_EC_KEY_set_private_key, EC_KEY_set_private_key);
gate_get_libssl_function(glob_libcrypto.api_EC_KEY_get0_public_key, EC_KEY_get0_public_key);
gate_get_libssl_function(glob_libcrypto.api_EC_KEY_set_public_key, EC_KEY_set_public_key);
gate_get_libssl_function(glob_libcrypto.api_EC_KEY_generate_key, EC_KEY_generate_key);
gate_get_libssl_function(glob_libcrypto.api_BN_value_one, BN_value_one);
gate_get_libssl_function(glob_libcrypto.api_BN_set_word, BN_set_word);
gate_get_libssl_function(glob_libcrypto.api_BN_CTX_new, BN_CTX_new);
gate_get_libssl_function(glob_libcrypto.api_BN_CTX_free, BN_CTX_free);
gate_get_libssl_function(glob_libcrypto.api_BN_rand, BN_rand);
gate_get_libssl_function(glob_libcrypto.api_BN_num_bits, BN_num_bits);
gate_get_libssl_function(glob_libcrypto.api_BN_new, BN_new);
gate_get_libssl_function(glob_libcrypto.api_BN_clear_free, BN_clear_free);
gate_get_libssl_function(glob_libcrypto.api_BN_bin2bn, BN_bin2bn);
gate_get_libssl_function(glob_libcrypto.api_BN_bn2bin, BN_bn2bin);
gate_get_libssl_function(glob_libcrypto.api_BN_sub, BN_sub);
gate_get_libssl_function(glob_libcrypto.api_BN_div, BN_div);
gate_get_libssl_function(glob_libcrypto.api_BN_mod_exp, BN_mod_exp);
gate_get_libssl_function(glob_libcrypto.api_ECDH_compute_key, ECDH_compute_key);
gate_get_libssl_function(glob_libcrypto.api_ECDSA_SIG_new, ECDSA_SIG_new);
gate_get_libssl_function(glob_libcrypto.api_ECDSA_SIG_free, ECDSA_SIG_free);
gate_get_libssl_function(glob_libcrypto.api_ECDSA_SIG_get0, ECDSA_SIG_get0);
gate_get_libssl_function(glob_libcrypto.api_ECDSA_SIG_set0, ECDSA_SIG_set0);
gate_get_libssl_function(glob_libcrypto.api_ECDSA_do_sign, ECDSA_do_sign);
gate_get_libssl_function(glob_libcrypto.api_ECDSA_do_verify, ECDSA_do_verify);
gate_get_libssl_function(glob_libcrypto.api_ENGINE_load_builtin_engines, ENGINE_load_builtin_engines);
gate_get_libssl_function(glob_libcrypto.api_ENGINE_register_all_complete, ENGINE_register_all_complete);
gate_get_libssl_function(glob_libcrypto.api_RAND_bytes, RAND_bytes);
if (glob_libcrypto.api_OPENSSL_init_crypto)
{
static uint64_t const init_flags = 0
/* | OPENSSL_INIT_NO_LOAD_CONFIG */
| OPENSSL_INIT_LOAD_CRYPTO_STRINGS
| OPENSSL_INIT_ADD_ALL_CIPHERS
| OPENSSL_INIT_ADD_ALL_DIGESTS
| OPENSSL_INIT_ENGINE_RDRAND
| OPENSSL_INIT_ENGINE_DYNAMIC
| OPENSSL_INIT_ENGINE_OPENSSL
| OPENSSL_INIT_ENGINE_CRYPTODEV
| OPENSSL_INIT_ENGINE_CAPI
| OPENSSL_INIT_ENGINE_PADLOCK
| OPENSSL_INIT_ENGINE_AFALG
| 0;<--- Same expression on both sides of '|'. [+]Finding the same expression on both sides of an operator is suspicious and might indicate a cut and paste or logic error. Please examine this code carefully to determine if it is correct.
glob_libcrypto.api_OPENSSL_init_crypto(init_flags, NULL);
}
ret = GATE_RESULT_OK;<--- Variable 'ret' is reassigned a value before the old one has been used.
libcrypto_loaded = true;
} while (0);
}
return ret;
}
static gate_result_t load_libssl()
{
static volatile gate_bool_t libssl_loaded = false;
gate_result_t ret = GATE_RESULT_OK;
if (!libssl_loaded)
{
ret = GATE_RESULT_FAILED;<--- Variable 'ret' is reassigned a value before the old one has been used.<--- Variable 'ret' is reassigned a value before the old one has been used.
do
{
/* ssl/tls functions: */
gate_get_libssl_function(glob_libssl.api_OPENSSL_init_ssl, OPENSSL_init_ssl);<--- Variable 'ret' is reassigned a value before the old one has been used.
/*gate_get_libssl_function(glob_libssl.api_SSL_load_error_strings, SSL_load_error_strings);*/
/*gate_get_libssl_function(glob_libssl.api_OPENSSL_add_all_algorithms_noconf, OPENSSL_add_all_algorithms_noconf);*/
gate_get_libssl_function(glob_libssl.api_SSL_CTX_new, SSL_CTX_new);
gate_get_libssl_function(glob_libssl.api_SSL_CTX_free, SSL_CTX_free);
gate_get_libssl_function(glob_libssl.api_SSL_CTX_ctrl, SSL_CTX_ctrl);
gate_get_libssl_function(glob_libssl.api_SSL_CTX_use_certificate, SSL_CTX_use_certificate);
gate_get_libssl_function(glob_libssl.api_SSL_CTX_use_PrivateKey, SSL_CTX_use_PrivateKey);
gate_get_libssl_function(glob_libssl.api_SSL_CTX_set_cipher_list, SSL_CTX_set_cipher_list);
gate_get_libssl_function(glob_libssl.api_SSL_CTX_use_RSAPrivateKey, SSL_CTX_use_RSAPrivateKey);
/*#ifndef GATE_NET_SSL_API_OPENSSL*/
gate_get_libssl_function(glob_libssl.api_SSL_CTX_set_alpn_select_cb, SSL_CTX_set_alpn_select_cb);
/*#endif*/
gate_get_libssl_function(glob_libssl.api_TLS_client_method, TLS_client_method);
#if defined(GATE_NET_SSL_OLDPROTOCOLS)
gate_get_libssl_function(glob_libssl.api_TLSv1_client_method, TLSv1_client_method);
gate_get_libssl_function(glob_libssl.api_TLSv1_1_client_method, TLSv1_1_client_method);
gate_get_libssl_function(glob_libssl.api_TLSv1_2_client_method, TLSv1_2_client_method);
#endif
gate_get_libssl_function_optional(glob_libssl.api_TLSv1_3_client_method, TLS_client_method);
gate_get_libssl_function_optional(glob_libssl.api_SSLv3_client_method, SSLv23_client_method);
if (NULL == glob_libssl.api_TLSv1_3_client_method)
{
glob_libssl.api_TLSv1_3_client_method = glob_libssl.api_TLS_client_method;
}
if (NULL == glob_libssl.api_SSLv3_client_method)
{
glob_libssl.api_SSLv3_client_method = glob_libssl.api_TLS_client_method;
}
gate_get_libssl_function(glob_libssl.api_TLS_server_method, TLS_server_method);
#if defined(GATE_NET_SSL_OLDPROTOCOLS)
gate_get_libssl_function(glob_libssl.api_TLSv1_server_method, TLSv1_server_method);
gate_get_libssl_function(glob_libssl.api_TLSv1_1_server_method, TLSv1_1_server_method);
gate_get_libssl_function(glob_libssl.api_TLSv1_2_server_method, TLSv1_2_server_method);
#endif
gate_get_libssl_function(glob_libssl.api_TLSv1_3_server_method, TLS_server_method);
gate_get_libssl_function_optional(glob_libssl.api_SSLv3_server_method, SSLv23_server_method);
if (NULL == glob_libssl.api_TLSv1_3_server_method)
{
glob_libssl.api_TLSv1_3_server_method = glob_libssl.api_TLS_server_method;
}
if (NULL == glob_libssl.api_SSLv3_server_method)
{
glob_libssl.api_SSLv3_server_method = glob_libssl.api_TLS_server_method;
}
gate_get_libssl_function(glob_libssl.api_SSL_new, SSL_new);
gate_get_libssl_function(glob_libssl.api_SSL_ctrl, SSL_ctrl);
gate_get_libssl_function(glob_libssl.api_SSL_set_fd, SSL_set_fd);
gate_get_libssl_function(glob_libssl.api_SSL_set_bio, SSL_set_bio);
gate_get_libssl_function(glob_libssl.api_SSL_accept, SSL_accept);
gate_get_libssl_function(glob_libssl.api_SSL_connect, SSL_connect);
gate_get_libssl_function(glob_libssl.api_SSL_read, SSL_read);
gate_get_libssl_function(glob_libssl.api_SSL_write, SSL_write);
gate_get_libssl_function(glob_libssl.api_SSL_get_error, SSL_get_error);
gate_get_libssl_function(glob_libssl.api_SSL_pending, SSL_pending);
gate_get_libssl_function(glob_libssl.api_SSL_set_connect_state, SSL_set_connect_state);
gate_get_libssl_function(glob_libssl.api_SSL_set_accept_state, SSL_set_accept_state);
#ifdef GATE_NET_SSL_API_OPENSSL
gate_get_libssl_function(glob_libssl.api_SSL_state, SSL_get_state);
#else
/* libreSSL uses another function name and implements "SSL_get_state" as a macro */
gate_get_libssl_function(glob_libssl.api_SSL_state, SSL_state);
#endif
gate_get_libssl_function(glob_libssl.api_SSL_do_handshake, SSL_do_handshake);
gate_get_libssl_function(glob_libssl.api_SSL_get_verify_result, SSL_get_verify_result);
gate_get_libssl_function(glob_libssl.api_SSL_shutdown, SSL_shutdown);
gate_get_libssl_function(glob_libssl.api_SSL_free, SSL_free);
gate_get_libssl_function(glob_libssl.api_SSL_select_next_proto, SSL_select_next_proto);
/*#ifndef GATE_NET_SSL_API_OPENSSL*/
gate_get_libssl_function(glob_libssl.api_SSL_get0_alpn_selected, SSL_get0_alpn_selected);
/*#endif*/
gate_get_libssl_function(glob_libssl.api_SSL_get_peer_certificate, SSL_get_peer_certificate);
gate_get_libssl_function(glob_libssl.api_SSL_get_certificate, SSL_get_certificate);
gate_get_libssl_function(glob_libssl.api_BIO_new_ssl_connect, BIO_new_ssl_connect);
ret = GATE_RESULT_OK;<--- Variable 'ret' is reassigned a value before the old one has been used.
libssl_loaded = true;
} while (0);
}
return ret;
}
gate_result_t gate_libcrypto_load_api(gate_libcrypto_api_t* ptr_api_table)
{
gate_result_t result = load_libcrypto();
if (GATE_SUCCEEDED(result) && ptr_api_table)
{
*ptr_api_table = glob_libcrypto;
}
return result;
}
gate_result_t gate_libssl_load_api(gate_libssl_api_t* ptr_api_table)
{
gate_result_t result = gate_libcrypto_load_api(NULL);
if (GATE_SUCCEEDED(result))
{
result = load_libssl();
if (GATE_SUCCEEDED(result) && ptr_api_table)
{
*ptr_api_table = glob_libssl;
}
}
return result;
}
#if defined(GATE_NET_SSL_SHAREDLIB)
/* CRYPTO FUNCTIONS */
int FIPS_mode(void) { return 0; }
const BIO_METHOD* BIO_s_mem(void) { return glob_libcrypto.api_BIO_s_mem(); }
BIO* BIO_new_mem_buf(void const* buf, int len) { return glob_libcrypto.api_BIO_new_mem_buf(buf, len); }
BIO* BIO_new(const BIO_METHOD* type) { return glob_libcrypto.api_BIO_new(type); }
BIO* BIO_new_file(const char* filename, const char* mode) { return glob_libcrypto.api_BIO_new_file(filename, mode); }
long BIO_ctrl(BIO* bp, int cmd, long larg, void* parg) { return glob_libcrypto.api_BIO_ctrl(bp, cmd, larg, parg); }
void BIO_free_all(BIO* a) { glob_libcrypto.api_BIO_free_all(a); }
int BIO_free(BIO* a) { return glob_libcrypto.api_BIO_free(a); }
int BIO_read(BIO* b, void* data, int len) { return glob_libcrypto.api_BIO_read(b, data, len); }
int BIO_test_flags(const BIO* b, int flags) { return glob_libcrypto.api_BIO_test_flags(b, flags); }
int BIO_write(BIO* b, const void* data, int len) { return glob_libcrypto.api_BIO_write(b, data, len); }
int BIO_new_bio_pair(BIO** bio1, size_t writebuf1, BIO** bio2, size_t writebuf2) { return glob_libcrypto.api_BIO_new_bio_pair(bio1, writebuf1, bio2, writebuf2); }
HMAC_CTX* HMAC_CTX_new(void) { return glob_libcrypto.api_HMAC_CTX_new(); }
void HMAC_CTX_free(HMAC_CTX* ctx) { glob_libcrypto.api_HMAC_CTX_free(ctx); }
int HMAC_Init_ex(HMAC_CTX* ctx, const void* key, int key_len, const EVP_MD* md, ENGINE* impl) { return glob_libcrypto.api_HMAC_Init_ex(ctx, key, key_len, md, impl); }
int HMAC_Update(HMAC_CTX* ctx, const unsigned char* data, size_t len) { return glob_libcrypto.api_HMAC_Update(ctx, data, len); }
int HMAC_Final(HMAC_CTX* ctx, unsigned char* md, unsigned int* len) { return glob_libcrypto.api_HMAC_Final(ctx, md, len); }
const EVP_MD* EVP_md5(void) { return glob_libcrypto.api_EVP_md5(); }
const EVP_MD* EVP_md5_sha1(void) { return glob_libcrypto.api_EVP_md5_sha1(); }
const EVP_MD* EVP_sha1(void) { return glob_libcrypto.api_EVP_sha1(); }
const EVP_MD* EVP_sha256(void) { return glob_libcrypto.api_EVP_sha256(); }
const EVP_MD* EVP_sha512(void) { return glob_libcrypto.api_EVP_sha512(); }
const EVP_MD* EVP_ripemd160(void) { return glob_libcrypto.api_EVP_ripemd160(); }
const EVP_MD* EVP_get_digestbyname(const char* name) { return glob_libcrypto.api_EVP_get_digestbyname(name); }
EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void) { return glob_libcrypto.api_EVP_CIPHER_CTX_new(); }
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX* ctx) { glob_libcrypto.api_EVP_CIPHER_CTX_free(ctx); }
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX* ctx, int cmd, int p1, void* p2) { return glob_libcrypto.api_EVP_CIPHER_CTX_ctrl(ctx, cmd, p1, p2); }
int EVP_CipherInit(EVP_CIPHER_CTX* ctx, const EVP_CIPHER* type, const unsigned char* key, const unsigned char* iv, int enc) { return glob_libcrypto.api_EVP_CipherInit(ctx, type, key, iv, enc); }
int EVP_Cipher(EVP_CIPHER_CTX* c, unsigned char* out, const unsigned char* in, unsigned int inl) { return glob_libcrypto.api_EVP_Cipher(c, out, in, inl); }
const EVP_CIPHER* EVP_des_ede3_cbc(void) { return glob_libcrypto.api_EVP_des_ede3_cbc(); }
const EVP_CIPHER* EVP_rc4(void) { return glob_libcrypto.api_EVP_rc4(); }
const EVP_CIPHER* EVP_bf_cbc(void) { return glob_libcrypto.api_EVP_bf_cbc(); }
const EVP_CIPHER* EVP_cast5_cbc(void) { return glob_libcrypto.api_EVP_cast5_cbc(); }
const EVP_CIPHER* EVP_aes_128_cbc(void) { return glob_libcrypto.api_EVP_aes_128_cbc(); }
const EVP_CIPHER* EVP_aes_128_ctr(void) { return glob_libcrypto.api_EVP_aes_128_ctr(); }
const EVP_CIPHER* EVP_aes_128_gcm(void) { return glob_libcrypto.api_EVP_aes_128_gcm(); }
const EVP_CIPHER* EVP_aes_192_cbc(void) { return glob_libcrypto.api_EVP_aes_192_cbc(); }
const EVP_CIPHER* EVP_aes_192_ctr(void) { return glob_libcrypto.api_EVP_aes_192_ctr(); }
const EVP_CIPHER* EVP_aes_256_cbc(void) { return glob_libcrypto.api_EVP_aes_256_cbc(); }
const EVP_CIPHER* EVP_aes_256_ctr(void) { return glob_libcrypto.api_EVP_aes_256_ctr(); }
const EVP_CIPHER* EVP_aes_256_gcm(void) { return glob_libcrypto.api_EVP_aes_256_gcm(); }
EVP_MD_CTX* EVP_MD_CTX_new(void) { return glob_libcrypto.api_EVP_MD_CTX_new(); }
void EVP_MD_CTX_free(EVP_MD_CTX* ctx) { glob_libcrypto.api_EVP_MD_CTX_free(ctx); }
int EVP_DigestInit(EVP_MD_CTX* ctx, const EVP_MD* type) { return glob_libcrypto.api_EVP_DigestInit(ctx, type); }
int EVP_DigestUpdate(EVP_MD_CTX* ctx, const void* d, size_t cnt) { return glob_libcrypto.api_EVP_DigestUpdate(ctx, d, cnt); }
int EVP_DigestFinal(EVP_MD_CTX* ctx, unsigned char* md, unsigned int* s) { return glob_libcrypto.api_EVP_DigestFinal(ctx, md, s); }
int EVP_DigestVerifyInit(EVP_MD_CTX* ctx, EVP_PKEY_CTX** pctx, const EVP_MD* type, ENGINE* e, EVP_PKEY* pkey) { return glob_libcrypto.api_EVP_DigestVerifyInit(ctx, pctx, type, e, pkey); }
int EVP_DigestSignInit(EVP_MD_CTX* ctx, EVP_PKEY_CTX** pctx, const EVP_MD* type, ENGINE* e, EVP_PKEY* pkey) { return glob_libcrypto.api_EVP_DigestSignInit(ctx, pctx, type, e, pkey); }
int EVP_DigestVerify(EVP_MD_CTX* ctx, const unsigned char* sigret, size_t siglen, const unsigned char* tbs, size_t tbslen)
{
if (!glob_libcrypto.api_EVP_DigestVerify) return 0;
return glob_libcrypto.api_EVP_DigestVerify(ctx, sigret, siglen, tbs, tbslen);
}
int EVP_DigestSign(EVP_MD_CTX* ctx, unsigned char* sigret, size_t* siglen, const unsigned char* tbs, size_t tbslen)
{
if (!glob_libcrypto.api_EVP_DigestSign) return 0;
return glob_libcrypto.api_EVP_DigestSign(ctx, sigret, siglen, tbs, tbslen);
}
int EVP_PKEY_id(const EVP_PKEY* pkey) { return glob_libcrypto.api_EVP_PKEY_id(pkey); }
int EVP_PKEY_set1_RSA(EVP_PKEY* pkey, RSA* key) { return glob_libcrypto.api_EVP_PKEY_set1_RSA(pkey, key); }
RSA* EVP_PKEY_get1_RSA(EVP_PKEY* pkey) { return glob_libcrypto.api_EVP_PKEY_get1_RSA(pkey); }
int EVP_PKEY_set1_DSA(EVP_PKEY* pkey, DSA* key) { return glob_libcrypto.api_EVP_PKEY_set1_DSA(pkey, key); }
DSA* EVP_PKEY_get1_DSA(EVP_PKEY* pkey) { return glob_libcrypto.api_EVP_PKEY_get1_DSA(pkey); }
int EVP_PKEY_set1_EC_KEY(EVP_PKEY* pkey, EC_KEY* key) { return glob_libcrypto.api_EVP_PKEY_set1_EC_KEY(pkey, key); }
EC_KEY* EVP_PKEY_get1_EC_KEY(EVP_PKEY* pkey) { return glob_libcrypto.api_EVP_PKEY_get1_EC_KEY(pkey); }
EVP_PKEY* EVP_PKEY_new(void) { return glob_libcrypto.api_EVP_PKEY_new(); }
void EVP_PKEY_free(EVP_PKEY* key) { glob_libcrypto.api_EVP_PKEY_free(key); }
EVP_PKEY_CTX* EVP_PKEY_CTX_new(EVP_PKEY* pkey, ENGINE* e) { return glob_libcrypto.api_EVP_PKEY_CTX_new(pkey, e); }
EVP_PKEY_CTX* EVP_PKEY_CTX_new_id(int id, ENGINE* e) { return glob_libcrypto.api_EVP_PKEY_CTX_new_id(id, e); }
void EVP_PKEY_CTX_free(EVP_PKEY_CTX* ctx) { glob_libcrypto.api_EVP_PKEY_CTX_free(ctx); }
int EVP_PKEY_derive_init(EVP_PKEY_CTX* ctx) { return glob_libcrypto.api_EVP_PKEY_derive_init(ctx); }
int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX* ctx, EVP_PKEY* peer) { return glob_libcrypto.api_EVP_PKEY_derive_set_peer(ctx, peer); }
int EVP_PKEY_derive(EVP_PKEY_CTX* ctx, unsigned char* key, size_t* keylen) { return glob_libcrypto.api_EVP_PKEY_derive(ctx, key, keylen); }
int EVP_PKEY_keygen_init(EVP_PKEY_CTX* ctx) { return glob_libcrypto.api_EVP_PKEY_keygen_init(ctx); }
int EVP_PKEY_keygen(EVP_PKEY_CTX* ctx, EVP_PKEY** ppkey) { return glob_libcrypto.api_EVP_PKEY_keygen(ctx, ppkey); }
EVP_PKEY* EVP_PKEY_new_raw_private_key(int type, ENGINE* e, const unsigned char* key, size_t keylen)
{
if (!glob_libcrypto.api_EVP_PKEY_new_raw_private_key) return NULL;
return glob_libcrypto.api_EVP_PKEY_new_raw_private_key(type, e, key, keylen);
}
EVP_PKEY* EVP_PKEY_new_raw_public_key(int type, ENGINE* e, const unsigned char* key, size_t keylen)
{
if (!glob_libcrypto.api_EVP_PKEY_new_raw_public_key) return NULL;
return glob_libcrypto.api_EVP_PKEY_new_raw_public_key(type, e, key, keylen);
}
int EVP_PKEY_get_raw_private_key(const EVP_PKEY* pkey, unsigned char* priv, size_t* len)
{
if (!glob_libcrypto.api_EVP_PKEY_get_raw_private_key) return 0;
return glob_libcrypto.api_EVP_PKEY_get_raw_private_key(pkey, priv, len);
}
int EVP_PKEY_get_raw_public_key(const EVP_PKEY* pkey, unsigned char* pub, size_t* len)
{
if (!glob_libcrypto.api_EVP_PKEY_get_raw_public_key) return 0;
return glob_libcrypto.api_EVP_PKEY_get_raw_public_key(pkey, pub, len);
}
RSA* RSA_new(void) { return glob_libcrypto.api_RSA_new(); }
int RSA_size(const RSA* rsa) { return glob_libcrypto.api_RSA_size(rsa); }
int RSA_set0_key(RSA* r, BIGNUM* n, BIGNUM* e, BIGNUM* d) { return glob_libcrypto.api_RSA_set0_key(r, n, e, d); }
int RSA_set0_factors(RSA* r, BIGNUM* p, BIGNUM* q) { return glob_libcrypto.api_RSA_set0_factors(r, p, q); }
int RSA_set0_crt_params(RSA* r, BIGNUM* dmp1, BIGNUM* dmq1, BIGNUM* iqmp) { return glob_libcrypto.api_RSA_set0_crt_params(r, dmp1, dmq1, iqmp); }
void RSA_get0_key(const RSA* r, const BIGNUM** n, const BIGNUM** e, const BIGNUM** d) { glob_libcrypto.api_RSA_get0_key(r, n, e, d); }
void RSA_get0_factors(const RSA* r, const BIGNUM** p, const BIGNUM** q) { glob_libcrypto.api_RSA_get0_factors(r, p, q); }
int RSA_sign(int type, const unsigned char* m, unsigned int m_len, unsigned char* sigret, unsigned int* siglen, RSA* rsa) { return glob_libcrypto.api_RSA_sign(type, m, m_len, sigret, siglen, rsa); }
int RSA_verify(int type, const unsigned char* m, unsigned int m_len, unsigned char* sigbuf, unsigned int siglen, RSA* rsa) { return glob_libcrypto.api_RSA_verify(type, m, m_len, sigbuf, siglen, rsa); }
void RSA_free(RSA* r) { glob_libcrypto.api_RSA_free(r); }
DSA_SIG* DSA_SIG_new(void) { return glob_libcrypto.api_DSA_SIG_new(); }
void DSA_SIG_free(DSA_SIG* a) { glob_libcrypto.api_DSA_SIG_free(a); }
void DSA_SIG_get0(const DSA_SIG* sig, const BIGNUM** pr, const BIGNUM** ps) { glob_libcrypto.api_DSA_SIG_get0(sig, pr, ps); }
int DSA_SIG_set0(DSA_SIG* sig, BIGNUM* r, BIGNUM* s) { return glob_libcrypto.api_DSA_SIG_set0(sig, r, s); }
DSA_SIG* DSA_do_sign(const unsigned char* dgst, int dlen, DSA* dsa) { return glob_libcrypto.api_DSA_do_sign(dgst, dlen, dsa); }
int DSA_do_verify(const unsigned char* dgst, int dgst_len, DSA_SIG* sig, DSA* dsa) { return glob_libcrypto.api_DSA_do_verify(dgst, dgst_len, sig, dsa); }
DSA* DSA_new(void) { return glob_libcrypto.api_DSA_new(); }
void DSA_free(DSA* dsa) { glob_libcrypto.api_DSA_free(dsa); }
void DSA_get0_pqg(const DSA* d, const BIGNUM** p, const BIGNUM** q, const BIGNUM** g) { glob_libcrypto.api_DSA_get0_pqg(d, p, q, g); }
int DSA_set0_pqg(DSA* d, BIGNUM* p, BIGNUM* q, BIGNUM* g) { return glob_libcrypto.api_DSA_set0_pqg(d, p, q, g); }
void DSA_get0_key(const DSA* d, const BIGNUM** pub_key, const BIGNUM** priv_key) { glob_libcrypto.api_DSA_get0_key(d, pub_key, priv_key); }
int DSA_set0_key(DSA* d, BIGNUM* pub_key, BIGNUM* priv_key) { return glob_libcrypto.api_DSA_set0_key(d, pub_key, priv_key); }
int EC_GROUP_get_curve_name(const EC_GROUP* group) { return glob_libcrypto.api_EC_GROUP_get_curve_name(group); }
int EC_GROUP_get_degree(const EC_GROUP* group) { return glob_libcrypto.api_EC_GROUP_get_degree(group); }
EC_POINT* EC_POINT_new(const EC_GROUP* group) { return glob_libcrypto.api_EC_POINT_new(group); }
void EC_POINT_free(EC_POINT* point) { glob_libcrypto.api_EC_POINT_free(point); }
size_t EC_POINT_point2oct(const EC_GROUP* group, const EC_POINT* p, point_conversion_form_t form, unsigned char* buf, size_t len, BN_CTX* ctx) { return glob_libcrypto.api_EC_POINT_point2oct(group, p, form, buf, len, ctx); }
int EC_POINT_oct2point(const EC_GROUP* group, EC_POINT* p, const unsigned char* buf, size_t len, BN_CTX* ctx) { return glob_libcrypto.api_EC_POINT_oct2point(group, p, buf, len, ctx); }
EC_KEY* EC_KEY_new_by_curve_name(int nid) { return glob_libcrypto.api_EC_KEY_new_by_curve_name(nid); }
void EC_KEY_free(EC_KEY* key) { glob_libcrypto.api_EC_KEY_free(key); }
const EC_GROUP* EC_KEY_get0_group(const EC_KEY* key) { return glob_libcrypto.api_EC_KEY_get0_group(key); }
int EC_KEY_set_private_key(EC_KEY* key, const BIGNUM* priv_key) { return glob_libcrypto.api_EC_KEY_set_private_key(key, priv_key); }
const EC_POINT* EC_KEY_get0_public_key(const EC_KEY* key) { return glob_libcrypto.api_EC_KEY_get0_public_key(key); }
int EC_KEY_set_public_key(EC_KEY* key, const EC_POINT* pub) { return glob_libcrypto.api_EC_KEY_set_public_key(key, pub); }
int EC_KEY_generate_key(EC_KEY* key) { return glob_libcrypto.api_EC_KEY_generate_key(key); }
const BIGNUM* BN_value_one(void) { return glob_libcrypto.api_BN_value_one(); }
int BN_set_word(BIGNUM* a, BN_ULONG w) { return glob_libcrypto.api_BN_set_word(a, w); }
BN_CTX* BN_CTX_new(void) { return glob_libcrypto.api_BN_CTX_new(); }
void BN_CTX_free(BN_CTX* c) { glob_libcrypto.api_BN_CTX_free(c); }
int BN_rand(BIGNUM* rnd, int bits, int top, int bottom) { return glob_libcrypto.api_BN_rand(rnd, bits, top, bottom); }
int BN_num_bits(const BIGNUM* a) { return glob_libcrypto.api_BN_num_bits(a); }
BIGNUM* BN_new(void) { return glob_libcrypto.api_BN_new(); }
void BN_clear_free(BIGNUM* a) { glob_libcrypto.api_BN_clear_free(a); }
BIGNUM* BN_bin2bn(const unsigned char* s, int len, BIGNUM* ret) { return glob_libcrypto.api_BN_bin2bn(s, len, ret); }
int BN_bn2bin(const BIGNUM* a, unsigned char* to) { return glob_libcrypto.api_BN_bn2bin(a, to); }
int BN_sub(BIGNUM* r, const BIGNUM* a, const BIGNUM* b) { return glob_libcrypto.api_BN_sub(r, a, b); }
int BN_div(BIGNUM* dv, BIGNUM* rem, const BIGNUM* a, const BIGNUM* d, BN_CTX* ctx) { return glob_libcrypto.api_BN_div(dv, rem, a, d, ctx); }
int BN_mod_exp(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, const BIGNUM* m, BN_CTX* ctx) { return glob_libcrypto.api_BN_mod_exp(r, a, p, m, ctx); }
int ECDH_compute_key(void* out, size_t outlen, const EC_POINT* public_key, const EC_KEY* ecdh, void* (*KDF)(const void* in, size_t inlen, void* out, size_t* outlen)) { return glob_libcrypto.api_ECDH_compute_key(out, outlen, public_key, ecdh, KDF); }
ECDSA_SIG* ECDSA_SIG_new(void) { return glob_libcrypto.api_ECDSA_SIG_new(); }
void ECDSA_SIG_free(ECDSA_SIG* sig) { glob_libcrypto.api_ECDSA_SIG_free(sig); }
void ECDSA_SIG_get0(const ECDSA_SIG* sig, const BIGNUM** pr, const BIGNUM** ps) { glob_libcrypto.api_ECDSA_SIG_get0(sig, pr, ps); }
int ECDSA_SIG_set0(ECDSA_SIG* sig, BIGNUM* r, BIGNUM* s) { return glob_libcrypto.api_ECDSA_SIG_set0(sig, r, s); }
ECDSA_SIG* ECDSA_do_sign(const unsigned char* dgst, int dgst_len, EC_KEY* eckey) { return glob_libcrypto.api_ECDSA_do_sign(dgst, dgst_len, eckey); }
int ECDSA_do_verify(const unsigned char* dgst, int dgst_len, const ECDSA_SIG* sig, EC_KEY* eckey) { return glob_libcrypto.api_ECDSA_do_verify(dgst, dgst_len, sig, eckey); }
RSA* PEM_read_bio_RSAPrivateKey(BIO* bp, RSA** x, pem_password_cb* cb, void* u) { return glob_libcrypto.api_PEM_read_bio_RSAPrivateKey(bp, x, cb, u); }
DSA* PEM_read_bio_DSAPrivateKey(BIO* bp, DSA** x, pem_password_cb* cb, void* u) { return glob_libcrypto.api_PEM_read_bio_DSAPrivateKey(bp, x, cb, u); }
EC_KEY* PEM_read_bio_ECPrivateKey(BIO* out, EC_KEY** x, pem_password_cb* cb, void* u) { return glob_libcrypto.api_PEM_read_bio_ECPrivateKey(out, x, cb, u); }
EVP_PKEY* PEM_read_bio_PrivateKey(BIO* bp, EVP_PKEY** x, pem_password_cb* cb, void* u) { return glob_libcrypto.api_PEM_read_bio_PrivateKey(bp, x, cb, u); }
void ENGINE_load_builtin_engines(void) { glob_libcrypto.api_ENGINE_load_builtin_engines(); }
int ENGINE_register_all_complete(void) { return glob_libcrypto.api_ENGINE_register_all_complete(); }
int RAND_bytes(unsigned char* buf, int num) { return glob_libcrypto.api_RAND_bytes(buf, num); }
#endif
|