-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmbedtls.nelua
3023 lines (3023 loc) · 211 KB
/
mbedtls.nelua
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
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
##[[
cinclude '<mbedtls/aes.h>'
cinclude '<mbedtls/aesni.h>'
cinclude '<mbedtls/arc4.h>'
cinclude '<mbedtls/aria.h>'
cinclude '<mbedtls/asn1.h>'
cinclude '<mbedtls/asn1write.h>'
cinclude '<mbedtls/base64.h>'
cinclude '<mbedtls/bignum.h>'
cinclude '<mbedtls/blowfish.h>'
cinclude '<mbedtls/bn_mul.h>'
cinclude '<mbedtls/camellia.h>'
cinclude '<mbedtls/ccm.h>'
cinclude '<mbedtls/ccm.h>'
cinclude '<mbedtls/certs.h>'
cinclude '<mbedtls/chacha20.h>'
cinclude '<mbedtls/chachapoly.h>'
cinclude '<mbedtls/cipher.h>'
cinclude '<mbedtls/cmac.h>'
cinclude '<mbedtls/ctr_drbg.h>'
cinclude '<mbedtls/debug.h>'
cinclude '<mbedtls/des.h>'
cinclude '<mbedtls/dhm.h>'
cinclude '<mbedtls/ecdh.h>'
cinclude '<mbedtls/ecdsa.h>'
cinclude '<mbedtls/ecjpake.h>'
cinclude '<mbedtls/ecp.h>'
cinclude '<mbedtls/entropy.h>'
cinclude '<mbedtls/entropy_poll.h>'
cinclude '<mbedtls/error.h>'
cinclude '<mbedtls/gcm.h>'
cinclude '<mbedtls/havege.h>'
cinclude '<mbedtls/hkdf.h>'
cinclude '<mbedtls/hmac_drbg.h>'
cinclude '<mbedtls/md2.h>'
cinclude '<mbedtls/md4.h>'
cinclude '<mbedtls/md5.h>'
cinclude '<mbedtls/md.h>'
cinclude '<mbedtls/net_sockets.h>'
cinclude '<mbedtls/nist_kw.h>'
cinclude '<mbedtls/oid.h>'
cinclude '<mbedtls/padlock.h>'
cinclude '<mbedtls/pem.h>'
cinclude '<mbedtls/pkcs11.h>'
cinclude '<mbedtls/pkcs12.h>'
cinclude '<mbedtls/pkcs5.h>'
cinclude '<mbedtls/pk.h>'
cinclude '<mbedtls/platform.h>'
cinclude '<mbedtls/platform_time.h>'
cinclude '<mbedtls/platform_util.h>'
cinclude '<mbedtls/poly1305.h>'
cinclude '<mbedtls/psa_util.h>'
cinclude '<mbedtls/ripemd160.h>'
cinclude '<mbedtls/rsa.h>'
cinclude '<mbedtls/sha1.h>'
cinclude '<mbedtls/sha256.h>'
cinclude '<mbedtls/sha512.h>'
cinclude '<mbedtls/ssl_cache.h>'
cinclude '<mbedtls/ssl_ciphersuites.h>'
cinclude '<mbedtls/ssl_cookie.h>'
cinclude '<mbedtls/ssl.h>'
cinclude '<mbedtls/ssl_ticket.h>'
cinclude '<mbedtls/threading.h>'
cinclude '<mbedtls/timing.h>'
cinclude '<mbedtls/version.h>'
cinclude '<mbedtls/x509_crl.h>'
cinclude '<mbedtls/x509_crt.h>'
cinclude '<mbedtls/x509_csr.h>'
cinclude '<mbedtls/x509.h>'
cinclude '<mbedtls/xtea.h>'
linklib 'mbedcrypto'
linklib 'mbedtls'
linklib 'mbedx509'
]]
global tm: type <cimport,nodecl,ctypedef> = @record{
tm_sec: cint,
tm_min: cint,
tm_hour: cint,
tm_mday: cint,
tm_mon: cint,
tm_year: cint,
tm_wday: cint,
tm_yday: cint,
tm_isdst: cint,
tm_gmtoff: clong,
tm_zone: cstring
}
global function mbedtls_platform_zeroize(buf: pointer, len: csize): void <cimport,nodecl> end
global function mbedtls_platform_gmtime_r(tt: *clong, tm_buf: *tm): *tm <cimport,nodecl> end
global mbedtls_aes_context: type <cimport,nodecl> = @record{
nr: cint,
rk: *uint32,
buf: [68]uint32
}
global mbedtls_aes_xts_context: type <cimport,nodecl> = @record{
crypt: mbedtls_aes_context,
tweak: mbedtls_aes_context
}
global function mbedtls_aes_init(ctx: *mbedtls_aes_context): void <cimport,nodecl> end
global function mbedtls_aes_free(ctx: *mbedtls_aes_context): void <cimport,nodecl> end
global function mbedtls_aes_xts_init(ctx: *mbedtls_aes_xts_context): void <cimport,nodecl> end
global function mbedtls_aes_xts_free(ctx: *mbedtls_aes_xts_context): void <cimport,nodecl> end
global function mbedtls_aes_setkey_enc(ctx: *mbedtls_aes_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_aes_setkey_dec(ctx: *mbedtls_aes_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_aes_xts_setkey_enc(ctx: *mbedtls_aes_xts_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_aes_xts_setkey_dec(ctx: *mbedtls_aes_xts_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_aes_crypt_ecb(ctx: *mbedtls_aes_context, mode: cint, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_crypt_cbc(ctx: *mbedtls_aes_context, mode: cint, length: csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_crypt_xts(ctx: *mbedtls_aes_xts_context, mode: cint, length: csize, data_unit: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_crypt_cfb128(ctx: *mbedtls_aes_context, mode: cint, length: csize, iv_off: *csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_crypt_cfb8(ctx: *mbedtls_aes_context, mode: cint, length: csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_crypt_ofb(ctx: *mbedtls_aes_context, length: csize, iv_off: *csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_crypt_ctr(ctx: *mbedtls_aes_context, length: csize, nc_off: *csize, nonce_counter: *cuchar, stream_block: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_internal_aes_encrypt(ctx: *mbedtls_aes_context, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_internal_aes_decrypt(ctx: *mbedtls_aes_context, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_self_test(verbose: cint): cint <cimport,nodecl> end
global function mbedtls_aesni_has_support(what: cuint): cint <cimport,nodecl> end
global function mbedtls_aesni_crypt_ecb(ctx: *mbedtls_aes_context, mode: cint, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aesni_gcm_mult(c: *cuchar, a: *cuchar, b: *cuchar): void <cimport,nodecl> end
global function mbedtls_aesni_inverse_key(invkey: *cuchar, fwdkey: *cuchar, nr: cint): void <cimport,nodecl> end
global function mbedtls_aesni_setkey_enc(rk: *cuchar, key: *cuchar, bits: csize): cint <cimport,nodecl> end
global mbedtls_arc4_context: type <cimport,nodecl> = @record{
x: cint,
y: cint,
m: [256]cuchar
}
global function mbedtls_arc4_init(ctx: *mbedtls_arc4_context): void <cimport,nodecl> end
global function mbedtls_arc4_free(ctx: *mbedtls_arc4_context): void <cimport,nodecl> end
global function mbedtls_arc4_setup(ctx: *mbedtls_arc4_context, key: *cuchar, keylen: cuint): void <cimport,nodecl> end
global function mbedtls_arc4_crypt(ctx: *mbedtls_arc4_context, length: csize, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_arc4_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_aria_context: type <cimport,nodecl> = @record{
nr: cuchar,
rk: [17][4]uint32
}
global function mbedtls_aria_init(ctx: *mbedtls_aria_context): void <cimport,nodecl> end
global function mbedtls_aria_free(ctx: *mbedtls_aria_context): void <cimport,nodecl> end
global function mbedtls_aria_setkey_enc(ctx: *mbedtls_aria_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_aria_setkey_dec(ctx: *mbedtls_aria_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_aria_crypt_ecb(ctx: *mbedtls_aria_context, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aria_crypt_cbc(ctx: *mbedtls_aria_context, mode: cint, length: csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aria_crypt_cfb128(ctx: *mbedtls_aria_context, mode: cint, length: csize, iv_off: *csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aria_crypt_ctr(ctx: *mbedtls_aria_context, length: csize, nc_off: *csize, nonce_counter: *cuchar, stream_block: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aria_self_test(verbose: cint): cint <cimport,nodecl> end
global FILE: type <cimport,nodecl,forwarddecl> = @record{}
global mbedtls_mpi: type <cimport,nodecl> = @record{
s: cint,
n: csize,
p: *culong
}
global function mbedtls_mpi_init(X: *mbedtls_mpi): void <cimport,nodecl> end
global function mbedtls_mpi_free(X: *mbedtls_mpi): void <cimport,nodecl> end
global function mbedtls_mpi_grow(X: *mbedtls_mpi, nblimbs: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_shrink(X: *mbedtls_mpi, nblimbs: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_copy(X: *mbedtls_mpi, Y: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_swap(X: *mbedtls_mpi, Y: *mbedtls_mpi): void <cimport,nodecl> end
global function mbedtls_mpi_safe_cond_assign(X: *mbedtls_mpi, Y: *mbedtls_mpi, assign: cuchar): cint <cimport,nodecl> end
global function mbedtls_mpi_safe_cond_swap(X: *mbedtls_mpi, Y: *mbedtls_mpi, swap: cuchar): cint <cimport,nodecl> end
global function mbedtls_mpi_lset(X: *mbedtls_mpi, z: clong): cint <cimport,nodecl> end
global function mbedtls_mpi_get_bit(X: *mbedtls_mpi, pos: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_set_bit(X: *mbedtls_mpi, pos: csize, val: cuchar): cint <cimport,nodecl> end
global function mbedtls_mpi_lsb(X: *mbedtls_mpi): csize <cimport,nodecl> end
global function mbedtls_mpi_bitlen(X: *mbedtls_mpi): csize <cimport,nodecl> end
global function mbedtls_mpi_size(X: *mbedtls_mpi): csize <cimport,nodecl> end
global function mbedtls_mpi_read_string(X: *mbedtls_mpi, radix: cint, s: cstring): cint <cimport,nodecl> end
global function mbedtls_mpi_write_string(X: *mbedtls_mpi, radix: cint, buf: cstring, buflen: csize, olen: *csize): cint <cimport,nodecl> end
global function mbedtls_mpi_read_file(X: *mbedtls_mpi, radix: cint, fin: *FILE): cint <cimport,nodecl> end
global function mbedtls_mpi_write_file(p: cstring, X: *mbedtls_mpi, radix: cint, fout: *FILE): cint <cimport,nodecl> end
global function mbedtls_mpi_read_binary(X: *mbedtls_mpi, buf: *cuchar, buflen: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_read_binary_le(X: *mbedtls_mpi, buf: *cuchar, buflen: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_write_binary(X: *mbedtls_mpi, buf: *cuchar, buflen: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_write_binary_le(X: *mbedtls_mpi, buf: *cuchar, buflen: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_shift_l(X: *mbedtls_mpi, count: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_shift_r(X: *mbedtls_mpi, count: csize): cint <cimport,nodecl> end
global function mbedtls_mpi_cmp_abs(X: *mbedtls_mpi, Y: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_cmp_mpi(X: *mbedtls_mpi, Y: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_lt_mpi_ct(X: *mbedtls_mpi, Y: *mbedtls_mpi, ret: *cuint): cint <cimport,nodecl> end
global function mbedtls_mpi_cmp_int(X: *mbedtls_mpi, z: clong): cint <cimport,nodecl> end
global function mbedtls_mpi_add_abs(X: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_sub_abs(X: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_add_mpi(X: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_sub_mpi(X: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_add_int(X: *mbedtls_mpi, A: *mbedtls_mpi, b: clong): cint <cimport,nodecl> end
global function mbedtls_mpi_sub_int(X: *mbedtls_mpi, A: *mbedtls_mpi, b: clong): cint <cimport,nodecl> end
global function mbedtls_mpi_mul_mpi(X: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_mul_int(X: *mbedtls_mpi, A: *mbedtls_mpi, b: culong): cint <cimport,nodecl> end
global function mbedtls_mpi_div_mpi(Q: *mbedtls_mpi, R: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_div_int(Q: *mbedtls_mpi, R: *mbedtls_mpi, A: *mbedtls_mpi, b: clong): cint <cimport,nodecl> end
global function mbedtls_mpi_mod_mpi(R: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_mod_int(r: *culong, A: *mbedtls_mpi, b: clong): cint <cimport,nodecl> end
global function mbedtls_mpi_exp_mod(X: *mbedtls_mpi, A: *mbedtls_mpi, E: *mbedtls_mpi, N: *mbedtls_mpi, prec_RR: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_fill_random(X: *mbedtls_mpi, size: csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_mpi_random(X: *mbedtls_mpi, min: clong, N: *mbedtls_mpi, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_mpi_gcd(G: *mbedtls_mpi, A: *mbedtls_mpi, B: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_inv_mod(X: *mbedtls_mpi, A: *mbedtls_mpi, N: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_mpi_is_prime_ext(X: *mbedtls_mpi, rounds: cint, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global mbedtls_mpi_gen_prime_flag_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_MPI_GEN_PRIME_FLAG_DH = 1,
MBEDTLS_MPI_GEN_PRIME_FLAG_LOW_ERR = 2
}
global function mbedtls_mpi_gen_prime(X: *mbedtls_mpi, nbits: csize, flags: cint, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_mpi_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_asn1_buf: type <cimport,nodecl> = @record{
tag: cint,
len: csize,
p: *cuchar
}
global mbedtls_asn1_bitstring: type <cimport,nodecl> = @record{
len: csize,
unused_bits: cuchar,
p: *cuchar
}
global mbedtls_asn1_sequence: type <cimport,nodecl,forwarddecl> = @record{}
mbedtls_asn1_sequence = @record{
buf: mbedtls_asn1_buf,
next: *mbedtls_asn1_sequence
}
global mbedtls_asn1_named_data: type <cimport,nodecl,forwarddecl> = @record{}
mbedtls_asn1_named_data = @record{
oid: mbedtls_asn1_buf,
val: mbedtls_asn1_buf,
next: *mbedtls_asn1_named_data,
next_merged: cuchar
}
global function mbedtls_asn1_get_len(p: **cuchar, End: *cuchar, len: *csize): cint <cimport,nodecl> end
global function mbedtls_asn1_get_tag(p: **cuchar, End: *cuchar, len: *csize, tag: cint): cint <cimport,nodecl> end
global function mbedtls_asn1_get_bool(p: **cuchar, End: *cuchar, val: *cint): cint <cimport,nodecl> end
global function mbedtls_asn1_get_int(p: **cuchar, End: *cuchar, val: *cint): cint <cimport,nodecl> end
global function mbedtls_asn1_get_enum(p: **cuchar, End: *cuchar, val: *cint): cint <cimport,nodecl> end
global function mbedtls_asn1_get_bitstring(p: **cuchar, End: *cuchar, bs: *mbedtls_asn1_bitstring): cint <cimport,nodecl> end
global function mbedtls_asn1_get_bitstring_null(p: **cuchar, End: *cuchar, len: *csize): cint <cimport,nodecl> end
global function mbedtls_asn1_get_sequence_of(p: **cuchar, End: *cuchar, cur: *mbedtls_asn1_sequence, tag: cint): cint <cimport,nodecl> end
global function mbedtls_asn1_sequence_free(seq: *mbedtls_asn1_sequence): void <cimport,nodecl> end
global function mbedtls_asn1_traverse_sequence_of(p: **cuchar, End: *cuchar, tag_must_mask: cuchar, tag_must_val: cuchar, tag_may_mask: cuchar, tag_may_val: cuchar, cb: function(pointer, cint, *cuchar, csize): cint, ctx: pointer): cint <cimport,nodecl> end
global function mbedtls_asn1_get_mpi(p: **cuchar, End: *cuchar, X: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_asn1_get_alg(p: **cuchar, End: *cuchar, alg: *mbedtls_asn1_buf, params: *mbedtls_asn1_buf): cint <cimport,nodecl> end
global function mbedtls_asn1_get_alg_null(p: **cuchar, End: *cuchar, alg: *mbedtls_asn1_buf): cint <cimport,nodecl> end
global function mbedtls_asn1_find_named_data(list: *mbedtls_asn1_named_data, oid: cstring, len: csize): *mbedtls_asn1_named_data <cimport,nodecl> end
global function mbedtls_asn1_free_named_data(entry: *mbedtls_asn1_named_data): void <cimport,nodecl> end
global function mbedtls_asn1_free_named_data_list(head: **mbedtls_asn1_named_data): void <cimport,nodecl> end
global function mbedtls_asn1_write_len(p: **cuchar, start: *cuchar, len: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_tag(p: **cuchar, start: *cuchar, tag: cuchar): cint <cimport,nodecl> end
global function mbedtls_asn1_write_raw_buffer(p: **cuchar, start: *cuchar, buf: *cuchar, size: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_mpi(p: **cuchar, start: *cuchar, X: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_asn1_write_null(p: **cuchar, start: *cuchar): cint <cimport,nodecl> end
global function mbedtls_asn1_write_oid(p: **cuchar, start: *cuchar, oid: cstring, oid_len: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_algorithm_identifier(p: **cuchar, start: *cuchar, oid: cstring, oid_len: csize, par_len: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_bool(p: **cuchar, start: *cuchar, boolean: cint): cint <cimport,nodecl> end
global function mbedtls_asn1_write_int(p: **cuchar, start: *cuchar, val: cint): cint <cimport,nodecl> end
global function mbedtls_asn1_write_enum(p: **cuchar, start: *cuchar, val: cint): cint <cimport,nodecl> end
global function mbedtls_asn1_write_tagged_string(p: **cuchar, start: *cuchar, tag: cint, text: cstring, text_len: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_printable_string(p: **cuchar, start: *cuchar, text: cstring, text_len: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_utf8_string(p: **cuchar, start: *cuchar, text: cstring, text_len: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_ia5_string(p: **cuchar, start: *cuchar, text: cstring, text_len: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_bitstring(p: **cuchar, start: *cuchar, buf: *cuchar, bits: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_named_bitstring(p: **cuchar, start: *cuchar, buf: *cuchar, bits: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_write_octet_string(p: **cuchar, start: *cuchar, buf: *cuchar, size: csize): cint <cimport,nodecl> end
global function mbedtls_asn1_store_named_data(list: **mbedtls_asn1_named_data, oid: cstring, oid_len: csize, val: *cuchar, val_len: csize): *mbedtls_asn1_named_data <cimport,nodecl> end
global function mbedtls_base64_encode(dst: *cuchar, dlen: csize, olen: *csize, src: *cuchar, slen: csize): cint <cimport,nodecl> end
global function mbedtls_base64_decode(dst: *cuchar, dlen: csize, olen: *csize, src: *cuchar, slen: csize): cint <cimport,nodecl> end
global function mbedtls_base64_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_blowfish_context: type <cimport,nodecl> = @record{
P: [18]uint32,
S: [4][256]uint32
}
global function mbedtls_blowfish_init(ctx: *mbedtls_blowfish_context): void <cimport,nodecl> end
global function mbedtls_blowfish_free(ctx: *mbedtls_blowfish_context): void <cimport,nodecl> end
global function mbedtls_blowfish_setkey(ctx: *mbedtls_blowfish_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_blowfish_crypt_ecb(ctx: *mbedtls_blowfish_context, mode: cint, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_blowfish_crypt_cbc(ctx: *mbedtls_blowfish_context, mode: cint, length: csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_blowfish_crypt_cfb64(ctx: *mbedtls_blowfish_context, mode: cint, length: csize, iv_off: *csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_blowfish_crypt_ctr(ctx: *mbedtls_blowfish_context, length: csize, nc_off: *csize, nonce_counter: *cuchar, stream_block: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global mbedtls_camellia_context: type <cimport,nodecl> = @record{
nr: cint,
rk: [68]uint32
}
global function mbedtls_camellia_init(ctx: *mbedtls_camellia_context): void <cimport,nodecl> end
global function mbedtls_camellia_free(ctx: *mbedtls_camellia_context): void <cimport,nodecl> end
global function mbedtls_camellia_setkey_enc(ctx: *mbedtls_camellia_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_camellia_setkey_dec(ctx: *mbedtls_camellia_context, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_camellia_crypt_ecb(ctx: *mbedtls_camellia_context, mode: cint, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_camellia_crypt_cbc(ctx: *mbedtls_camellia_context, mode: cint, length: csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_camellia_crypt_cfb128(ctx: *mbedtls_camellia_context, mode: cint, length: csize, iv_off: *csize, iv: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_camellia_crypt_ctr(ctx: *mbedtls_camellia_context, length: csize, nc_off: *csize, nonce_counter: *cuchar, stream_block: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_camellia_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_cipher_id_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_CIPHER_ID_NONE = 0,
MBEDTLS_CIPHER_ID_NULL = 1,
MBEDTLS_CIPHER_ID_AES = 2,
MBEDTLS_CIPHER_ID_DES = 3,
MBEDTLS_CIPHER_ID_3DES = 4,
MBEDTLS_CIPHER_ID_CAMELLIA = 5,
MBEDTLS_CIPHER_ID_BLOWFISH = 6,
MBEDTLS_CIPHER_ID_ARC4 = 7,
MBEDTLS_CIPHER_ID_ARIA = 8,
MBEDTLS_CIPHER_ID_CHACHA20 = 9
}
global mbedtls_cipher_type_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_CIPHER_NONE = 0,
MBEDTLS_CIPHER_NULL = 1,
MBEDTLS_CIPHER_AES_128_ECB = 2,
MBEDTLS_CIPHER_AES_192_ECB = 3,
MBEDTLS_CIPHER_AES_256_ECB = 4,
MBEDTLS_CIPHER_AES_128_CBC = 5,
MBEDTLS_CIPHER_AES_192_CBC = 6,
MBEDTLS_CIPHER_AES_256_CBC = 7,
MBEDTLS_CIPHER_AES_128_CFB128 = 8,
MBEDTLS_CIPHER_AES_192_CFB128 = 9,
MBEDTLS_CIPHER_AES_256_CFB128 = 10,
MBEDTLS_CIPHER_AES_128_CTR = 11,
MBEDTLS_CIPHER_AES_192_CTR = 12,
MBEDTLS_CIPHER_AES_256_CTR = 13,
MBEDTLS_CIPHER_AES_128_GCM = 14,
MBEDTLS_CIPHER_AES_192_GCM = 15,
MBEDTLS_CIPHER_AES_256_GCM = 16,
MBEDTLS_CIPHER_CAMELLIA_128_ECB = 17,
MBEDTLS_CIPHER_CAMELLIA_192_ECB = 18,
MBEDTLS_CIPHER_CAMELLIA_256_ECB = 19,
MBEDTLS_CIPHER_CAMELLIA_128_CBC = 20,
MBEDTLS_CIPHER_CAMELLIA_192_CBC = 21,
MBEDTLS_CIPHER_CAMELLIA_256_CBC = 22,
MBEDTLS_CIPHER_CAMELLIA_128_CFB128 = 23,
MBEDTLS_CIPHER_CAMELLIA_192_CFB128 = 24,
MBEDTLS_CIPHER_CAMELLIA_256_CFB128 = 25,
MBEDTLS_CIPHER_CAMELLIA_128_CTR = 26,
MBEDTLS_CIPHER_CAMELLIA_192_CTR = 27,
MBEDTLS_CIPHER_CAMELLIA_256_CTR = 28,
MBEDTLS_CIPHER_CAMELLIA_128_GCM = 29,
MBEDTLS_CIPHER_CAMELLIA_192_GCM = 30,
MBEDTLS_CIPHER_CAMELLIA_256_GCM = 31,
MBEDTLS_CIPHER_DES_ECB = 32,
MBEDTLS_CIPHER_DES_CBC = 33,
MBEDTLS_CIPHER_DES_EDE_ECB = 34,
MBEDTLS_CIPHER_DES_EDE_CBC = 35,
MBEDTLS_CIPHER_DES_EDE3_ECB = 36,
MBEDTLS_CIPHER_DES_EDE3_CBC = 37,
MBEDTLS_CIPHER_BLOWFISH_ECB = 38,
MBEDTLS_CIPHER_BLOWFISH_CBC = 39,
MBEDTLS_CIPHER_BLOWFISH_CFB64 = 40,
MBEDTLS_CIPHER_BLOWFISH_CTR = 41,
MBEDTLS_CIPHER_ARC4_128 = 42,
MBEDTLS_CIPHER_AES_128_CCM = 43,
MBEDTLS_CIPHER_AES_192_CCM = 44,
MBEDTLS_CIPHER_AES_256_CCM = 45,
MBEDTLS_CIPHER_CAMELLIA_128_CCM = 46,
MBEDTLS_CIPHER_CAMELLIA_192_CCM = 47,
MBEDTLS_CIPHER_CAMELLIA_256_CCM = 48,
MBEDTLS_CIPHER_ARIA_128_ECB = 49,
MBEDTLS_CIPHER_ARIA_192_ECB = 50,
MBEDTLS_CIPHER_ARIA_256_ECB = 51,
MBEDTLS_CIPHER_ARIA_128_CBC = 52,
MBEDTLS_CIPHER_ARIA_192_CBC = 53,
MBEDTLS_CIPHER_ARIA_256_CBC = 54,
MBEDTLS_CIPHER_ARIA_128_CFB128 = 55,
MBEDTLS_CIPHER_ARIA_192_CFB128 = 56,
MBEDTLS_CIPHER_ARIA_256_CFB128 = 57,
MBEDTLS_CIPHER_ARIA_128_CTR = 58,
MBEDTLS_CIPHER_ARIA_192_CTR = 59,
MBEDTLS_CIPHER_ARIA_256_CTR = 60,
MBEDTLS_CIPHER_ARIA_128_GCM = 61,
MBEDTLS_CIPHER_ARIA_192_GCM = 62,
MBEDTLS_CIPHER_ARIA_256_GCM = 63,
MBEDTLS_CIPHER_ARIA_128_CCM = 64,
MBEDTLS_CIPHER_ARIA_192_CCM = 65,
MBEDTLS_CIPHER_ARIA_256_CCM = 66,
MBEDTLS_CIPHER_AES_128_OFB = 67,
MBEDTLS_CIPHER_AES_192_OFB = 68,
MBEDTLS_CIPHER_AES_256_OFB = 69,
MBEDTLS_CIPHER_AES_128_XTS = 70,
MBEDTLS_CIPHER_AES_256_XTS = 71,
MBEDTLS_CIPHER_CHACHA20 = 72,
MBEDTLS_CIPHER_CHACHA20_POLY1305 = 73,
MBEDTLS_CIPHER_AES_128_KW = 74,
MBEDTLS_CIPHER_AES_192_KW = 75,
MBEDTLS_CIPHER_AES_256_KW = 76,
MBEDTLS_CIPHER_AES_128_KWP = 77,
MBEDTLS_CIPHER_AES_192_KWP = 78,
MBEDTLS_CIPHER_AES_256_KWP = 79
}
global mbedtls_cipher_mode_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_MODE_NONE = 0,
MBEDTLS_MODE_ECB = 1,
MBEDTLS_MODE_CBC = 2,
MBEDTLS_MODE_CFB = 3,
MBEDTLS_MODE_OFB = 4,
MBEDTLS_MODE_CTR = 5,
MBEDTLS_MODE_GCM = 6,
MBEDTLS_MODE_STREAM = 7,
MBEDTLS_MODE_CCM = 8,
MBEDTLS_MODE_XTS = 9,
MBEDTLS_MODE_CHACHAPOLY = 10,
MBEDTLS_MODE_KW = 11,
MBEDTLS_MODE_KWP = 12
}
global mbedtls_cipher_padding_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_PADDING_PKCS7 = 0,
MBEDTLS_PADDING_ONE_AND_ZEROS = 1,
MBEDTLS_PADDING_ZEROS_AND_LEN = 2,
MBEDTLS_PADDING_ZEROS = 3,
MBEDTLS_PADDING_NONE = 4
}
global mbedtls_operation_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_OPERATION_NONE = -1,
MBEDTLS_DECRYPT = 0,
MBEDTLS_ENCRYPT = 1
}
global MBEDTLS_KEY_LENGTH_NONE: cint <comptime> = 0
global MBEDTLS_KEY_LENGTH_DES: cint <comptime> = 64
global MBEDTLS_KEY_LENGTH_DES_EDE: cint <comptime> = 128
global MBEDTLS_KEY_LENGTH_DES_EDE3: cint <comptime> = 192
global mbedtls_cipher_base_t: type <cimport,nodecl,forwarddecl> = @record{}
global mbedtls_cmac_context_t: type <cimport,nodecl,forwarddecl> = @record{}
global mbedtls_cipher_info_t: type <cimport,nodecl> = @record{
type: mbedtls_cipher_type_t,
mode: mbedtls_cipher_mode_t,
key_bitlen: cuint,
name: cstring,
iv_size: cuint,
flags: cint,
block_size: cuint,
base: *mbedtls_cipher_base_t
}
global mbedtls_cipher_context_t: type <cimport,nodecl> = @record{
cipher_info: *mbedtls_cipher_info_t,
key_bitlen: cint,
operation: mbedtls_operation_t,
add_padding: function(*cuchar, csize, csize): void,
get_padding: function(*cuchar, csize, *csize): cint,
unprocessed_data: [16]cuchar,
unprocessed_len: csize,
iv: [16]cuchar,
iv_size: csize,
cipher_ctx: pointer
}
global function mbedtls_cipher_list(): *cint <cimport,nodecl> end
global function mbedtls_cipher_info_from_string(cipher_name: cstring): *mbedtls_cipher_info_t <cimport,nodecl> end
global function mbedtls_cipher_info_from_type(cipher_type: mbedtls_cipher_type_t): *mbedtls_cipher_info_t <cimport,nodecl> end
global function mbedtls_cipher_info_from_values(cipher_id: mbedtls_cipher_id_t, key_bitlen: cint, mode: mbedtls_cipher_mode_t): *mbedtls_cipher_info_t <cimport,nodecl> end
global function mbedtls_cipher_init(ctx: *mbedtls_cipher_context_t): void <cimport,nodecl> end
global function mbedtls_cipher_free(ctx: *mbedtls_cipher_context_t): void <cimport,nodecl> end
global function mbedtls_cipher_setup(ctx: *mbedtls_cipher_context_t, cipher_info: *mbedtls_cipher_info_t): cint <cimport,nodecl> end
global function mbedtls_cipher_get_block_size(ctx: *mbedtls_cipher_context_t): cuint <cimport,nodecl> end
global function mbedtls_cipher_get_cipher_mode(ctx: *mbedtls_cipher_context_t): mbedtls_cipher_mode_t <cimport,nodecl> end
global function mbedtls_cipher_get_iv_size(ctx: *mbedtls_cipher_context_t): cint <cimport,nodecl> end
global function mbedtls_cipher_get_type(ctx: *mbedtls_cipher_context_t): mbedtls_cipher_type_t <cimport,nodecl> end
global function mbedtls_cipher_get_name(ctx: *mbedtls_cipher_context_t): cstring <cimport,nodecl> end
global function mbedtls_cipher_get_key_bitlen(ctx: *mbedtls_cipher_context_t): cint <cimport,nodecl> end
global function mbedtls_cipher_get_operation(ctx: *mbedtls_cipher_context_t): mbedtls_operation_t <cimport,nodecl> end
global function mbedtls_cipher_setkey(ctx: *mbedtls_cipher_context_t, key: *cuchar, key_bitlen: cint, operation: mbedtls_operation_t): cint <cimport,nodecl> end
global function mbedtls_cipher_set_padding_mode(ctx: *mbedtls_cipher_context_t, mode: mbedtls_cipher_padding_t): cint <cimport,nodecl> end
global function mbedtls_cipher_set_iv(ctx: *mbedtls_cipher_context_t, iv: *cuchar, iv_len: csize): cint <cimport,nodecl> end
global function mbedtls_cipher_reset(ctx: *mbedtls_cipher_context_t): cint <cimport,nodecl> end
global function mbedtls_cipher_update_ad(ctx: *mbedtls_cipher_context_t, ad: *cuchar, ad_len: csize): cint <cimport,nodecl> end
global function mbedtls_cipher_update(ctx: *mbedtls_cipher_context_t, input: *cuchar, ilen: csize, output: *cuchar, olen: *csize): cint <cimport,nodecl> end
global function mbedtls_cipher_finish(ctx: *mbedtls_cipher_context_t, output: *cuchar, olen: *csize): cint <cimport,nodecl> end
global function mbedtls_cipher_write_tag(ctx: *mbedtls_cipher_context_t, tag: *cuchar, tag_len: csize): cint <cimport,nodecl> end
global function mbedtls_cipher_check_tag(ctx: *mbedtls_cipher_context_t, tag: *cuchar, tag_len: csize): cint <cimport,nodecl> end
global function mbedtls_cipher_crypt(ctx: *mbedtls_cipher_context_t, iv: *cuchar, iv_len: csize, input: *cuchar, ilen: csize, output: *cuchar, olen: *csize): cint <cimport,nodecl> end
global function mbedtls_cipher_auth_encrypt_ext(ctx: *mbedtls_cipher_context_t, iv: *cuchar, iv_len: csize, ad: *cuchar, ad_len: csize, input: *cuchar, ilen: csize, output: *cuchar, output_len: csize, olen: *csize, tag_len: csize): cint <cimport,nodecl> end
global function mbedtls_cipher_auth_decrypt_ext(ctx: *mbedtls_cipher_context_t, iv: *cuchar, iv_len: csize, ad: *cuchar, ad_len: csize, input: *cuchar, ilen: csize, output: *cuchar, output_len: csize, olen: *csize, tag_len: csize): cint <cimport,nodecl> end
global mbedtls_ccm_context: type <cimport,nodecl> = @record{
cipher_ctx: mbedtls_cipher_context_t
}
global function mbedtls_ccm_init(ctx: *mbedtls_ccm_context): void <cimport,nodecl> end
global function mbedtls_ccm_setkey(ctx: *mbedtls_ccm_context, cipher: mbedtls_cipher_id_t, key: *cuchar, keybits: cuint): cint <cimport,nodecl> end
global function mbedtls_ccm_free(ctx: *mbedtls_ccm_context): void <cimport,nodecl> end
global function mbedtls_ccm_encrypt_and_tag(ctx: *mbedtls_ccm_context, length: csize, iv: *cuchar, iv_len: csize, add: *cuchar, add_len: csize, input: *cuchar, output: *cuchar, tag: *cuchar, tag_len: csize): cint <cimport,nodecl> end
global function mbedtls_ccm_star_encrypt_and_tag(ctx: *mbedtls_ccm_context, length: csize, iv: *cuchar, iv_len: csize, add: *cuchar, add_len: csize, input: *cuchar, output: *cuchar, tag: *cuchar, tag_len: csize): cint <cimport,nodecl> end
global function mbedtls_ccm_auth_decrypt(ctx: *mbedtls_ccm_context, length: csize, iv: *cuchar, iv_len: csize, add: *cuchar, add_len: csize, input: *cuchar, output: *cuchar, tag: *cuchar, tag_len: csize): cint <cimport,nodecl> end
global function mbedtls_ccm_star_auth_decrypt(ctx: *mbedtls_ccm_context, length: csize, iv: *cuchar, iv_len: csize, add: *cuchar, add_len: csize, input: *cuchar, output: *cuchar, tag: *cuchar, tag_len: csize): cint <cimport,nodecl> end
global function mbedtls_ccm_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_test_cas: [0]cstring <cimport,nodecl>
global mbedtls_test_cas_len: [0]csize <cimport,nodecl>
global mbedtls_test_cas_der: [0]*cuchar <cimport,nodecl>
global mbedtls_test_cas_der_len: [0]csize <cimport,nodecl>
global mbedtls_test_cas_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_cas_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_key_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_pwd_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_key_rsa_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_pwd_rsa_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha1_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha256_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_crt_ec_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_ca_key_ec_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_ca_key_rsa_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha1_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha256_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_ca_crt_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_key_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_pwd_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_key_rsa_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_pwd_rsa_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha1_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha256_pem_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_ca_key_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_ca_pwd_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_ca_key_rsa_der_len: csize <cimport,nodecl>
global mbedtls_test_ca_pwd_rsa_der_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha1_der_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha256_der_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_key_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_pwd_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_key_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_pwd_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha1: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha256: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_crt_ec_len: csize <cimport,nodecl>
global mbedtls_test_ca_key_ec_len: csize <cimport,nodecl>
global mbedtls_test_ca_pwd_ec_len: csize <cimport,nodecl>
global mbedtls_test_ca_key_rsa_len: csize <cimport,nodecl>
global mbedtls_test_ca_pwd_rsa_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha1_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_sha256_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_ca_crt_rsa_len: csize <cimport,nodecl>
global mbedtls_test_ca_crt: cstring <cimport,nodecl>
global mbedtls_test_ca_key: cstring <cimport,nodecl>
global mbedtls_test_ca_pwd: cstring <cimport,nodecl>
global mbedtls_test_ca_crt_len: csize <cimport,nodecl>
global mbedtls_test_ca_key_len: csize <cimport,nodecl>
global mbedtls_test_ca_pwd_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_key_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_pwd_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_key_rsa_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_pwd_rsa_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha1_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha256_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_crt_ec_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_srv_key_ec_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_srv_key_rsa_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha1_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha256_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_srv_crt_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_srv_key_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_srv_pwd_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_srv_key_rsa_pem_len: csize <cimport,nodecl>
global mbedtls_test_srv_pwd_rsa_pem_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha1_pem_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha256_pem_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_srv_key_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_srv_pwd_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_srv_key_rsa_der_len: csize <cimport,nodecl>
global mbedtls_test_srv_pwd_rsa_der_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha1_der_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha256_der_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_key_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_pwd_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_key_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_pwd_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha1: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha256: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_crt_ec_len: csize <cimport,nodecl>
global mbedtls_test_srv_key_ec_len: csize <cimport,nodecl>
global mbedtls_test_srv_pwd_ec_len: csize <cimport,nodecl>
global mbedtls_test_srv_key_rsa_len: csize <cimport,nodecl>
global mbedtls_test_srv_pwd_rsa_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha1_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_sha256_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_srv_crt_rsa_len: csize <cimport,nodecl>
global mbedtls_test_srv_crt: cstring <cimport,nodecl>
global mbedtls_test_srv_key: cstring <cimport,nodecl>
global mbedtls_test_srv_pwd: cstring <cimport,nodecl>
global mbedtls_test_srv_crt_len: csize <cimport,nodecl>
global mbedtls_test_srv_key_len: csize <cimport,nodecl>
global mbedtls_test_srv_pwd_len: csize <cimport,nodecl>
global mbedtls_test_cli_crt_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_key_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_pwd_ec_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_key_rsa_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_pwd_rsa_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_crt_rsa_pem: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_crt_ec_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_cli_key_ec_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_cli_key_rsa_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_cli_crt_rsa_der: [0]cuchar <cimport,nodecl>
global mbedtls_test_cli_crt_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_cli_key_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_cli_pwd_ec_pem_len: csize <cimport,nodecl>
global mbedtls_test_cli_key_rsa_pem_len: csize <cimport,nodecl>
global mbedtls_test_cli_pwd_rsa_pem_len: csize <cimport,nodecl>
global mbedtls_test_cli_crt_rsa_pem_len: csize <cimport,nodecl>
global mbedtls_test_cli_crt_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_cli_key_ec_der_len: csize <cimport,nodecl>
global mbedtls_test_cli_key_rsa_der_len: csize <cimport,nodecl>
global mbedtls_test_cli_crt_rsa_der_len: csize <cimport,nodecl>
global mbedtls_test_cli_crt_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_key_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_pwd_ec: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_key_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_pwd_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_crt_rsa: [0]cchar <cimport,nodecl>
global mbedtls_test_cli_crt_ec_len: csize <cimport,nodecl>
global mbedtls_test_cli_key_ec_len: csize <cimport,nodecl>
global mbedtls_test_cli_pwd_ec_len: csize <cimport,nodecl>
global mbedtls_test_cli_key_rsa_len: csize <cimport,nodecl>
global mbedtls_test_cli_pwd_rsa_len: csize <cimport,nodecl>
global mbedtls_test_cli_crt_rsa_len: csize <cimport,nodecl>
global mbedtls_test_cli_crt: cstring <cimport,nodecl>
global mbedtls_test_cli_key: cstring <cimport,nodecl>
global mbedtls_test_cli_pwd: cstring <cimport,nodecl>
global mbedtls_test_cli_crt_len: csize <cimport,nodecl>
global mbedtls_test_cli_key_len: csize <cimport,nodecl>
global mbedtls_test_cli_pwd_len: csize <cimport,nodecl>
global mbedtls_chacha20_context: type <cimport,nodecl> = @record{
state: [16]uint32,
keystream8: [64]uint8,
keystream_bytes_used: csize
}
global function mbedtls_chacha20_init(ctx: *mbedtls_chacha20_context): void <cimport,nodecl> end
global function mbedtls_chacha20_free(ctx: *mbedtls_chacha20_context): void <cimport,nodecl> end
global function mbedtls_chacha20_setkey(ctx: *mbedtls_chacha20_context, key: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chacha20_starts(ctx: *mbedtls_chacha20_context, nonce: *cuchar, counter: uint32): cint <cimport,nodecl> end
global function mbedtls_chacha20_update(ctx: *mbedtls_chacha20_context, size: csize, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chacha20_crypt(key: *cuchar, nonce: *cuchar, counter: uint32, size: csize, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chacha20_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_poly1305_context: type <cimport,nodecl> = @record{
r: [4]uint32,
s: [4]uint32,
acc: [5]uint32,
queue: [16]uint8,
queue_len: csize
}
global function mbedtls_poly1305_init(ctx: *mbedtls_poly1305_context): void <cimport,nodecl> end
global function mbedtls_poly1305_free(ctx: *mbedtls_poly1305_context): void <cimport,nodecl> end
global function mbedtls_poly1305_starts(ctx: *mbedtls_poly1305_context, key: *cuchar): cint <cimport,nodecl> end
global function mbedtls_poly1305_update(ctx: *mbedtls_poly1305_context, input: *cuchar, ilen: csize): cint <cimport,nodecl> end
global function mbedtls_poly1305_finish(ctx: *mbedtls_poly1305_context, mac: *cuchar): cint <cimport,nodecl> end
global function mbedtls_poly1305_mac(key: *cuchar, input: *cuchar, ilen: csize, mac: *cuchar): cint <cimport,nodecl> end
global function mbedtls_poly1305_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_chachapoly_mode_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_CHACHAPOLY_ENCRYPT = 0,
MBEDTLS_CHACHAPOLY_DECRYPT = 1
}
global mbedtls_chachapoly_context: type <cimport,nodecl> = @record{
chacha20_ctx: mbedtls_chacha20_context,
poly1305_ctx: mbedtls_poly1305_context,
aad_len: uint64,
ciphertext_len: uint64,
state: cint,
mode: mbedtls_chachapoly_mode_t
}
global function mbedtls_chachapoly_init(ctx: *mbedtls_chachapoly_context): void <cimport,nodecl> end
global function mbedtls_chachapoly_free(ctx: *mbedtls_chachapoly_context): void <cimport,nodecl> end
global function mbedtls_chachapoly_setkey(ctx: *mbedtls_chachapoly_context, key: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chachapoly_starts(ctx: *mbedtls_chachapoly_context, nonce: *cuchar, mode: mbedtls_chachapoly_mode_t): cint <cimport,nodecl> end
global function mbedtls_chachapoly_update_aad(ctx: *mbedtls_chachapoly_context, aad: *cuchar, aad_len: csize): cint <cimport,nodecl> end
global function mbedtls_chachapoly_update(ctx: *mbedtls_chachapoly_context, len: csize, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chachapoly_finish(ctx: *mbedtls_chachapoly_context, mac: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chachapoly_encrypt_and_tag(ctx: *mbedtls_chachapoly_context, length: csize, nonce: *cuchar, aad: *cuchar, aad_len: csize, input: *cuchar, output: *cuchar, tag: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chachapoly_auth_decrypt(ctx: *mbedtls_chachapoly_context, length: csize, nonce: *cuchar, aad: *cuchar, aad_len: csize, tag: *cuchar, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_chachapoly_self_test(verbose: cint): cint <cimport,nodecl> end
mbedtls_cmac_context_t = @record{
state: [16]cuchar,
unprocessed_block: [16]cuchar,
unprocessed_len: csize
}
global function mbedtls_cipher_cmac_starts(ctx: *mbedtls_cipher_context_t, key: *cuchar, keybits: csize): cint <cimport,nodecl> end
global function mbedtls_cipher_cmac_update(ctx: *mbedtls_cipher_context_t, input: *cuchar, ilen: csize): cint <cimport,nodecl> end
global function mbedtls_cipher_cmac_finish(ctx: *mbedtls_cipher_context_t, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_cipher_cmac_reset(ctx: *mbedtls_cipher_context_t): cint <cimport,nodecl> end
global function mbedtls_cipher_cmac(cipher_info: *mbedtls_cipher_info_t, key: *cuchar, keylen: csize, input: *cuchar, ilen: csize, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_aes_cmac_prf_128(key: *cuchar, key_len: csize, input: *cuchar, in_len: csize, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_cmac_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_threading_mutex_t: type <cimport,nodecl,cincomplete> = @record{
is_valid: cchar
}
global mbedtls_mutex_init: function(*mbedtls_threading_mutex_t): void <cimport,nodecl>
global mbedtls_mutex_free: function(*mbedtls_threading_mutex_t): void <cimport,nodecl>
global mbedtls_mutex_lock: function(*mbedtls_threading_mutex_t): cint <cimport,nodecl>
global mbedtls_mutex_unlock: function(*mbedtls_threading_mutex_t): cint <cimport,nodecl>
global mbedtls_threading_readdir_mutex: mbedtls_threading_mutex_t <cimport,nodecl>
global mbedtls_threading_gmtime_mutex: mbedtls_threading_mutex_t <cimport,nodecl>
global mbedtls_ctr_drbg_context: type <cimport,nodecl> = @record{
counter: [16]cuchar,
reseed_counter: cint,
prediction_resistance: cint,
entropy_len: csize,
reseed_interval: cint,
aes_ctx: mbedtls_aes_context,
f_entropy: function(pointer, *cuchar, csize): cint,
p_entropy: pointer,
mutex: mbedtls_threading_mutex_t
}
global function mbedtls_ctr_drbg_init(ctx: *mbedtls_ctr_drbg_context): void <cimport,nodecl> end
global function mbedtls_ctr_drbg_seed(ctx: *mbedtls_ctr_drbg_context, f_entropy: function(pointer, *cuchar, csize): cint, p_entropy: pointer, custom: *cuchar, len: csize): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_free(ctx: *mbedtls_ctr_drbg_context): void <cimport,nodecl> end
global function mbedtls_ctr_drbg_set_prediction_resistance(ctx: *mbedtls_ctr_drbg_context, resistance: cint): void <cimport,nodecl> end
global function mbedtls_ctr_drbg_set_entropy_len(ctx: *mbedtls_ctr_drbg_context, len: csize): void <cimport,nodecl> end
global function mbedtls_ctr_drbg_set_nonce_len(ctx: *mbedtls_ctr_drbg_context, len: csize): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_set_reseed_interval(ctx: *mbedtls_ctr_drbg_context, interval: cint): void <cimport,nodecl> end
global function mbedtls_ctr_drbg_reseed(ctx: *mbedtls_ctr_drbg_context, additional: *cuchar, len: csize): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_update_ret(ctx: *mbedtls_ctr_drbg_context, additional: *cuchar, add_len: csize): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_random_with_add(p_rng: pointer, output: *cuchar, output_len: csize, additional: *cuchar, add_len: csize): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_random(p_rng: pointer, output: *cuchar, output_len: csize): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_write_seed_file(ctx: *mbedtls_ctr_drbg_context, path: cstring): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_update_seed_file(ctx: *mbedtls_ctr_drbg_context, path: cstring): cint <cimport,nodecl> end
global function mbedtls_ctr_drbg_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_ecp_group_id: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_ECP_DP_NONE = 0,
MBEDTLS_ECP_DP_SECP192R1 = 1,
MBEDTLS_ECP_DP_SECP224R1 = 2,
MBEDTLS_ECP_DP_SECP256R1 = 3,
MBEDTLS_ECP_DP_SECP384R1 = 4,
MBEDTLS_ECP_DP_SECP521R1 = 5,
MBEDTLS_ECP_DP_BP256R1 = 6,
MBEDTLS_ECP_DP_BP384R1 = 7,
MBEDTLS_ECP_DP_BP512R1 = 8,
MBEDTLS_ECP_DP_CURVE25519 = 9,
MBEDTLS_ECP_DP_SECP192K1 = 10,
MBEDTLS_ECP_DP_SECP224K1 = 11,
MBEDTLS_ECP_DP_SECP256K1 = 12,
MBEDTLS_ECP_DP_CURVE448 = 13
}
global mbedtls_ecp_curve_type: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_ECP_TYPE_NONE = 0,
MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS = 1,
MBEDTLS_ECP_TYPE_MONTGOMERY = 2
}
global mbedtls_ecp_curve_info: type <cimport,nodecl> = @record{
grp_id: mbedtls_ecp_group_id,
tls_id: uint16,
bit_size: uint16,
name: cstring
}
global mbedtls_ecp_point: type <cimport,nodecl> = @record{
X: mbedtls_mpi,
Y: mbedtls_mpi,
Z: mbedtls_mpi
}
global mbedtls_ecp_group: type <cimport,nodecl> = @record{
id: mbedtls_ecp_group_id,
P: mbedtls_mpi,
A: mbedtls_mpi,
B: mbedtls_mpi,
G: mbedtls_ecp_point,
N: mbedtls_mpi,
pbits: csize,
nbits: csize,
h: cuint,
modp: function(*mbedtls_mpi): cint,
t_pre: function(*mbedtls_ecp_point, pointer): cint,
t_post: function(*mbedtls_ecp_point, pointer): cint,
t_data: pointer,
T: *mbedtls_ecp_point,
T_size: csize
}
global mbedtls_ecp_keypair: type <cimport,nodecl> = @record{
grp: mbedtls_ecp_group,
d: mbedtls_mpi,
Q: mbedtls_ecp_point
}
global function mbedtls_ecp_get_type(grp: *mbedtls_ecp_group): mbedtls_ecp_curve_type <cimport,nodecl> end
global function mbedtls_ecp_curve_list(): *mbedtls_ecp_curve_info <cimport,nodecl> end
global function mbedtls_ecp_grp_id_list(): *mbedtls_ecp_group_id <cimport,nodecl> end
global function mbedtls_ecp_curve_info_from_grp_id(grp_id: mbedtls_ecp_group_id): *mbedtls_ecp_curve_info <cimport,nodecl> end
global function mbedtls_ecp_curve_info_from_tls_id(tls_id: uint16): *mbedtls_ecp_curve_info <cimport,nodecl> end
global function mbedtls_ecp_curve_info_from_name(name: cstring): *mbedtls_ecp_curve_info <cimport,nodecl> end
global function mbedtls_ecp_point_init(pt: *mbedtls_ecp_point): void <cimport,nodecl> end
global function mbedtls_ecp_group_init(grp: *mbedtls_ecp_group): void <cimport,nodecl> end
global function mbedtls_ecp_keypair_init(key: *mbedtls_ecp_keypair): void <cimport,nodecl> end
global function mbedtls_ecp_point_free(pt: *mbedtls_ecp_point): void <cimport,nodecl> end
global function mbedtls_ecp_group_free(grp: *mbedtls_ecp_group): void <cimport,nodecl> end
global function mbedtls_ecp_keypair_free(key: *mbedtls_ecp_keypair): void <cimport,nodecl> end
global function mbedtls_ecp_copy(P: *mbedtls_ecp_point, Q: *mbedtls_ecp_point): cint <cimport,nodecl> end
global function mbedtls_ecp_group_copy(dst: *mbedtls_ecp_group, src: *mbedtls_ecp_group): cint <cimport,nodecl> end
global function mbedtls_ecp_set_zero(pt: *mbedtls_ecp_point): cint <cimport,nodecl> end
global function mbedtls_ecp_is_zero(pt: *mbedtls_ecp_point): cint <cimport,nodecl> end
global function mbedtls_ecp_point_cmp(P: *mbedtls_ecp_point, Q: *mbedtls_ecp_point): cint <cimport,nodecl> end
global function mbedtls_ecp_point_read_string(P: *mbedtls_ecp_point, radix: cint, x: cstring, y: cstring): cint <cimport,nodecl> end
global function mbedtls_ecp_point_write_binary(grp: *mbedtls_ecp_group, P: *mbedtls_ecp_point, format: cint, olen: *csize, buf: *cuchar, buflen: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_point_read_binary(grp: *mbedtls_ecp_group, P: *mbedtls_ecp_point, buf: *cuchar, ilen: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_tls_read_point(grp: *mbedtls_ecp_group, pt: *mbedtls_ecp_point, buf: **cuchar, len: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_tls_write_point(grp: *mbedtls_ecp_group, pt: *mbedtls_ecp_point, format: cint, olen: *csize, buf: *cuchar, blen: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_group_load(grp: *mbedtls_ecp_group, id: mbedtls_ecp_group_id): cint <cimport,nodecl> end
global function mbedtls_ecp_tls_read_group(grp: *mbedtls_ecp_group, buf: **cuchar, len: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_tls_read_group_id(grp: *mbedtls_ecp_group_id, buf: **cuchar, len: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_tls_write_group(grp: *mbedtls_ecp_group, olen: *csize, buf: *cuchar, blen: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_mul(grp: *mbedtls_ecp_group, R: *mbedtls_ecp_point, m: *mbedtls_mpi, P: *mbedtls_ecp_point, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecp_mul_restartable(grp: *mbedtls_ecp_group, R: *mbedtls_ecp_point, m: *mbedtls_mpi, P: *mbedtls_ecp_point, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, rs_ctx: pointer): cint <cimport,nodecl> end
global function mbedtls_ecp_muladd(grp: *mbedtls_ecp_group, R: *mbedtls_ecp_point, m: *mbedtls_mpi, P: *mbedtls_ecp_point, n: *mbedtls_mpi, Q: *mbedtls_ecp_point): cint <cimport,nodecl> end
global function mbedtls_ecp_muladd_restartable(grp: *mbedtls_ecp_group, R: *mbedtls_ecp_point, m: *mbedtls_mpi, P: *mbedtls_ecp_point, n: *mbedtls_mpi, Q: *mbedtls_ecp_point, rs_ctx: pointer): cint <cimport,nodecl> end
global function mbedtls_ecp_check_pubkey(grp: *mbedtls_ecp_group, pt: *mbedtls_ecp_point): cint <cimport,nodecl> end
global function mbedtls_ecp_check_privkey(grp: *mbedtls_ecp_group, d: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_ecp_gen_privkey(grp: *mbedtls_ecp_group, d: *mbedtls_mpi, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecp_gen_keypair_base(grp: *mbedtls_ecp_group, G: *mbedtls_ecp_point, d: *mbedtls_mpi, Q: *mbedtls_ecp_point, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecp_gen_keypair(grp: *mbedtls_ecp_group, d: *mbedtls_mpi, Q: *mbedtls_ecp_point, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecp_gen_key(grp_id: mbedtls_ecp_group_id, key: *mbedtls_ecp_keypair, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecp_read_key(grp_id: mbedtls_ecp_group_id, key: *mbedtls_ecp_keypair, buf: *cuchar, buflen: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_write_key(key: *mbedtls_ecp_keypair, buf: *cuchar, buflen: csize): cint <cimport,nodecl> end
global function mbedtls_ecp_check_pub_priv(pub: *mbedtls_ecp_keypair, prv: *mbedtls_ecp_keypair): cint <cimport,nodecl> end
global function mbedtls_ecp_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_md_type_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_MD_NONE = 0,
MBEDTLS_MD_MD2 = 1,
MBEDTLS_MD_MD4 = 2,
MBEDTLS_MD_MD5 = 3,
MBEDTLS_MD_SHA1 = 4,
MBEDTLS_MD_SHA224 = 5,
MBEDTLS_MD_SHA256 = 6,
MBEDTLS_MD_SHA384 = 7,
MBEDTLS_MD_SHA512 = 8,
MBEDTLS_MD_RIPEMD160 = 9
}
global mbedtls_md_info_t: type <cimport,nodecl,forwarddecl> = @record{}
global mbedtls_md_context_t: type <cimport,nodecl> = @record{
md_info: *mbedtls_md_info_t,
md_ctx: pointer,
hmac_ctx: pointer
}
global function mbedtls_md_list(): *cint <cimport,nodecl> end
global function mbedtls_md_info_from_string(md_name: cstring): *mbedtls_md_info_t <cimport,nodecl> end
global function mbedtls_md_info_from_type(md_type: mbedtls_md_type_t): *mbedtls_md_info_t <cimport,nodecl> end
global function mbedtls_md_init(ctx: *mbedtls_md_context_t): void <cimport,nodecl> end
global function mbedtls_md_free(ctx: *mbedtls_md_context_t): void <cimport,nodecl> end
global function mbedtls_md_setup(ctx: *mbedtls_md_context_t, md_info: *mbedtls_md_info_t, hmac: cint): cint <cimport,nodecl> end
global function mbedtls_md_clone(dst: *mbedtls_md_context_t, src: *mbedtls_md_context_t): cint <cimport,nodecl> end
global function mbedtls_md_get_size(md_info: *mbedtls_md_info_t): cuchar <cimport,nodecl> end
global function mbedtls_md_get_type(md_info: *mbedtls_md_info_t): mbedtls_md_type_t <cimport,nodecl> end
global function mbedtls_md_get_name(md_info: *mbedtls_md_info_t): cstring <cimport,nodecl> end
global function mbedtls_md_starts(ctx: *mbedtls_md_context_t): cint <cimport,nodecl> end
global function mbedtls_md_update(ctx: *mbedtls_md_context_t, input: *cuchar, ilen: csize): cint <cimport,nodecl> end
global function mbedtls_md_finish(ctx: *mbedtls_md_context_t, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_md(md_info: *mbedtls_md_info_t, input: *cuchar, ilen: csize, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_md_file(md_info: *mbedtls_md_info_t, path: cstring, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_md_hmac_starts(ctx: *mbedtls_md_context_t, key: *cuchar, keylen: csize): cint <cimport,nodecl> end
global function mbedtls_md_hmac_update(ctx: *mbedtls_md_context_t, input: *cuchar, ilen: csize): cint <cimport,nodecl> end
global function mbedtls_md_hmac_finish(ctx: *mbedtls_md_context_t, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_md_hmac_reset(ctx: *mbedtls_md_context_t): cint <cimport,nodecl> end
global function mbedtls_md_hmac(md_info: *mbedtls_md_info_t, key: *cuchar, keylen: csize, input: *cuchar, ilen: csize, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_md_process(ctx: *mbedtls_md_context_t, data: *cuchar): cint <cimport,nodecl> end
global mbedtls_rsa_context: type <cimport,nodecl> = @record{
ver: cint,
len: csize,
N: mbedtls_mpi,
E: mbedtls_mpi,
D: mbedtls_mpi,
P: mbedtls_mpi,
Q: mbedtls_mpi,
DP: mbedtls_mpi,
DQ: mbedtls_mpi,
QP: mbedtls_mpi,
RN: mbedtls_mpi,
RP: mbedtls_mpi,
RQ: mbedtls_mpi,
Vi: mbedtls_mpi,
Vf: mbedtls_mpi,
padding: cint,
hash_id: cint,
mutex: mbedtls_threading_mutex_t
}
global function mbedtls_rsa_init(ctx: *mbedtls_rsa_context, padding: cint, hash_id: cint): void <cimport,nodecl> end
global function mbedtls_rsa_import(ctx: *mbedtls_rsa_context, N: *mbedtls_mpi, P: *mbedtls_mpi, Q: *mbedtls_mpi, D: *mbedtls_mpi, E: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_rsa_import_raw(ctx: *mbedtls_rsa_context, N: *cuchar, N_len: csize, P: *cuchar, P_len: csize, Q: *cuchar, Q_len: csize, D: *cuchar, D_len: csize, E: *cuchar, E_len: csize): cint <cimport,nodecl> end
global function mbedtls_rsa_complete(ctx: *mbedtls_rsa_context): cint <cimport,nodecl> end
global function mbedtls_rsa_export(ctx: *mbedtls_rsa_context, N: *mbedtls_mpi, P: *mbedtls_mpi, Q: *mbedtls_mpi, D: *mbedtls_mpi, E: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_rsa_export_raw(ctx: *mbedtls_rsa_context, N: *cuchar, N_len: csize, P: *cuchar, P_len: csize, Q: *cuchar, Q_len: csize, D: *cuchar, D_len: csize, E: *cuchar, E_len: csize): cint <cimport,nodecl> end
global function mbedtls_rsa_export_crt(ctx: *mbedtls_rsa_context, DP: *mbedtls_mpi, DQ: *mbedtls_mpi, QP: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_rsa_set_padding(ctx: *mbedtls_rsa_context, padding: cint, hash_id: cint): void <cimport,nodecl> end
global function mbedtls_rsa_get_len(ctx: *mbedtls_rsa_context): csize <cimport,nodecl> end
global function mbedtls_rsa_gen_key(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, nbits: cuint, exponent: cint): cint <cimport,nodecl> end
global function mbedtls_rsa_check_pubkey(ctx: *mbedtls_rsa_context): cint <cimport,nodecl> end
global function mbedtls_rsa_check_privkey(ctx: *mbedtls_rsa_context): cint <cimport,nodecl> end
global function mbedtls_rsa_check_pub_priv(pub: *mbedtls_rsa_context, prv: *mbedtls_rsa_context): cint <cimport,nodecl> end
global function mbedtls_rsa_public(ctx: *mbedtls_rsa_context, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_private(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_pkcs1_encrypt(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, ilen: csize, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsaes_pkcs1_v15_encrypt(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, ilen: csize, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsaes_oaep_encrypt(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, label: *cuchar, label_len: csize, ilen: csize, input: *cuchar, output: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_pkcs1_decrypt(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, olen: *csize, input: *cuchar, output: *cuchar, output_max_len: csize): cint <cimport,nodecl> end
global function mbedtls_rsa_rsaes_pkcs1_v15_decrypt(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, olen: *csize, input: *cuchar, output: *cuchar, output_max_len: csize): cint <cimport,nodecl> end
global function mbedtls_rsa_rsaes_oaep_decrypt(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, label: *cuchar, label_len: csize, olen: *csize, input: *cuchar, output: *cuchar, output_max_len: csize): cint <cimport,nodecl> end
global function mbedtls_rsa_pkcs1_sign(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsassa_pkcs1_v15_sign(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsassa_pss_sign_ext(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, saltlen: cint, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsassa_pss_sign(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_pkcs1_verify(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsassa_pkcs1_v15_verify(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsassa_pss_verify(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_rsassa_pss_verify_ext(ctx: *mbedtls_rsa_context, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, mode: cint, md_alg: mbedtls_md_type_t, hashlen: cuint, hash: *cuchar, mgf1_hash_id: mbedtls_md_type_t, expected_salt_len: cint, sig: *cuchar): cint <cimport,nodecl> end
global function mbedtls_rsa_copy(dst: *mbedtls_rsa_context, src: *mbedtls_rsa_context): cint <cimport,nodecl> end
global function mbedtls_rsa_free(ctx: *mbedtls_rsa_context): void <cimport,nodecl> end
global function mbedtls_rsa_self_test(verbose: cint): cint <cimport,nodecl> end
global mbedtls_ecdsa_context: type = @mbedtls_ecp_keypair
global function mbedtls_ecdsa_can_do(gid: mbedtls_ecp_group_id): cint <cimport,nodecl> end
global function mbedtls_ecdsa_sign(grp: *mbedtls_ecp_group, r: *mbedtls_mpi, s: *mbedtls_mpi, d: *mbedtls_mpi, buf: *cuchar, blen: csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecdsa_sign_det_ext(grp: *mbedtls_ecp_group, r: *mbedtls_mpi, s: *mbedtls_mpi, d: *mbedtls_mpi, buf: *cuchar, blen: csize, md_alg: mbedtls_md_type_t, f_rng_blind: function(pointer, *cuchar, csize): cint, p_rng_blind: pointer): cint <cimport,nodecl> end
global function mbedtls_ecdsa_verify(grp: *mbedtls_ecp_group, buf: *cuchar, blen: csize, Q: *mbedtls_ecp_point, r: *mbedtls_mpi, s: *mbedtls_mpi): cint <cimport,nodecl> end
global function mbedtls_ecdsa_write_signature(ctx: *mbedtls_ecdsa_context, md_alg: mbedtls_md_type_t, hash: *cuchar, hlen: csize, sig: *cuchar, slen: *csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecdsa_write_signature_restartable(ctx: *mbedtls_ecdsa_context, md_alg: mbedtls_md_type_t, hash: *cuchar, hlen: csize, sig: *cuchar, slen: *csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, rs_ctx: pointer): cint <cimport,nodecl> end
global function mbedtls_ecdsa_read_signature(ctx: *mbedtls_ecdsa_context, hash: *cuchar, hlen: csize, sig: *cuchar, slen: csize): cint <cimport,nodecl> end
global function mbedtls_ecdsa_read_signature_restartable(ctx: *mbedtls_ecdsa_context, hash: *cuchar, hlen: csize, sig: *cuchar, slen: csize, rs_ctx: pointer): cint <cimport,nodecl> end
global function mbedtls_ecdsa_genkey(ctx: *mbedtls_ecdsa_context, gid: mbedtls_ecp_group_id, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_ecdsa_from_keypair(ctx: *mbedtls_ecdsa_context, key: *mbedtls_ecp_keypair): cint <cimport,nodecl> end
global function mbedtls_ecdsa_init(ctx: *mbedtls_ecdsa_context): void <cimport,nodecl> end
global function mbedtls_ecdsa_free(ctx: *mbedtls_ecdsa_context): void <cimport,nodecl> end
global mbedtls_pk_type_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_PK_NONE = 0,
MBEDTLS_PK_RSA = 1,
MBEDTLS_PK_ECKEY = 2,
MBEDTLS_PK_ECKEY_DH = 3,
MBEDTLS_PK_ECDSA = 4,
MBEDTLS_PK_RSA_ALT = 5,
MBEDTLS_PK_RSASSA_PSS = 6,
MBEDTLS_PK_OPAQUE = 7
}
global mbedtls_pk_rsassa_pss_options: type <cimport,nodecl> = @record{
mgf1_hash_id: mbedtls_md_type_t,
expected_salt_len: cint
}
global mbedtls_pk_debug_type: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_PK_DEBUG_NONE = 0,
MBEDTLS_PK_DEBUG_MPI = 1,
MBEDTLS_PK_DEBUG_ECP = 2
}
global mbedtls_pk_debug_item: type <cimport,nodecl> = @record{
type: mbedtls_pk_debug_type,
name: cstring,
value: pointer
}
global mbedtls_pk_info_t: type <cimport,nodecl,forwarddecl> = @record{}
global mbedtls_pk_context: type <cimport,nodecl> = @record{
pk_info: *mbedtls_pk_info_t,
pk_ctx: pointer
}
global mbedtls_pk_rsa_alt_decrypt_func: type <cimport,nodecl> = @function(pointer, cint, *csize, *cuchar, *cuchar, csize): cint
global mbedtls_pk_rsa_alt_sign_func: type <cimport,nodecl> = @function(pointer, function(pointer, *cuchar, csize): cint, pointer, cint, mbedtls_md_type_t, cuint, *cuchar, *cuchar): cint
global mbedtls_pk_rsa_alt_key_len_func: type <cimport,nodecl> = @function(pointer): csize
global function mbedtls_pk_info_from_type(pk_type: mbedtls_pk_type_t): *mbedtls_pk_info_t <cimport,nodecl> end
global function mbedtls_pk_init(ctx: *mbedtls_pk_context): void <cimport,nodecl> end
global function mbedtls_pk_free(ctx: *mbedtls_pk_context): void <cimport,nodecl> end
global function mbedtls_pk_setup(ctx: *mbedtls_pk_context, info: *mbedtls_pk_info_t): cint <cimport,nodecl> end
global function mbedtls_pk_setup_rsa_alt(ctx: *mbedtls_pk_context, key: pointer, decrypt_func: mbedtls_pk_rsa_alt_decrypt_func, sign_func: mbedtls_pk_rsa_alt_sign_func, key_len_func: mbedtls_pk_rsa_alt_key_len_func): cint <cimport,nodecl> end
global function mbedtls_pk_get_bitlen(ctx: *mbedtls_pk_context): csize <cimport,nodecl> end
global function mbedtls_pk_get_len(ctx: *mbedtls_pk_context): csize <cimport,nodecl> end
global function mbedtls_pk_can_do(ctx: *mbedtls_pk_context, type: mbedtls_pk_type_t): cint <cimport,nodecl> end
global function mbedtls_pk_verify(ctx: *mbedtls_pk_context, md_alg: mbedtls_md_type_t, hash: *cuchar, hash_len: csize, sig: *cuchar, sig_len: csize): cint <cimport,nodecl> end
global function mbedtls_pk_verify_restartable(ctx: *mbedtls_pk_context, md_alg: mbedtls_md_type_t, hash: *cuchar, hash_len: csize, sig: *cuchar, sig_len: csize, rs_ctx: pointer): cint <cimport,nodecl> end
global function mbedtls_pk_verify_ext(type: mbedtls_pk_type_t, options: pointer, ctx: *mbedtls_pk_context, md_alg: mbedtls_md_type_t, hash: *cuchar, hash_len: csize, sig: *cuchar, sig_len: csize): cint <cimport,nodecl> end
global function mbedtls_pk_sign(ctx: *mbedtls_pk_context, md_alg: mbedtls_md_type_t, hash: *cuchar, hash_len: csize, sig: *cuchar, sig_len: *csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_pk_sign_restartable(ctx: *mbedtls_pk_context, md_alg: mbedtls_md_type_t, hash: *cuchar, hash_len: csize, sig: *cuchar, sig_len: *csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer, rs_ctx: pointer): cint <cimport,nodecl> end
global function mbedtls_pk_decrypt(ctx: *mbedtls_pk_context, input: *cuchar, ilen: csize, output: *cuchar, olen: *csize, osize: csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_pk_encrypt(ctx: *mbedtls_pk_context, input: *cuchar, ilen: csize, output: *cuchar, olen: *csize, osize: csize, f_rng: function(pointer, *cuchar, csize): cint, p_rng: pointer): cint <cimport,nodecl> end
global function mbedtls_pk_check_pair(pub: *mbedtls_pk_context, prv: *mbedtls_pk_context): cint <cimport,nodecl> end
global function mbedtls_pk_debug(ctx: *mbedtls_pk_context, items: *mbedtls_pk_debug_item): cint <cimport,nodecl> end
global function mbedtls_pk_get_name(ctx: *mbedtls_pk_context): cstring <cimport,nodecl> end
global function mbedtls_pk_get_type(ctx: *mbedtls_pk_context): mbedtls_pk_type_t <cimport,nodecl> end
global function mbedtls_pk_rsa(pk: mbedtls_pk_context): *mbedtls_rsa_context <cimport,nodecl> end
global function mbedtls_pk_ec(pk: mbedtls_pk_context): *mbedtls_ecp_keypair <cimport,nodecl> end
global function mbedtls_pk_parse_key(ctx: *mbedtls_pk_context, key: *cuchar, keylen: csize, pwd: *cuchar, pwdlen: csize): cint <cimport,nodecl> end
global function mbedtls_pk_parse_public_key(ctx: *mbedtls_pk_context, key: *cuchar, keylen: csize): cint <cimport,nodecl> end
global function mbedtls_pk_parse_keyfile(ctx: *mbedtls_pk_context, path: cstring, password: cstring): cint <cimport,nodecl> end
global function mbedtls_pk_parse_public_keyfile(ctx: *mbedtls_pk_context, path: cstring): cint <cimport,nodecl> end
global function mbedtls_pk_write_key_der(ctx: *mbedtls_pk_context, buf: *cuchar, size: csize): cint <cimport,nodecl> end
global function mbedtls_pk_write_pubkey_der(ctx: *mbedtls_pk_context, buf: *cuchar, size: csize): cint <cimport,nodecl> end
global function mbedtls_pk_write_pubkey_pem(ctx: *mbedtls_pk_context, buf: *cuchar, size: csize): cint <cimport,nodecl> end
global function mbedtls_pk_write_key_pem(ctx: *mbedtls_pk_context, buf: *cuchar, size: csize): cint <cimport,nodecl> end
global function mbedtls_pk_parse_subpubkey(p: **cuchar, End: *cuchar, pk: *mbedtls_pk_context): cint <cimport,nodecl> end
global function mbedtls_pk_write_pubkey(p: **cuchar, start: *cuchar, key: *mbedtls_pk_context): cint <cimport,nodecl> end
global function mbedtls_pk_load_file(path: cstring, buf: **cuchar, n: *csize): cint <cimport,nodecl> end
global mbedtls_key_exchange_type_t: type <cimport,nodecl,using> = @enum(cint){
MBEDTLS_KEY_EXCHANGE_NONE = 0,
MBEDTLS_KEY_EXCHANGE_RSA = 1,
MBEDTLS_KEY_EXCHANGE_DHE_RSA = 2,
MBEDTLS_KEY_EXCHANGE_ECDHE_RSA = 3,
MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA = 4,
MBEDTLS_KEY_EXCHANGE_PSK = 5,
MBEDTLS_KEY_EXCHANGE_DHE_PSK = 6,
MBEDTLS_KEY_EXCHANGE_RSA_PSK = 7,
MBEDTLS_KEY_EXCHANGE_ECDHE_PSK = 8,
MBEDTLS_KEY_EXCHANGE_ECDH_RSA = 9,
MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA = 10,
MBEDTLS_KEY_EXCHANGE_ECJPAKE = 11
}
global mbedtls_ssl_ciphersuite_t: type <cimport,nodecl,forwarddecl> = @record{}
mbedtls_ssl_ciphersuite_t = @record{
id: cint,
name: cstring,
cipher: mbedtls_cipher_type_t,
mac: mbedtls_md_type_t,
key_exchange: mbedtls_key_exchange_type_t,
min_major_ver: cint,
min_minor_ver: cint,
max_major_ver: cint,
max_minor_ver: cint,
flags: cuchar
}
global function mbedtls_ssl_list_ciphersuites(): *cint <cimport,nodecl> end
global function mbedtls_ssl_ciphersuite_from_string(ciphersuite_name: cstring): *mbedtls_ssl_ciphersuite_t <cimport,nodecl> end
global function mbedtls_ssl_ciphersuite_from_id(ciphersuite_id: cint): *mbedtls_ssl_ciphersuite_t <cimport,nodecl> end
global function mbedtls_ssl_get_ciphersuite_sig_pk_alg(info: *mbedtls_ssl_ciphersuite_t): mbedtls_pk_type_t <cimport,nodecl> end
global function mbedtls_ssl_get_ciphersuite_sig_alg(info: *mbedtls_ssl_ciphersuite_t): mbedtls_pk_type_t <cimport,nodecl> end
global function mbedtls_ssl_ciphersuite_uses_ec(info: *mbedtls_ssl_ciphersuite_t): cint <cimport,nodecl> end