package async_ssl

  1. Overview
  2. Docs

Source file ffi_generated.ml

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
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
module CI = Cstubs_internals

external async_ssl_stub_1_TLS_method : unit -> CI.voidp
  = "async_ssl_stub_1_TLS_method" 

external async_ssl_stub_2_TLSv1_method : unit -> CI.voidp
  = "async_ssl_stub_2_TLSv1_method" 

external async_ssl_stub_3_TLSv1_1_method : unit -> CI.voidp
  = "async_ssl_stub_3_TLSv1_1_method" 

external async_ssl_stub_4_TLSv1_2_method : unit -> CI.voidp
  = "async_ssl_stub_4_TLSv1_2_method" 

external async_ssl_stub_5_ERR_get_error : unit -> Unsigned.ulong
  = "async_ssl_stub_5_ERR_get_error" 

external async_ssl_stub_6_ERR_error_string_n
  : Unsigned.ulong -> _ CI.fatptr -> int -> unit
  = "async_ssl_stub_6_ERR_error_string_n" 

external async_ssl_stub_7_OpenSSL_add_all_digests : unit -> unit
  = "async_ssl_stub_7_OpenSSL_add_all_digests" 

external async_ssl_stub_8_OpenSSL_add_all_ciphers : unit -> unit
  = "async_ssl_stub_8_OpenSSL_add_all_ciphers" 

external async_ssl_stub_9_OpenSSL_add_ssl_algorithms : unit -> unit
  = "async_ssl_stub_9_OpenSSL_add_ssl_algorithms" 

external async_ssl_stub_10_OPENSSL_config : _ CI.fatptr -> unit
  = "async_ssl_stub_10_OPENSSL_config" 

external async_ssl_stub_11_SSL_library_init : unit -> Unsigned.ulong
  = "async_ssl_stub_11_SSL_library_init" 

external async_ssl_stub_12_SSL_load_error_strings : unit -> unit
  = "async_ssl_stub_12_SSL_load_error_strings" 

external async_ssl_stub_13_ERR_load_crypto_strings : unit -> unit
  = "async_ssl_stub_13_ERR_load_crypto_strings" 

external async_ssl_stub_14_ENGINE_load_builtin_engines : unit -> unit
  = "async_ssl_stub_14_ENGINE_load_builtin_engines" 

external async_ssl_stub_15_ENGINE_register_all_complete : unit -> unit
  = "async_ssl_stub_15_ENGINE_register_all_complete" 

external async_ssl_stub_16_SSL_CTX_new : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_16_SSL_CTX_new" 

external async_ssl_stub_17_SSL_CTX_free : _ CI.fatptr -> unit
  = "async_ssl_stub_17_SSL_CTX_free" 

external async_ssl_stub_18_SSL_CTX_set_security_level
  : _ CI.fatptr -> int -> unit
  = "async_ssl_stub_18_SSL_CTX_set_security_level" 

external async_ssl_stub_19_SSL_CTX_load_verify_locations
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_19_SSL_CTX_load_verify_locations" 

external async_ssl_stub_20_SSL_CTX_set_default_verify_paths
  : _ CI.fatptr -> int = "async_ssl_stub_20_SSL_CTX_set_default_verify_paths" 

external async_ssl_stub_21_SSL_CTX_set_session_id_context
  : _ CI.fatptr -> _ CI.fatptr -> Unsigned.uint -> int
  = "async_ssl_stub_21_SSL_CTX_set_session_id_context" 

external async_ssl_stub_22_SSL_CTX_set_cipher_list
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_22_SSL_CTX_set_cipher_list" 

external async_ssl_stub_23_SSL_CTX_set_options
  : _ CI.fatptr -> Unsigned.ulong -> Unsigned.ulong
  = "async_ssl_stub_23_SSL_CTX_set_options" 

external async_ssl_stub_24_SSL_CTX_use_certificate_chain_file
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_24_SSL_CTX_use_certificate_chain_file" 

external async_ssl_stub_25_SSL_CTX_use_certificate_file
  : _ CI.fatptr -> _ CI.fatptr -> int -> int
  = "async_ssl_stub_25_SSL_CTX_use_certificate_file" 

