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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
extern crate libc;
use std::mem;
use std::ptr;
use libc::{size_t, c_uchar, c_int, c_ulonglong, c_char, c_void,
uint32_t, uint64_t, uint8_t, int32_t, int64_t, uint16_t};
pub const crypto_aead_chacha20poly1305_KEYBYTES: size_t = 32;
pub const crypto_aead_chacha20poly1305_NSECBYTES: size_t = 0;
pub const crypto_aead_chacha20poly1305_NPUBBYTES: size_t = 8;
pub const crypto_aead_chacha20poly1305_ABYTES: size_t = 16;
pub const crypto_auth_hmacsha256_BYTES: size_t = 32;
pub const crypto_auth_hmacsha256_KEYBYTES: size_t = 32;
pub const crypto_auth_BYTES: size_t = crypto_auth_hmacsha512256_BYTES;
pub const crypto_auth_KEYBYTES: size_t = crypto_auth_hmacsha512256_KEYBYTES;
pub const crypto_auth_PRIMITIVE: &'static str = "hmacsha512256";
pub const crypto_auth_hmacsha512_BYTES: size_t = 64;
pub const crypto_auth_hmacsha512_KEYBYTES: size_t = 32;
pub const crypto_auth_hmacsha512256_BYTES: size_t = 32;
pub const crypto_auth_hmacsha512256_KEYBYTES: size_t = 32;
pub const crypto_box_SEEDBYTES: size_t = crypto_box_curve25519xsalsa20poly1305_SEEDBYTES;
pub const crypto_box_PUBLICKEYBYTES: size_t = crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES;
pub const crypto_box_SECRETKEYBYTES: size_t = crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES;
pub const crypto_box_NONCEBYTES: size_t = crypto_box_curve25519xsalsa20poly1305_NONCEBYTES;
pub const crypto_box_MACBYTES: size_t = crypto_box_curve25519xsalsa20poly1305_MACBYTES;
pub const crypto_box_PRIMITIVE: &'static str = "curve25519xsalsa20poly1305";
pub const crypto_box_SEALBYTES: size_t = crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES;
pub const crypto_box_curve25519xsalsa20poly1305_SEEDBYTES: size_t = 32;
pub const crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES: size_t = 32;
pub const crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES: size_t = 32;
pub const crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES: size_t = 32;
pub const crypto_box_curve25519xsalsa20poly1305_NONCEBYTES: size_t = 24;
pub const crypto_box_curve25519xsalsa20poly1305_ZEROBYTES: size_t = 32;
pub const crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES: size_t = 16;
pub const crypto_box_curve25519xsalsa20poly1305_MACBYTES: size_t = crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
- crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES;
pub const crypto_core_hsalsa20_OUTPUTBYTES: size_t = 32;
pub const crypto_core_hsalsa20_INPUTBYTES: size_t = 16;
pub const crypto_core_hsalsa20_KEYBYTES: size_t = 32;
pub const crypto_core_hsalsa20_CONSTBYTES: size_t = 16;
pub const crypto_core_salsa20_OUTPUTBYTES: size_t = 64;
pub const crypto_core_salsa20_INPUTBYTES: size_t = 16;
pub const crypto_core_salsa20_KEYBYTES: size_t = 32;
pub const crypto_core_salsa20_CONSTBYTES: size_t = 16;
pub const crypto_core_salsa2012_OUTPUTBYTES: size_t = 64;
pub const crypto_core_salsa2012_INPUTBYTES: size_t = 16;
pub const crypto_core_salsa2012_KEYBYTES: size_t = 32;
pub const crypto_core_salsa2012_CONSTBYTES: size_t = 16;
pub const crypto_core_salsa208_OUTPUTBYTES: size_t = 64;
pub const crypto_core_salsa208_INPUTBYTES: size_t = 16;
pub const crypto_core_salsa208_KEYBYTES: size_t = 32;
pub const crypto_core_salsa208_CONSTBYTES: size_t = 16;
pub const crypto_generichash_BYTES_MIN: size_t = crypto_generichash_blake2b_BYTES_MIN;
pub const crypto_generichash_BYTES_MAX: size_t = crypto_generichash_blake2b_BYTES_MAX;
pub const crypto_generichash_BYTES: size_t = crypto_generichash_blake2b_BYTES;
pub const crypto_generichash_KEYBYTES_MIN: size_t = crypto_generichash_blake2b_KEYBYTES_MIN;
pub const crypto_generichash_KEYBYTES_MAX: size_t = crypto_generichash_blake2b_KEYBYTES_MAX;
pub const crypto_generichash_KEYBYTES: size_t = crypto_generichash_blake2b_KEYBYTES;
pub const crypto_generichash_PRIMITIVE: &'static str = "blake2b";
pub const crypto_generichash_blake2b_BYTES_MIN: size_t = 16;
pub const crypto_generichash_blake2b_BYTES_MAX: size_t = 64;
pub const crypto_generichash_blake2b_BYTES: size_t = 32;
pub const crypto_generichash_blake2b_KEYBYTES_MIN: size_t = 16;
pub const crypto_generichash_blake2b_KEYBYTES_MAX: size_t = 64;
pub const crypto_generichash_blake2b_KEYBYTES: size_t = 32;
pub const crypto_generichash_blake2b_SALTBYTES: size_t = 16;
pub const crypto_generichash_blake2b_PERSONALBYTES: size_t = 16;
pub const crypto_hash_sha512_BYTES: size_t = 64;
pub const crypto_hash_sha256_BYTES: size_t = 32;
pub const crypto_hash_BYTES: size_t = crypto_hash_sha512_BYTES;
pub const crypto_hash_PRIMITIVE: &'static str = "sha512";
pub const crypto_onetimeauth_BYTES: size_t = crypto_onetimeauth_poly1305_BYTES;
pub const crypto_onetimeauth_KEYBYTES: size_t = crypto_onetimeauth_poly1305_KEYBYTES;
pub const crypto_onetimeauth_PRIMITIVE: &'static str = "poly1305";
pub const crypto_onetimeauth_poly1305_BYTES: size_t = 16;
pub const crypto_onetimeauth_poly1305_KEYBYTES: size_t = 32;
pub const crypto_pwhash_scryptsalsa208sha256_SALTBYTES: size_t = 32;
pub const crypto_pwhash_scryptsalsa208sha256_STRBYTES: size_t = 102;
pub const crypto_pwhash_scryptsalsa208sha256_STRPREFIX: &'static str = "$7$";
pub const crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE: size_t = 524288;
pub const crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE: size_t = 16777216;
pub const crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE: size_t = 33554432;
pub const crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE: size_t = 1073741824;
pub const crypto_scalarmult_BYTES: size_t = crypto_scalarmult_curve25519_BYTES;
pub const crypto_scalarmult_SCALARBYTES: size_t = crypto_scalarmult_curve25519_SCALARBYTES;
pub const crypto_scalarmult_PRIMITIVE: &'static str = "curve25519";
pub const crypto_scalarmult_curve25519_BYTES: size_t = 32;
pub const crypto_scalarmult_curve25519_SCALARBYTES: size_t = 32;
pub const crypto_secretbox_KEYBYTES: size_t = crypto_secretbox_xsalsa20poly1305_KEYBYTES;
pub const crypto_secretbox_NONCEBYTES: size_t = crypto_secretbox_xsalsa20poly1305_NONCEBYTES;
pub const crypto_secretbox_MACBYTES: size_t = crypto_secretbox_xsalsa20poly1305_MACBYTES;
pub const crypto_secretbox_PRIMITIVE: &'static str = "xsalsa20poly1305";
pub const crypto_secretbox_ZEROBYTES: size_t = crypto_secretbox_xsalsa20poly1305_ZEROBYTES;
pub const crypto_secretbox_BOXZEROBYTES: size_t = crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
pub const crypto_secretbox_xsalsa20poly1305_KEYBYTES: size_t = 32;
pub const crypto_secretbox_xsalsa20poly1305_NONCEBYTES: size_t = 24;
pub const crypto_secretbox_xsalsa20poly1305_ZEROBYTES: size_t = 32;
pub const crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES: size_t = 16;
pub const crypto_secretbox_xsalsa20poly1305_MACBYTES: size_t = crypto_secretbox_xsalsa20poly1305_ZEROBYTES
- crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
pub const crypto_shorthash_BYTES: size_t = crypto_shorthash_siphash24_BYTES;
pub const crypto_shorthash_KEYBYTES: size_t = crypto_shorthash_siphash24_KEYBYTES;
pub const crypto_shorthash_PRIMITIVE: &'static str = "siphash24";
pub const crypto_shorthash_siphash24_BYTES: size_t = 8;
pub const crypto_shorthash_siphash24_KEYBYTES: size_t = 16;
pub const crypto_sign_BYTES: size_t = crypto_sign_ed25519_BYTES;
pub const crypto_sign_SEEDBYTES: size_t = crypto_sign_ed25519_SEEDBYTES;
pub const crypto_sign_PUBLICKEYBYTES: size_t = crypto_sign_ed25519_PUBLICKEYBYTES;
pub const crypto_sign_SECRETKEYBYTES: size_t = crypto_sign_ed25519_SECRETKEYBYTES;
pub const crypto_sign_PRIMITIVE: &'static str = "ed25519";
pub const crypto_sign_ed25519_BYTES: size_t = 64;
pub const crypto_sign_ed25519_SEEDBYTES: size_t = 32;
pub const crypto_sign_ed25519_PUBLICKEYBYTES: size_t = 32;
pub const crypto_sign_ed25519_SECRETKEYBYTES: size_t = 32 + 32;
pub const crypto_sign_edwards25519sha512batch_BYTES: size_t = 64;
pub const crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES: size_t = 32;
pub const crypto_sign_edwards25519sha512batch_SECRETKEYBYTES: size_t = 32 + 32;
pub const crypto_stream_KEYBYTES: size_t = crypto_stream_xsalsa20_KEYBYTES;
pub const crypto_stream_NONCEBYTES: size_t = crypto_stream_xsalsa20_NONCEBYTES;
pub const crypto_stream_PRIMITIVE: &'static str = "xsalsa20";
pub const crypto_stream_aes128ctr_KEYBYTES: size_t = 16;
pub const crypto_stream_aes128ctr_NONCEBYTES: size_t = 16;
pub const crypto_stream_aes128ctr_BEFORENMBYTES: size_t = 1408;
pub const crypto_stream_chacha20_KEYBYTES: size_t = 32;
pub const crypto_stream_chacha20_NONCEBYTES: size_t = 8;
pub const crypto_stream_salsa20_KEYBYTES: size_t = 32;
pub const crypto_stream_salsa20_NONCEBYTES: size_t = 8;
pub const crypto_stream_salsa2012_KEYBYTES: size_t = 32;
pub const crypto_stream_salsa2012_NONCEBYTES: size_t = 8;
pub const crypto_stream_salsa208_KEYBYTES: size_t = 32;
pub const crypto_stream_salsa208_NONCEBYTES: size_t = 8;
pub const crypto_stream_xsalsa20_KEYBYTES: size_t = 32;
pub const crypto_stream_xsalsa20_NONCEBYTES: size_t = 24;
pub const crypto_verify_16_BYTES: size_t = 16;
pub const crypto_verify_32_BYTES: size_t = 32;
pub const crypto_verify_64_BYTES: size_t = 64;
extern {
pub fn sodium_init() -> c_int;
pub fn crypto_aead_chacha20poly1305_keybytes() -> size_t;
pub fn crypto_aead_chacha20poly1305_nsecbytes() -> size_t;
pub fn crypto_aead_chacha20poly1305_npubbytes() -> size_t;
pub fn crypto_aead_chacha20poly1305_abytes() -> size_t;
pub fn crypto_aead_chacha20poly1305_encrypt(c: *mut c_uchar,
clen: *mut c_ulonglong,
m: *const c_uchar,
mlen: c_ulonglong,
ad: *const c_uchar,
adlen: c_ulonglong,
nsec: *const c_uchar,
npub: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_aead_chacha20poly1305_decrypt(m: *mut c_uchar,
mlen: *mut c_ulonglong,
nsec: *mut c_uchar,
c: *const c_uchar,
clen: c_ulonglong,
ad: *const c_uchar,
adlen: c_ulonglong,
npub: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_auth_bytes() -> size_t;
pub fn crypto_auth_keybytes() -> size_t;
pub fn crypto_auth_primitive() -> *const c_char;
pub fn crypto_auth(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, k: *const c_uchar) -> c_int;
pub fn crypto_auth_verify(h: *const c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, k: *const c_uchar) -> c_int;
pub fn crypto_auth_hmacsha256_statebytes() -> size_t;
pub fn crypto_auth_hmacsha256_bytes() -> size_t;
pub fn crypto_auth_hmacsha256_keybytes() -> size_t;
pub fn crypto_auth_hmacsha256(out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int;
pub fn crypto_auth_hmacsha256_verify(h: *const c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int;
pub fn crypto_auth_hmacsha256_init(state: *mut crypto_auth_hmacsha256_state,
key: *const c_uchar,
keylen: size_t) -> c_int;
pub fn crypto_auth_hmacsha256_update(state: *mut crypto_auth_hmacsha256_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_auth_hmacsha256_final(state: *mut crypto_auth_hmacsha256_state,
out: *mut c_uchar) -> c_int;
pub fn crypto_auth_hmacsha512_statebytes() -> size_t;
pub fn crypto_auth_hmacsha512_bytes() -> size_t;
pub fn crypto_auth_hmacsha512_keybytes() -> size_t;
pub fn crypto_auth_hmacsha512(out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int;
pub fn crypto_auth_hmacsha512_verify(h: *const c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int;
pub fn crypto_auth_hmacsha512_init(state: *mut crypto_auth_hmacsha512_state,
key: *const c_uchar,
keylen: size_t) -> c_int;
pub fn crypto_auth_hmacsha512_update(state: *mut crypto_auth_hmacsha512_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_auth_hmacsha512_final(state: *mut crypto_auth_hmacsha512_state,
out: *mut c_uchar) -> c_int;
pub fn crypto_auth_hmacsha512256_statebytes() -> size_t;
pub fn crypto_auth_hmacsha512256_bytes() -> size_t;
pub fn crypto_auth_hmacsha512256_keybytes() -> size_t;
pub fn crypto_auth_hmacsha512256(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, k: *const c_uchar) -> c_int;
pub fn crypto_auth_hmacsha512256_verify(h: *const c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar);
pub fn crypto_auth_hmacsha512256_init(state: *mut crypto_auth_hmacsha512256_state,
key: *const c_uchar,
keylen: size_t) -> c_int;
pub fn crypto_auth_hmacsha512256_update(state: *mut crypto_auth_hmacsha512256_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_auth_hmacsha512256_final(state: *mut crypto_auth_hmacsha512256_state,
out: *mut c_uchar) -> c_int;
pub fn crypto_box_seedbytes() -> size_t;
pub fn crypto_box_publickeybytes() -> size_t;
pub fn crypto_box_secretkeybytes() -> size_t;
pub fn crypto_box_noncebytes() -> size_t;
pub fn crypto_box_macbytes() -> size_t;
pub fn crypto_box_primitive() -> *const c_char;
pub fn crypto_box_seed_keypair(pk: *mut c_uchar, sk: *mut c_uchar,
seed: *const c_uchar) -> c_int;
pub fn crypto_box_keypair(pk: *mut c_uchar, sk: *mut c_uchar) -> c_int;
pub fn crypto_box_easy(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
pk: *const c_uchar, sk: *const c_uchar) -> c_int;
pub fn crypto_box_open_easy(m: *mut c_uchar, c: *const c_uchar,
clen: c_ulonglong, n: *const c_uchar,
pk: *const c_uchar, sk: *const c_uchar) -> c_int;
pub fn crypto_box_detached(c: *mut c_uchar, mac: *mut c_uchar,
m: *const c_uchar, mlen: c_ulonglong,
n: *const c_uchar, pk: *const c_uchar,
sk: *const c_uchar) -> c_int;
pub fn crypto_box_open_detached(m: *mut c_uchar, c: *const c_uchar,
mac: *const c_uchar,
clen: c_ulonglong,
n: *const c_uchar,
pk: *const c_uchar,
sk: *const c_uchar) -> c_int;
pub fn crypto_box_beforenmbytes() -> size_t;
pub fn crypto_box_beforenm(k: *mut c_uchar, pk: *const c_uchar,
sk: *const c_uchar) -> c_int;
pub fn crypto_box_easy_afternm(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_box_open_easy_afternm(m: *mut c_uchar, c: *const c_uchar,
clen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_box_detached_afternm(c: *mut c_uchar, mac: *mut c_uchar,
m: *const c_uchar, mlen: c_ulonglong,
n: *const c_uchar, k: c_uchar) -> c_int;
pub fn crypto_box_open_detached_afternm(m: *mut c_uchar, c: *const c_uchar,
mac: *const c_uchar,
clen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_box_sealbytes() -> size_t;
pub fn crypto_box_seal(out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
pk: *const c_uchar) -> c_int;
pub fn crypto_box_seal_open(out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
pk: *const c_uchar) -> c_int;
pub fn crypto_box_zerobytes() -> size_t;
pub fn crypto_box_boxzerobytes() -> size_t;
pub fn crypto_box(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
pk: *const c_uchar, sk: *const c_uchar) -> c_int;
pub fn crypto_box_open(m: *mut c_uchar, c: *const c_uchar,
clen: c_ulonglong, n: *const c_uchar,
pk: *const c_uchar, sk: *const c_uchar) -> c_int;
pub fn crypto_box_afternm(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_box_open_afternm(m: *mut c_uchar, c: *const c_uchar,
clen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_box_curve25519xsalsa20poly1305_seedbytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305_publickeybytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305_secretkeybytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305_beforenmbytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305_noncebytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305_zerobytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305_boxzerobytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305_macbytes() -> size_t;
pub fn crypto_box_curve25519xsalsa20poly1305(c: *mut c_uchar,
m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar,
pk: *const c_uchar,
sk: *const c_uchar) -> c_int;
pub fn crypto_box_curve25519xsalsa20poly1305_open(m: *mut c_uchar,
c: *const c_uchar,
clen: c_ulonglong,
n: *const c_uchar,
pk: *const c_uchar,
sk: *const c_uchar) -> c_int;
pub fn crypto_box_curve25519xsalsa20poly1305_seed_keypair(pk: *mut c_uchar,
sk: *mut c_uchar,
seed: *const c_uchar) -> c_int;
pub fn crypto_box_curve25519xsalsa20poly1305_keypair(pk: *mut c_uchar,
sk: *mut c_uchar) -> c_int;
pub fn crypto_box_curve25519xsalsa20poly1305_beforenm(k: *mut c_uchar,
pk: *const c_uchar,
sk: *const c_uchar) -> c_int;
pub fn crypto_box_curve25519xsalsa20poly1305_afternm(c: *mut c_uchar,
m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_box_curve25519xsalsa20poly1305_open_afternm(m: *mut c_uchar,
c: *const c_uchar,
clen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_core_hsalsa20_outputbytes() -> size_t;
pub fn crypto_core_hsalsa20_inputbytes() -> size_t;
pub fn crypto_core_hsalsa20_keybytes() -> size_t;
pub fn crypto_core_hsalsa20_constbytes() -> size_t;
pub fn crypto_core_hsalsa20(out: *mut c_uchar, in_: *const c_uchar,
k: *const c_uchar, c: *const c_uchar) -> c_int;
pub fn crypto_core_salsa20_outputbytes() -> size_t;
pub fn crypto_core_salsa20_inputbytes() -> size_t;
pub fn crypto_core_salsa20_keybytes() -> size_t;
pub fn crypto_core_salsa20_constbytes() -> size_t;
pub fn crypto_core_salsa20(out: *mut c_uchar, in_: *const c_uchar,
k: *const c_uchar, c: *const c_uchar) -> c_int;
pub fn crypto_core_salsa2012_outputbytes() -> size_t;
pub fn crypto_core_salsa2012_inputbytes() -> size_t;
pub fn crypto_core_salsa2012_keybytes() -> size_t;
pub fn crypto_core_salsa2012_constbytes() -> size_t;
pub fn crypto_core_salsa2012(out: *mut c_uchar, in_: *const c_uchar,
k: *const c_uchar, c: *const c_uchar) -> c_int;
pub fn crypto_core_salsa208_outputbytes() -> size_t;
pub fn crypto_core_salsa208_inputbytes() -> size_t;
pub fn crypto_core_salsa208_keybytes() -> size_t;
pub fn crypto_core_salsa208_constbytes() -> size_t;
pub fn crypto_core_salsa208(out: *mut c_uchar, in_: *const c_uchar,
k: *const c_uchar, c: *const c_uchar) -> c_int;
pub fn crypto_generichash_bytes_min() -> size_t;
pub fn crypto_generichash_bytes_max() -> size_t;
pub fn crypto_generichash_bytes() -> size_t;
pub fn crypto_generichash_keybytes_min() -> size_t;
pub fn crypto_generichash_keybytes() -> size_t;
pub fn crypto_generichash_primitive() -> *const c_char;
pub fn crypto_generichash_statebytes() -> size_t;
pub fn crypto_generichash(out: *mut c_uchar, outlen: size_t,
in_: *const c_uchar, inlen: c_ulonglong,
key: *const c_uchar, keylen: size_t) -> c_int;
pub fn crypto_generichash_init(state: *mut crypto_generichash_state,
key: *const c_uchar,
keylen: size_t, outlen: size_t) -> c_int;
pub fn crypto_generichash_update(state: *mut crypto_generichash_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_generichash_final(state: *mut crypto_generichash_state,
out: *mut c_uchar, outlen: size_t) -> c_int;
pub fn crypto_generichash_blake2b_bytes_min() -> size_t;
pub fn crypto_generichash_blake2b_bytes_max() -> size_t;
pub fn crypto_generichash_blake2b_bytes() -> size_t;
pub fn crypto_generichash_blake2b_keybytes_min() -> size_t;
pub fn crypto_generichash_blake2b_keybytes_max() -> size_t;
pub fn crypto_generichash_blake2b_keybytes() -> size_t;
pub fn crypto_generichash_blake2b_saltbytes() -> size_t;
pub fn crypto_generichash_blake2b_personalbytes() -> size_t;
pub fn crypto_generichash_blake2b(out: *mut c_uchar, outlen: size_t,
in_: *const c_uchar, inlen: c_ulonglong,
key: *const c_uchar, keylen: size_t) -> c_int;
pub fn crypto_generichash_blake2b_salt_personal(out: *mut c_uchar, outlen: size_t,
in_: *const c_uchar,
inlen: c_ulonglong,
key: *const c_uchar,
keylen: size_t,
salt: *const c_uchar,
personal: *const c_uchar) -> c_int;
pub fn crypto_generichash_blake2b_update(state: *mut crypto_generichash_blake2b_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_generichash_blake2b_final(state: *mut crypto_generichash_blake2b_state,
out: *mut c_uchar,
outlen: size_t) -> c_int;
pub fn crypto_hash_bytes() -> size_t;
pub fn crypto_hash(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_hash_primitive() -> *const c_char;
pub fn crypto_hash_sha256_statebytes() -> size_t;
pub fn crypto_hash_sha256_bytes() -> size_t;
pub fn crypto_hash_sha256(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_hash_sha256_init(state: *mut crypto_hash_sha256_state) -> c_int;
pub fn crypto_hash_sha256_update(state: *mut crypto_hash_sha256_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_hash_sha256_final(state: *mut crypto_hash_sha256_state,
out: *mut c_uchar) -> c_int;
pub fn crypto_hash_sha512_statebytes() -> size_t;
pub fn crypto_hash_sha512_bytes() -> size_t;
pub fn crypto_hash_sha512(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_hash_sha512_init(state: *mut crypto_hash_sha512_state) -> c_int;
pub fn crypto_hash_sha512_update(state: *mut crypto_hash_sha512_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_hash_sha512_final(state: *mut crypto_hash_sha256_state,
out: *mut c_uchar) -> c_int;
pub fn crypto_onetimeauth_statebytes() -> size_t;
pub fn crypto_onetimeauth_bytes() -> size_t;
pub fn crypto_onetimeauth_keybytes() -> size_t;
pub fn crypto_onetimeauth_primitive() -> *const c_char;
pub fn crypto_onetimeauth(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, k: *const c_uchar) -> c_int;
pub fn crypto_onetimeauth_verify(h: *const c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, k: *const c_uchar) -> c_int;
pub fn crypto_onetimeauth_init(state: *mut crypto_onetimeauth_state,
key: *const c_uchar) -> c_int;
pub fn crypto_onetimeauth_update(state: *mut crypto_onetimeauth_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_onetimeauth_final(state: *mut crypto_onetimeauth_state,
out: *mut c_uchar) -> c_int;
pub fn crypto_onetimeauth_poly1305_bytes() -> size_t;
pub fn crypto_onetimeauth_poly1305_keybytes() -> size_t;
pub fn crypto_onetimeauth_poly1305_implementation_name() -> *const c_char;
pub fn crypto_onetimeauth_poly1305_set_implementation(impl_: *mut crypto_onetimeauth_poly1305_implementation)
-> c_int;
pub fn crypto_onetimeauth_pick_best_implementation() -> *mut crypto_onetimeauth_poly1305_implementation;
pub fn crypto_onetimeauth_poly1305(out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int;
pub fn crypto_onetimeauth_poly1305_verify(h: *const c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int;
pub fn crypto_onetimeauth_poly1305_init(state: *mut crypto_onetimeauth_poly1305_state,
key: *const c_uchar) -> c_int;
pub fn crypto_onetimeauth_poly1305_update(state: *mut crypto_onetimeauth_poly1305_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int;
pub fn crypto_onetimeauth_poly1305_final(state: *mut crypto_onetimeauth_poly1305_state,
out: *mut c_uchar) -> c_int;
pub fn crypto_pwhash_scryptsalsa208sha256_saltbytes() -> size_t;
pub fn crypto_pwhash_scryptsalsa208sha256_strbytes() -> size_t;
pub fn crypto_pwhash_scryptsalsa208sha256_strprefix() -> *const c_char;
pub fn crypto_pwhash_scryptsalsa208sha256_opslimit_interactive() -> size_t;
pub fn crypto_pwhash_scryptsalsa208sha256_memlimit_interactive() -> size_t;
pub fn crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() -> size_t;
pub fn crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() -> size_t;
pub fn crypto_pwhash_scryptsalsa208sha256(out: *mut c_char,
outlen: c_ulonglong,
passwd: *const c_char,
passwdlen: c_ulonglong,
salt: *const c_uchar,
opslimit: c_ulonglong,
memlimit: size_t) -> c_int;
pub fn crypto_pwhash_scryptsalsa208sha256_str(out: *mut c_char,
passwd: *const c_char,
passwdlen: c_ulonglong,
opslimit: c_ulonglong,
memlimit: size_t) -> c_int;
pub fn crypto_pwhash_scryptsalsa208sha256_str_verify(str_: *const c_char,
passwd: *const c_char,
passwdlen: c_ulonglong) -> c_int;
pub fn crypto_pwhash_scryptsalsa208sha256_ll(passwd: *const uint8_t, passwdlen: size_t,
salt: *const uint8_t, saltlen: size_t,
N: uint64_t, r: uint32_t, p: uint32_t,
buf: *mut uint8_t, buflen: size_t) -> c_int;
pub fn crypto_scalarmult_bytes() -> size_t;
pub fn crypto_scalarmult_scalarbytes() -> size_t;
pub fn crypto_scalarmult_primitive() -> *const c_char;
pub fn crypto_scalarmult_base(q: *mut c_uchar, n: *const c_uchar) -> c_int;
pub fn crypto_scalarmult(q: *mut c_uchar, n: *const c_uchar,
p: *const c_uchar) -> c_int;
pub fn crypto_scalarmult_curve25519_bytes() -> size_t;
pub fn crypto_scalarmult_curve25519_scalarbytes() -> size_t;
pub fn crypto_scalarmult_curve25519_primitive() -> *const c_char;
pub fn crypto_scalarmult_curve25519_base(q: *mut c_uchar, n: *const c_uchar) -> c_int;
pub fn crypto_scalarmult_curve25519(q: *mut c_uchar, n: *const c_uchar,
p: *const c_uchar) -> c_int;
pub fn crypto_secretbox_xsalsa20poly1305_keybytes() -> size_t;
pub fn crypto_secretbox_xsalsa20poly1305_noncebytes() -> size_t;
pub fn crypto_secretbox_xsalsa20poly1305_zerobytes() -> size_t;
pub fn crypto_secretbox_xsalsa20poly1305_boxzerobytes() -> size_t;
pub fn crypto_secretbox_xsalsa20poly1305_macbytes() -> size_t;
pub fn crypto_secretbox_xsalsa20poly1305(c: *mut c_uchar,
m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_secretbox_xsalsa20poly1305_open(m: *mut c_uchar,
c: *const c_uchar,
clen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_secretbox_keybytes() -> size_t;
pub fn crypto_secretbox_noncebytes() -> size_t;
pub fn crypto_secretbox_zerobytes() -> size_t;
pub fn crypto_secretbox_boxzerobytes() -> size_t;
pub fn crypto_secretbox_macbytes() -> size_t;
pub fn crypto_secretbox_primitive() -> *const c_char;
pub fn crypto_secretbox_easy(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_secretbox_open_easy(m: *mut c_uchar, c: *const c_uchar,
clen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_secretbox_detached(c: *mut c_uchar, mac: *mut c_uchar,
m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_secretbox_open_detached(m: *mut c_uchar,
c: *const c_uchar,
mac: *const c_uchar,
clen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_secretbox(c: *mut c_uchar,
m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_secretbox_open(m: *mut c_uchar,
c: *const c_uchar,
clen: c_ulonglong,
n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_shorthash_bytes() -> size_t;
pub fn crypto_shorthash_keybytes() -> size_t;
pub fn crypto_shorthash_primitive() -> *const c_char;
pub fn crypto_shorthash(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, k: *const c_uchar) -> c_int;
pub fn crypto_shorthash_siphash24_bytes() -> size_t;
pub fn crypto_shorthash_siphash24_keybytes() -> size_t;
pub fn crypto_shorthash_siphash24(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, k: *const c_uchar) -> c_int;
pub fn crypto_sign_bytes() -> size_t;
pub fn crypto_sign_seedbytes() -> size_t;
pub fn crypto_sign_publickeybytes() -> size_t;
pub fn crypto_sign_secretkeybytes() -> size_t;
pub fn crypto_sign_primitive() -> *const c_char;
pub fn crypto_sign_seed_keypair(pk: *mut c_uchar, sk: *mut c_uchar,
seed: *const c_uchar) -> c_int;
pub fn crypto_sign_keypair(pk: *mut c_uchar, sk: *mut c_uchar) -> c_int;
pub fn crypto_sign(sm: *mut c_uchar, smlen_p: *mut c_ulonglong,
m: *const c_uchar, mlen: c_ulonglong,
sk: *const c_uchar) -> c_int;
pub fn crypto_sign_open(m: *mut c_uchar, mlen_p: *mut c_ulonglong,
sm: *const c_uchar, smlen: c_ulonglong,
pk: *const c_uchar) -> c_int;
pub fn crypto_sign_detached(sig: *mut c_uchar, siglen_p: *mut c_ulonglong,
m: *const c_uchar, mlen: c_ulonglong,
sk: *const c_uchar) -> c_int;
pub fn crypto_sign_verify_detached(sig: *const c_uchar,
m: *const c_uchar,
mlen: c_ulonglong,
pk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_bytes() -> size_t;
pub fn crypto_sign_ed25519_seedbytes() -> size_t;
pub fn crypto_sign_ed25519_publickeybytes() -> size_t;
pub fn crypto_sign_ed25519_secretkeybytes() -> size_t;
pub fn crypto_sign_ed25519_seed_keypair(pk: *mut c_uchar, sk: *mut c_uchar,
seed: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_keypair(pk: *mut c_uchar, sk: *mut c_uchar) -> c_int;
pub fn crypto_sign_ed25519(sm: *mut c_uchar, smlen_p: *mut c_ulonglong,
m: *const c_uchar, mlen: c_ulonglong,
sk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_open(m: *mut c_uchar, mlen_p: *mut c_ulonglong,
sm: *const c_uchar, smlen: c_ulonglong,
pk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_detached(sig: *mut c_uchar, siglen_p: *mut c_ulonglong,
m: *const c_uchar, mlen: c_ulonglong,
sk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_verify_detached(sig: *const c_uchar,
m: *const c_uchar,
mlen: c_ulonglong,
pk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_pk_to_curve25519(curve25519_pk: *mut c_uchar,
ed25519_pk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_sk_to_curve25519(curve25519_sk: *mut c_uchar,
ed25519_sk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_sk_to_seed(seed: *mut c_uchar,
sk: *const c_uchar) -> c_int;
pub fn crypto_sign_ed25519_sk_to_pk(pk: *mut c_uchar, sk: *const c_uchar) -> c_int;
pub fn crypto_sign_edwards25519sha512batch_bytes() -> size_t;
pub fn crypto_sign_edwards25519sha512batch_publickeybytes() -> size_t;
pub fn crypto_sign_edwards25519sha512batch_secretkeybytes() -> size_t;
pub fn crypto_sign_edwards25519sha512batch(sm: *mut c_uchar,
smlen_p: *mut c_ulonglong,
m: *const c_uchar,
mlen: c_ulonglong,
sk: *const c_uchar) -> c_int;
pub fn crypto_sign_edwards25519sha512batch_open(m: *mut c_uchar,
mlen_p: *mut c_ulonglong,
sm: *const c_uchar,
smlen: c_ulonglong,
pk: *const c_uchar) -> c_int;
pub fn crypto_sign_edwards25519sha512batch_keypair(pk: *mut c_uchar,
sk: *mut c_uchar) -> c_int;
pub fn crypto_stream_keybytes() -> size_t;
pub fn crypto_stream_noncebytes() -> size_t;
pub fn crypto_stream_primitive() -> *const c_char;
pub fn crypto_stream(c: *mut c_char, clen: c_ulonglong,
n: *const c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_xor(c: *mut c_char, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_aes128ctr_keybytes() -> size_t;
pub fn crypto_stream_aes128ctr_noncebytes() -> size_t;
pub fn crypto_stream_aes128ctr_beforenmbytes() -> size_t;
pub fn crypto_stream_aes128ctr(out: *mut c_uchar, outlen: c_ulonglong,
n: *const c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_aes128ctr_xor(out: *mut c_uchar, in_: *const c_uchar,
inlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_aes128ctr_beforenm(c: *mut c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_aes128ctr_afternm(out: *mut c_uchar, len: c_ulonglong,
nounce: *const c_uchar, c: *const c_uchar) -> c_int;
pub fn crypto_stream_aes128ctr_xor_afternm(out: *mut c_uchar, in_: *const c_uchar,
len: c_ulonglong, nounce: *const c_uchar,
c: *const c_uchar) -> c_int;
pub fn crypto_stream_chacha20_keybytes() -> size_t;
pub fn crypto_stream_chacha20_noncebytes() -> size_t;
pub fn crypto_stream_chacha20(c: *mut c_char, clen: c_ulonglong,
n: *const c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_chacha20_xor(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_chacha20_xor_ic(c: *mut c_char, m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar, ic: uint64_t,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_chacha20_ietf_xor_ic(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar, ic: u32,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_salsa20_keybytes() -> size_t;
pub fn crypto_stream_salsa20_noncebytes() -> size_t;
pub fn crypto_stream_salsa20(c: *mut c_char, clen: c_ulonglong,
n: *const c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_salsa20_xor(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_salsa20_xor_ic(c: *mut c_char, m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar, ic: uint64_t,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_salsa2012_keybytes() -> size_t;
pub fn crypto_stream_salsa2012_noncebytes() -> size_t;
pub fn crypto_stream_salsa2012(c: *mut c_char, clen: c_ulonglong,
n: *const c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_salsa2012_xor(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_salsa208_keybytes() -> size_t;
pub fn crypto_stream_salsa208_noncebytes() -> size_t;
pub fn crypto_stream_salsa208(c: *mut c_char, clen: c_ulonglong,
n: *const c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_salsa208_xor(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_xsalsa20_keybytes() -> size_t;
pub fn crypto_stream_xsalsa20_noncebytes() -> size_t;
pub fn crypto_stream_xsalsa20(c: *mut c_char, clen: c_ulonglong,
n: *const c_uchar, k: *const c_uchar) -> c_int;
pub fn crypto_stream_xsalsa20_xor(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong, n: *const c_uchar,
k: *const c_uchar) -> c_int;
pub fn crypto_stream_xsalsa20_xor_ic(c: *mut c_uchar, m: *const c_uchar,
mlen: c_ulonglong,
n: *const c_uchar, ic: uint64_t,
k: *const c_uchar) -> c_int;
pub fn crypto_verify_16_bytes() -> size_t;
pub fn crypto_verify_16(x: *const c_uchar, y: *const c_uchar) -> c_int;
pub fn crypto_verify_32_bytes() -> size_t;
pub fn crypto_verify_32(x: *const c_uchar, y: *const c_uchar) -> c_int;
pub fn crypto_verify_64_bytes() -> size_t;
pub fn crypto_verify_64(x: *const c_uchar, y: *const c_uchar) -> c_int;
pub fn randombytes_buf(buf: *mut c_void, size: size_t);
pub fn randombytes_random() -> uint32_t;
pub fn randombytes_uniform(upper_bound: uint32_t) -> uint32_t;
pub fn randombytes_stir();
pub fn randombytes_close() -> c_int;
pub fn randombytes_set_implementation(impl_: *mut randombytes_implementation) -> c_int;
pub fn randombytes_implementation_name() -> *const c_char;
pub fn randombytes(buf: *mut c_void, buf_len: c_ulonglong);
pub fn randombytes_salsa20_implementation_name() -> *const c_char;
pub fn randombytes_salsa20_random() -> uint32_t;
pub fn randombytes_salsa20_random_stir();
pub fn randombytes_salsa20_random_uniform(upper_bound: uint32_t) -> uint32_t;
pub fn randombytes_salsa20_random_buf(buf: *mut c_void, size: size_t);
pub fn randombytes_salsa20_random_close() -> c_int;
pub static randombytes_salsa20_implementation: randombytes_implementation;
pub fn randombytes_sysrandom_implementation_name() -> *const c_char;
pub fn randombytes_sysrandom() -> uint32_t;
pub fn randombytes_sysrandom_stir();
pub fn randombytes_sysrandom_uniform(upper_bound: uint32_t) -> uint32_t;
pub fn randombytes_sysrandom_buf(buf: *mut c_void, size: size_t);
pub fn randombytes_sysrandom_close() -> c_int;
pub static randombytes_sysrandom_implementation: randombytes_implementation;
pub fn sodium_version_string() -> *const c_char;
pub fn sodium_library_version_major() -> c_int;
pub fn sodium_library_version_minor() -> c_int;
}
#[repr(C)]
#[derive(Copy)]
pub struct crypto_hash_sha256_state {
pub state: [uint32_t; 8],
pub count: [uint32_t; 2],
pub buf: [c_uchar; 64],
}
impl Clone for crypto_hash_sha256_state {
fn clone(&self) -> crypto_hash_sha256_state {
unsafe {
let mut x: crypto_hash_sha256_state = mem::uninitialized();
ptr::copy::<crypto_hash_sha256_state>(mem::transmute(self),
mem::transmute(&mut x),
mem::size_of::<crypto_hash_sha256_state>());
x
}
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct crypto_auth_hmacsha256_state {
pub ictx: crypto_hash_sha256_state,
pub octx: crypto_hash_sha256_state,
}
#[repr(C)]
#[derive(Copy)]
pub struct crypto_hash_sha512_state {
pub state: [uint64_t; 8],
pub count: [uint64_t; 2],
pub buf: [c_uchar; 128],
}
impl Clone for crypto_hash_sha512_state {
fn clone(&self) -> crypto_hash_sha512_state {
unsafe {
let mut x: crypto_hash_sha512_state = mem::uninitialized();
ptr::copy::<crypto_hash_sha512_state>(mem::transmute(self),
mem::transmute(&mut x),
mem::size_of::<crypto_hash_sha512_state>());
x
}
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct crypto_auth_hmacsha512_state {
pub ictx: crypto_hash_sha512_state,
pub octx: crypto_hash_sha512_state,
}
pub type crypto_auth_hmacsha512256_state = crypto_auth_hmacsha512_state;
#[repr(C)]
#[repr(packed)]
#[derive(Copy)]
pub struct crypto_generichash_blake2b_state {
pub h: [uint64_t; 8],
pub t: [uint64_t; 2],
pub f: [uint64_t; 2],
pub buf: [uint8_t; 2 * 128],
pub buflen: size_t,
pub last_node: uint8_t,
}
impl Clone for crypto_generichash_blake2b_state {
fn clone(&self) -> crypto_generichash_blake2b_state {
unsafe {
let mut x: crypto_generichash_blake2b_state = mem::uninitialized();
ptr::copy::<crypto_generichash_blake2b_state>(mem::transmute(self),
mem::transmute(&mut x),
mem::size_of::<crypto_generichash_blake2b_state>());
x
}
}
}
pub type crypto_generichash_state = crypto_generichash_blake2b_state;
pub type crypto_int32 = int32_t;
pub type crypto_int64 = int64_t;
pub type crypto_uint16 = uint16_t;
pub type crypto_uint32 = uint32_t;
pub type crypto_uint64 = uint64_t;
pub type crypto_uint8 = uint8_t;
#[repr(C)]
#[derive(Copy)]
pub struct crypto_onetimeauth_poly1305_state {
pub aligner: c_ulonglong,
pub opaque: [c_uchar; 136],
}
impl Clone for crypto_onetimeauth_poly1305_state {
fn clone(&self) -> crypto_onetimeauth_poly1305_state {
unsafe {
let mut x: crypto_onetimeauth_poly1305_state = mem::uninitialized();
ptr::copy::<crypto_onetimeauth_poly1305_state>(mem::transmute(self),
mem::transmute(&mut x),
mem::size_of::<crypto_onetimeauth_poly1305_state>());
x
}
}
}
pub type crypto_onetimeauth_state = crypto_onetimeauth_poly1305_state;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct crypto_onetimeauth_poly1305_implementation {
pub implementation_name: extern fn() -> *const c_char,
pub onetimeauth: extern fn(out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int,
pub onetimeauth_verify: extern fn(h: *const c_uchar,
in_: *const c_uchar,
inlen: c_ulonglong,
k: *const c_uchar) -> c_int,
pub onetimeauth_init: extern fn(state: *mut crypto_onetimeauth_poly1305_state,
key: *const c_uchar) -> c_int,
pub onetimeauth_update: extern fn(state: *mut crypto_onetimeauth_poly1305_state,
in_: *const c_uchar,
inlen: c_ulonglong) -> c_int,
pub onetimeauth_final: extern fn(state: *mut crypto_onetimeauth_poly1305_state,
out: *mut c_uchar) -> c_int,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct randombytes_implementation {
pub implementation_name: extern fn() -> *const c_char,
pub random: extern fn() -> uint32_t,
pub stir: extern fn(),
pub uniform: extern fn(upper_bound: uint32_t) -> uint32_t,
pub buf: extern fn(buf: *mut c_void, size: size_t),
pub close: extern fn() -> c_int,
}
#[test]
fn test_it_work() {
unsafe {
sodium_init();
}
}