external async_ssl_stub_26_SSL_CTX_use_PrivateKey_file
  : _ CI.fatptr -> _ CI.fatptr -> int -> int
  = "async_ssl_stub_26_SSL_CTX_use_PrivateKey_file" 

external async_ssl_stub_27_BIO_new : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_27_BIO_new" 

external async_ssl_stub_28_BIO_s_mem : unit -> CI.voidp
  = "async_ssl_stub_28_BIO_s_mem" 

external async_ssl_stub_29_BIO_read
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_29_BIO_read" 

external async_ssl_stub_30_BIO_write
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_30_BIO_write" 

external async_ssl_stub_31_OBJ_obj2nid : _ CI.fatptr -> int
  = "async_ssl_stub_31_OBJ_obj2nid" 

external async_ssl_stub_32_OBJ_nid2sn : int -> CI.voidp
  = "async_ssl_stub_32_OBJ_nid2sn" 

external async_ssl_stub_33_OBJ_txt2nid : _ CI.fatptr -> int
  = "async_ssl_stub_33_OBJ_txt2nid" 

external async_ssl_stub_34_ASN1_STRING_length : _ CI.fatptr -> int
  = "async_ssl_stub_34_ASN1_STRING_length" 

external async_ssl_stub_35_ASN1_STRING_data : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_35_ASN1_STRING_data" 

external async_ssl_stub_36_X509_NAME_ENTRY_get_object
  : _ CI.fatptr -> CI.voidp = "async_ssl_stub_36_X509_NAME_ENTRY_get_object" 

external async_ssl_stub_37_X509_NAME_ENTRY_get_data : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_37_X509_NAME_ENTRY_get_data" 

external async_ssl_stub_38_X509_NAME_entry_count : _ CI.fatptr -> int
  = "async_ssl_stub_38_X509_NAME_entry_count" 

external async_ssl_stub_39_X509_NAME_get_entry
  : _ CI.fatptr -> int -> CI.voidp = "async_ssl_stub_39_X509_NAME_get_entry" 

external async_ssl_stub_40_EVP_sha1 : unit -> CI.voidp
  = "async_ssl_stub_40_EVP_sha1" 

external async_ssl_stub_41_X509_get_subject_name : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_41_X509_get_subject_name" 

external async_ssl_stub_42_X509_verify_cert_error_string
  : Signed.long -> CI.voidp
  = "async_ssl_stub_42_X509_verify_cert_error_string" 

external async_ssl_stub_43_X509_free : _ CI.fatptr -> unit
  = "async_ssl_stub_43_X509_free" 

external async_ssl_stub_44_async_ssl__subject_alt_names
  : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_44_async_ssl__subject_alt_names" 

external async_ssl_stub_45_async_ssl__free_subject_alt_names
  : _ CI.fatptr -> unit
  = "async_ssl_stub_45_async_ssl__free_subject_alt_names" 

external async_ssl_stub_46_X509_digest
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> bool
  = "async_ssl_stub_46_X509_digest" 

external async_ssl_stub_47_SSL_SESSION_new : unit -> CI.voidp
  = "async_ssl_stub_47_SSL_SESSION_new" 

external async_ssl_stub_48_SSL_SESSION_free : _ CI.fatptr -> unit
  = "async_ssl_stub_48_SSL_SESSION_free" 

external async_ssl_stub_49_BN_new : unit -> CI.voidp
  = "async_ssl_stub_49_BN_new" 

external async_ssl_stub_50_BN_free : _ CI.fatptr -> unit
  = "async_ssl_stub_50_BN_free" 

external async_ssl_stub_51_BN_bin2bn
  : _ CI.fatptr -> int -> _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_51_BN_bin2bn" 

external async_ssl_stub_52_BN_hex2bn : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_52_BN_hex2bn" 

external async_ssl_stub_53_DH_new : unit -> CI.voidp
  = "async_ssl_stub_53_DH_new" 

external async_ssl_stub_54_DH_free : _ CI.fatptr -> unit
  = "async_ssl_stub_54_DH_free" 

external async_ssl_stub_55_DH_generate_parameters
  : int -> int -> _ CI.fatfunptr -> _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_55_DH_generate_parameters" 

external async_ssl_stub_56_SSL_new : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_56_SSL_new" 

external async_ssl_stub_57_SSL_free : _ CI.fatptr -> unit
  = "async_ssl_stub_57_SSL_free" 

external async_ssl_stub_58_SSL_set_ssl_method
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_58_SSL_set_ssl_method" 

external async_ssl_stub_59_SSL_get_error : _ CI.fatptr -> int -> int
  = "async_ssl_stub_59_SSL_get_error" 

external async_ssl_stub_60_SSL_set_connect_state : _ CI.fatptr -> unit
  = "async_ssl_stub_60_SSL_set_connect_state" 

external async_ssl_stub_61_SSL_set_accept_state : _ CI.fatptr -> unit
  = "async_ssl_stub_61_SSL_set_accept_state" 

external async_ssl_stub_62_SSL_connect : _ CI.fatptr -> int
  = "async_ssl_stub_62_SSL_connect" 

external async_ssl_stub_63_SSL_accept : _ CI.fatptr -> int
  = "async_ssl_stub_63_SSL_accept" 

external async_ssl_stub_64_SSL_set_bio
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> unit
  = "async_ssl_stub_64_SSL_set_bio" 

external async_ssl_stub_65_SSL_read
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_65_SSL_read" 

external async_ssl_stub_66_SSL_write
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_66_SSL_write" 

external async_ssl_stub_67_SSL_set_verify
  : _ CI.fatptr -> int -> _ CI.fatptr -> unit
  = "async_ssl_stub_67_SSL_set_verify" 

external async_ssl_stub_68_SSL_set_cipher_list
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_68_SSL_set_cipher_list" 

external async_ssl_stub_69_SSL_get_cipher_list
  : _ CI.fatptr -> int -> CI.voidp = "async_ssl_stub_69_SSL_get_cipher_list" 

external async_ssl_stub_70_SSL_set1_groups_list
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_70_SSL_set1_groups_list" 

external async_ssl_stub_71_SSL_get_peer_certificate : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_71_SSL_get_peer_certificate" 

external async_ssl_stub_72_SSL_get_verify_result : _ CI.fatptr -> Signed.long
  = "async_ssl_stub_72_SSL_get_verify_result" 

external async_ssl_stub_73_SSL_get_version : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_73_SSL_get_version" 

external async_ssl_stub_74_SSL_set_session
  : _ CI.fatptr -> _ CI.fatptr -> int = "async_ssl_stub_74_SSL_set_session" 

external async_ssl_stub_75_SSL_session_reused : _ CI.fatptr -> int
  = "async_ssl_stub_75_SSL_session_reused" 

external async_ssl_stub_76_SSL_get1_session : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_76_SSL_get1_session" 

external async_ssl_stub_77_SSL_check_private_key : _ CI.fatptr -> int
  = "async_ssl_stub_77_SSL_check_private_key" 

external async_ssl_stub_78_SSL_set_tlsext_host_name
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_78_SSL_set_tlsext_host_name" 

external async_ssl_stub_79_async_ssl__pem_peer_certificate_chain
  : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_79_async_ssl__pem_peer_certificate_chain" 

external async_ssl_stub_80_async_ssl__free_pem_peer_certificate_chain
  : _ CI.fatptr -> unit
  = "async_ssl_stub_80_async_ssl__free_pem_peer_certificate_chain" 

type 'a result = 'a
type 'a return = 'a
type 'a fn =
 | Returns  : 'a CI.typ   -> 'a return fn
 | Function : 'a CI.typ * 'b fn  -> ('a -> 'b) fn
let map_result f x = f x
let returning t = Returns t
let (@->) f p = Function (f, p)
let foreign : type a b. string -> (a -> b) fn -> (a -> b) =
  fun name t -> match t, name with
| Function (CI.Pointer _, Returns CI.Void),
  "async_ssl__free_pem_peer_certificate_chain" ->
  (fun x1 ->
    let CI.CPointer x2 = x1 in
    async_ssl_stub_80_async_ssl__free_pem_peer_certificate_chain x2)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x5; read = x6; _})),
  "async_ssl__pem_peer_certificate_chain" ->
  (fun x3 ->
    let CI.CPointer x4 = x3 in
    x6
    (CI.make_ptr x5
       (async_ssl_stub_79_async_ssl__pem_peer_certificate_chain x4)))
| Function
    (CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int))),
  "SSL_set_tlsext_host_name" ->
  (fun x7 x9 ->
    let CI.CPointer x10 = x9 in
    let CI.CPointer x8 = x7 in
    async_ssl_stub_78_SSL_set_tlsext_host_name x8 x10)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "SSL_check_private_key" ->
  (fun x11 ->
    let CI.CPointer x12 = x11 in async_ssl_stub_77_SSL_check_private_key x12)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x15; read = x16; _})),
  "SSL_get1_session" ->
  (fun x13 ->
    let CI.CPointer x14 = x13 in
    x16 (CI.make_ptr x15 (async_ssl_stub_76_SSL_get1_session x14)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "SSL_session_reused" ->
  (fun x17 ->
    let CI.CPointer x18 = x17 in async_ssl_stub_75_SSL_session_reused x18)
| Function
    (CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int))),
  "SSL_set_session" ->
  (fun x19 x21 ->
    let CI.CPointer x22 = x21 in
    let CI.CPointer x20 = x19 in async_ssl_stub_74_SSL_set_session x20 x22)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x25; read = x26; _})),
  "SSL_get_version" ->
  (fun x23 ->
    let CI.CPointer x24 = x23 in
    x26 (CI.make_ptr x25 (async_ssl_stub_73_SSL_get_version x24)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Long)),
  "SSL_get_verify_result" ->
  (fun x27 ->
    let CI.CPointer x28 = x27 in async_ssl_stub_72_SSL_get_verify_result x28)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x31; read = x32; _})),
  "SSL_get_peer_certificate" ->
  (fun x29 ->
    let CI.CPointer x30 = x29 in
    x32 (CI.make_ptr x31 (async_ssl_stub_71_SSL_get_peer_certificate x30)))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x36; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_set1_groups_list" ->
  (fun x33 x35 ->
    let CI.CPointer x38 = x36 x35 in
    let CI.CPointer x34 = x33 in
    let x37 = x38 in async_ssl_stub_70_SSL_set1_groups_list x34 x37)
| Function
    (CI.Pointer _,
     Function
       (CI.Primitive CI.Int,
        Returns (CI.View {CI.ty = CI.Pointer x42; read = x43; _}))),
  "SSL_get_cipher_list" ->
  (fun x39 x41 ->
    let CI.CPointer x40 = x39 in
    x43 (CI.make_ptr x42 (async_ssl_stub_69_SSL_get_cipher_list x40 x41)))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x47; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_set_cipher_list" ->
  (fun x44 x46 ->
    let CI.CPointer x49 = x47 x46 in
    let CI.CPointer x45 = x44 in
    let x48 = x49 in async_ssl_stub_68_SSL_set_cipher_list x45 x48)
| Function
    (CI.Pointer _,
     Function (CI.Primitive CI.Int, Function (CI.Pointer _, Returns CI.Void))),
  "SSL_set_verify" ->
  (fun x50 x52 x53 ->
    let CI.CPointer x54 = x53 in
    let CI.CPointer x51 = x50 in async_ssl_stub_67_SSL_set_verify x51 x52 x54)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x58; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_write" ->
  (fun x55 x57 x61 ->
    let CI.CPointer x60 = x58 x57 in
    let CI.CPointer x56 = x55 in
    let x59 = x60 in async_ssl_stub_66_SSL_write x56 x59 x61)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_read" ->
  (fun x62 x64 x66 ->
    let CI.CPointer x65 = x64 in
    let CI.CPointer x63 = x62 in async_ssl_stub_65_SSL_read x63 x65 x66)
| Function
    (CI.Pointer _,
     Function (CI.Pointer _, Function (CI.Pointer _, Returns CI.Void))),
  "SSL_set_bio" ->
  (fun x67 x69 x71 ->
    let CI.CPointer x72 = x71 in
    let CI.CPointer x70 = x69 in
    let CI.CPointer x68 = x67 in async_ssl_stub_64_SSL_set_bio x68 x70 x72)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "SSL_accept" ->
  (fun x73 -> let CI.CPointer x74 = x73 in async_ssl_stub_63_SSL_accept x74)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "SSL_connect" ->
  (fun x75 -> let CI.CPointer x76 = x75 in async_ssl_stub_62_SSL_connect x76)
| Function (CI.Pointer _, Returns CI.Void), "SSL_set_accept_state" ->
  (fun x77 ->
    let CI.CPointer x78 = x77 in async_ssl_stub_61_SSL_set_accept_state x78)
| Function (CI.Pointer _, Returns CI.Void), "SSL_set_connect_state" ->
  (fun x79 ->
    let CI.CPointer x80 = x79 in async_ssl_stub_60_SSL_set_connect_state x80)
| Function
    (CI.Pointer _,
     Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int))),
  "SSL_get_error" ->
  (fun x81 x83 ->
    let CI.CPointer x82 = x81 in async_ssl_stub_59_SSL_get_error x82 x83)
| Function
    (CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int))),
  "SSL_set_ssl_method" ->
  (fun x84 x86 ->
    let CI.CPointer x87 = x86 in
    let CI.CPointer x85 = x84 in async_ssl_stub_58_SSL_set_ssl_method x85 x87)
| Function (CI.Pointer _, Returns CI.Void), "SSL_free" ->
  (fun x88 -> let CI.CPointer x89 = x88 in async_ssl_stub_57_SSL_free x89)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x92; read = x93; _})),
  "SSL_new" ->
  (fun x90 ->
    let CI.CPointer x91 = x90 in
    x93 (CI.make_ptr x92 (async_ssl_stub_56_SSL_new x91)))
| Function
    (CI.Primitive CI.Int,
     Function
       (CI.Primitive CI.Int,
        Function
          (CI.View {CI.ty = CI.Funptr _; write = x97; _},
           Function
             (CI.Pointer _,
              Returns (CI.View {CI.ty = CI.Pointer x102; read = x103; _}))))),
  "DH_generate_parameters" ->
  (fun x94 x95 x96 x100 ->
    let CI.CPointer x101 = x100 in
    let CI.Static_funptr x99 = x97 x96 in
    let x98 = x99 in
    x103
    (CI.make_ptr x102
       (async_ssl_stub_55_DH_generate_parameters x94 x95 x98 x101)))
| Function (CI.Pointer _, Returns CI.Void), "DH_free" ->
  (fun x104 -> let CI.CPointer x105 = x104 in async_ssl_stub_54_DH_free x105)
| Function
    (CI.Void, Returns (CI.View {CI.ty = CI.Pointer x107; read = x108; _})),
  "DH_new" ->
  (fun x106 -> x108 (CI.make_ptr x107 (async_ssl_stub_53_DH_new x106)))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x112; _},
        Returns (CI.Primitive CI.Int))),
  "BN_hex2bn" ->
  (fun x109 x111 ->
    let CI.CPointer x114 = x112 x111 in
    let CI.CPointer x110 = x109 in
    let x113 = x114 in async_ssl_stub_52_BN_hex2bn x110 x113)
| Function
    (CI.Pointer _,
     Function
       (CI.Primitive CI.Int,
        Function (CI.Pointer _, Returns (CI.Pointer x120)))),
  "BN_bin2bn" ->
  (fun x115 x117 x118 ->
    let CI.CPointer x119 = x118 in
    let CI.CPointer x116 = x115 in
    CI.make_ptr x120 (async_ssl_stub_51_BN_bin2bn x116 x117 x119))
| Function (CI.Pointer _, Returns CI.Void), "BN_free" ->
  (fun x121 -> let CI.CPointer x122 = x121 in async_ssl_stub_50_BN_free x122)
| Function
    (CI.Void, Returns (CI.View {CI.ty = CI.Pointer x124; read = x125; _})),
  "BN_new" ->
  (fun x123 -> x125 (CI.make_ptr x124 (async_ssl_stub_49_BN_new x123)))
| Function (CI.Pointer _, Returns CI.Void), "SSL_SESSION_free" ->
  (fun x126 ->
    let CI.CPointer x127 = x126 in async_ssl_stub_48_SSL_SESSION_free x127)
| Function
    (CI.Void, Returns (CI.View {CI.ty = CI.Pointer x129; read = x130; _})),
  "SSL_SESSION_new" ->
  (fun x128 ->
    x130 (CI.make_ptr x129 (async_ssl_stub_47_SSL_SESSION_new x128)))
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function
          (CI.Pointer _,
           Function (CI.Pointer _, Returns (CI.Primitive CI.Bool))))),
  "X509_digest" ->
  (fun x131 x133 x135 x137 ->
    let CI.CPointer x138 = x137 in
    let CI.CPointer x136 = x135 in
    let CI.CPointer x134 = x133 in
    let CI.CPointer x132 = x131 in
    async_ssl_stub_46_X509_digest x132 x134 x136 x138)
| Function (CI.Pointer _, Returns CI.Void),
  "async_ssl__free_subject_alt_names" ->
  (fun x139 ->
    let CI.CPointer x140 = x139 in
    async_ssl_stub_45_async_ssl__free_subject_alt_names x140)
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x143; read = x144; _})),
  "async_ssl__subject_alt_names" ->
  (fun x141 ->
    let CI.CPointer x142 = x141 in
    x144
    (CI.make_ptr x143 (async_ssl_stub_44_async_ssl__subject_alt_names x142)))
| Function (CI.Pointer _, Returns CI.Void), "X509_free" ->
  (fun x145 ->
    let CI.CPointer x146 = x145 in async_ssl_stub_43_X509_free x146)
| Function
    (CI.Primitive CI.Long,
     Returns (CI.View {CI.ty = CI.Pointer x148; read = x149; _})),
  "X509_verify_cert_error_string" ->
  (fun x147 ->
    x149
    (CI.make_ptr x148 (async_ssl_stub_42_X509_verify_cert_error_string x147)))
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x152; read = x153; _})),
  "X509_get_subject_name" ->
  (fun x150 ->
    let CI.CPointer x151 = x150 in
    x153 (CI.make_ptr x152 (async_ssl_stub_41_X509_get_subject_name x151)))
| Function (CI.Void, Returns (CI.Pointer x155)), "EVP_sha1" ->
  (fun x154 -> CI.make_ptr x155 (async_ssl_stub_40_EVP_sha1 x154))
| Function
    (CI.Pointer _, Function (CI.Primitive CI.Int, Returns (CI.Pointer x159))),
  "X509_NAME_get_entry" ->
  (fun x156 x158 ->
    let CI.CPointer x157 = x156 in
    CI.make_ptr x159 (async_ssl_stub_39_X509_NAME_get_entry x157 x158))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "X509_NAME_entry_count" ->
  (fun x160 ->
    let CI.CPointer x161 = x160 in
    async_ssl_stub_38_X509_NAME_entry_count x161)
| Function (CI.Pointer _, Returns (CI.Pointer x164)),
  "X509_NAME_ENTRY_get_data" ->
  (fun x162 ->
    let CI.CPointer x163 = x162 in
    CI.make_ptr x164 (async_ssl_stub_37_X509_NAME_ENTRY_get_data x163))
| Function (CI.Pointer _, Returns (CI.Pointer x167)),
  "X509_NAME_ENTRY_get_object" ->
  (fun x165 ->
    let CI.CPointer x166 = x165 in
    CI.make_ptr x167 (async_ssl_stub_36_X509_NAME_ENTRY_get_object x166))
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x170; read = x171; _})),
  "ASN1_STRING_data" ->
  (fun x168 ->
    let CI.CPointer x169 = x168 in
    x171 (CI.make_ptr x170 (async_ssl_stub_35_ASN1_STRING_data x169)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "ASN1_STRING_length" ->
  (fun x172 ->
    let CI.CPointer x173 = x172 in async_ssl_stub_34_ASN1_STRING_length x173)
| Function
    (CI.View {CI.ty = CI.Pointer _; write = x175; _},
     Returns (CI.Primitive CI.Int)),
  "OBJ_txt2nid" ->
  (fun x174 ->
    let CI.CPointer x177 = x175 x174 in
    let x176 = x177 in async_ssl_stub_33_OBJ_txt2nid x176)
| Function
    (CI.Primitive CI.Int,
     Returns (CI.View {CI.ty = CI.Pointer x179; read = x180; _})),
  "OBJ_nid2sn" ->
  (fun x178 -> x180 (CI.make_ptr x179 (async_ssl_stub_32_OBJ_nid2sn x178)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "OBJ_obj2nid" ->
  (fun x181 ->
    let CI.CPointer x182 = x181 in async_ssl_stub_31_OBJ_obj2nid x182)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x186; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "BIO_write" ->
  (fun x183 x185 x189 ->
    let CI.CPointer x188 = x186 x185 in
    let CI.CPointer x184 = x183 in
    let x187 = x188 in async_ssl_stub_30_BIO_write x184 x187 x189)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "BIO_read" ->
  (fun x190 x192 x194 ->
    let CI.CPointer x193 = x192 in
    let CI.CPointer x191 = x190 in async_ssl_stub_29_BIO_read x191 x193 x194)
| Function (CI.Void, Returns (CI.Pointer x196)), "BIO_s_mem" ->
  (fun x195 -> CI.make_ptr x196 (async_ssl_stub_28_BIO_s_mem x195))
| Function (CI.Pointer _, Returns (CI.Pointer x199)), "BIO_new" ->
  (fun x197 ->
    let CI.CPointer x198 = x197 in
    CI.make_ptr x199 (async_ssl_stub_27_BIO_new x198))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x203; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_use_PrivateKey_file" ->
  (fun x200 x202 x206 ->
    let CI.CPointer x205 = x203 x202 in
    let CI.CPointer x201 = x200 in
    let x204 = x205 in
    async_ssl_stub_26_SSL_CTX_use_PrivateKey_file x201 x204 x206)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x210; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_use_certificate_file" ->
  (fun x207 x209 x213 ->
    let CI.CPointer x212 = x210 x209 in
    let CI.CPointer x208 = x207 in
    let x211 = x212 in
    async_ssl_stub_25_SSL_CTX_use_certificate_file x208 x211 x213)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x217; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_CTX_use_certificate_chain_file" ->
  (fun x214 x216 ->
    let CI.CPointer x219 = x217 x216 in
    let CI.CPointer x215 = x214 in
    let x218 = x219 in
    async_ssl_stub_24_SSL_CTX_use_certificate_chain_file x215 x218)
| Function
    (CI.Pointer _,
     Function (CI.Primitive CI.Ulong, Returns (CI.Primitive CI.Ulong))),
  "SSL_CTX_set_options" ->
  (fun x220 x222 ->
    let CI.CPointer x221 = x220 in
    async_ssl_stub_23_SSL_CTX_set_options x221 x222)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x226; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_CTX_set_cipher_list" ->
  (fun x223 x225 ->
    let CI.CPointer x228 = x226 x225 in
    let CI.CPointer x224 = x223 in
    let x227 = x228 in async_ssl_stub_22_SSL_CTX_set_cipher_list x224 x227)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function (CI.Primitive CI.Uint, Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_set_session_id_context" ->
  (fun x229 x231 x233 ->
    let CI.CPointer x232 = x231 in
    let CI.CPointer x230 = x229 in
    async_ssl_stub_21_SSL_CTX_set_session_id_context x230 x232 x233)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "SSL_CTX_set_default_verify_paths" ->
  (fun x234 ->
    let CI.CPointer x235 = x234 in
    async_ssl_stub_20_SSL_CTX_set_default_verify_paths x235)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x239; _},
        Function
          (CI.View {CI.ty = CI.Pointer _; write = x243; _},
           Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_load_verify_locations" ->
  (fun x236 x238 x242 ->
    let CI.CPointer x245 = x243 x242 in
    let CI.CPointer x241 = x239 x238 in
    let CI.CPointer x237 = x236 in
    let x240 = x241 in
    let x244 = x245 in
    async_ssl_stub_19_SSL_CTX_load_verify_locations x237 x240 x244)
| Function (CI.Pointer _, Function (CI.Primitive CI.Int, Returns CI.Void)),
  "SSL_CTX_set_security_level" ->
  (fun x246 x248 ->
    let CI.CPointer x247 = x246 in
    async_ssl_stub_18_SSL_CTX_set_security_level x247 x248)
| Function (CI.Pointer _, Returns CI.Void), "SSL_CTX_free" ->
  (fun x249 ->
    let CI.CPointer x250 = x249 in async_ssl_stub_17_SSL_CTX_free x250)
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x253; read = x254; _})),
  "SSL_CTX_new" ->
  (fun x251 ->
    let CI.CPointer x252 = x251 in
    x254 (CI.make_ptr x253 (async_ssl_stub_16_SSL_CTX_new x252)))
| Function (CI.Void, Returns CI.Void), "ENGINE_register_all_complete" ->
  async_ssl_stub_15_ENGINE_register_all_complete
| Function (CI.Void, Returns CI.Void), "ENGINE_load_builtin_engines" ->
  async_ssl_stub_14_ENGINE_load_builtin_engines
| Function (CI.Void, Returns CI.Void), "ERR_load_crypto_strings" ->
  async_ssl_stub_13_ERR_load_crypto_strings
| Function (CI.Void, Returns CI.Void), "SSL_load_error_strings" ->
  async_ssl_stub_12_SSL_load_error_strings
| Function (CI.Void, Returns (CI.Primitive CI.Ulong)), "SSL_library_init" ->
  async_ssl_stub_11_SSL_library_init
| Function (CI.View {CI.ty = CI.Pointer _; write = x261; _}, Returns CI.Void),
  "OPENSSL_config" ->
  (fun x260 ->
    let CI.CPointer x263 = x261 x260 in
    let x262 = x263 in async_ssl_stub_10_OPENSSL_config x262)
| Function (CI.Void, Returns CI.Void), "OpenSSL_add_ssl_algorithms" ->
  async_ssl_stub_9_OpenSSL_add_ssl_algorithms
| Function (CI.Void, Returns CI.Void), "OpenSSL_add_all_ciphers" ->
  async_ssl_stub_8_OpenSSL_add_all_ciphers
| Function (CI.Void, Returns CI.Void), "OpenSSL_add_all_digests" ->
  async_ssl_stub_7_OpenSSL_add_all_digests
| Function
    (CI.Primitive CI.Ulong,
     Function (CI.Pointer _, Function (CI.Primitive CI.Int, Returns CI.Void))),
  "ERR_error_string_n" ->
  (fun x267 x268 x270 ->
    let CI.CPointer x269 = x268 in
    async_ssl_stub_6_ERR_error_string_n x267 x269 x270)
| Function (CI.Void, Returns (CI.Primitive CI.Ulong)), "ERR_get_error" ->
  async_ssl_stub_5_ERR_get_error
| Function (CI.Void, Returns (CI.Pointer x273)), "TLSv1_2_method" ->
  (fun x272 -> CI.make_ptr x273 (async_ssl_stub_4_TLSv1_2_method x272))
| Function (CI.Void, Returns (CI.Pointer x275)), "TLSv1_1_method" ->
  (fun x274 -> CI.make_ptr x275 (async_ssl_stub_3_TLSv1_1_method x274))
| Function (CI.Void, Returns (CI.Pointer x277)), "TLSv1_method" ->
  (fun x276 -> CI.make_ptr x277 (async_ssl_stub_2_TLSv1_method x276))
| Function (CI.Void, Returns (CI.Pointer x279)), "TLS_method" ->
  (fun x278 -> CI.make_ptr x279 (async_ssl_stub_1_TLS_method x278))
| _, s ->  Printf.ksprintf failwith "No match for %s" s


let foreign_value : type a. string -> a Ctypes.typ -> a Ctypes.ptr =
  fun name t -> match t, name with
| _, s ->  Printf.ksprintf failwith "No match for %s" s

OCaml

Innovation. Community. Security.