Botan 3.6.1
Crypto and TLS for C&
sodium.h
Go to the documentation of this file.
1/*
2* (C) 2019 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_SODIUM_COMPAT_H_
8#define BOTAN_SODIUM_COMPAT_H_
9
10#include <botan/types.h>
11
12/**
13* The Botan::Sodium namespace contains a partial implementation of the
14* libsodium API.
15*/
16namespace Botan::Sodium {
17
18// sodium/randombytes.h
19enum Sodium_Constants : size_t {
20 SODIUM_SIZE_MAX = 0xFFFFFFFF,
21
27
33
39
46
49
60
70
75
80
84
89
94
102
109
114
125
144
148
150};
151
152inline const char* sodium_version_string() {
153 return "Botan Sodium Compat";
154}
155
157 return 0;
158}
159
161 return 0;
162}
163
165 return 0;
166}
167
168inline int sodium_init() {
169 return 0;
170}
171
172// sodium/crypto_verify_{16,32,64}.h
173
174BOTAN_PUBLIC_API(2, 11)
175int crypto_verify_16(const uint8_t x[16], const uint8_t y[16]);
176
177BOTAN_PUBLIC_API(2, 11)
178int crypto_verify_32(const uint8_t x[32], const uint8_t y[32]);
179
180BOTAN_PUBLIC_API(2, 11)
181int crypto_verify_64(const uint8_t x[64], const uint8_t y[64]);
182
183// sodium/utils.h
184BOTAN_PUBLIC_API(2, 11)
185void sodium_memzero(void* ptr, size_t len);
186
187BOTAN_PUBLIC_API(2, 11)
188int sodium_memcmp(const void* x, const void* y, size_t len);
189
190BOTAN_PUBLIC_API(2, 11)
191int sodium_compare(const uint8_t x[], const uint8_t y[], size_t len);
192
193BOTAN_PUBLIC_API(2, 11)
194int sodium_is_zero(const uint8_t nonce[], size_t nlen);
195
196BOTAN_PUBLIC_API(2, 11)
197void sodium_increment(uint8_t n[], size_t nlen);
198
199BOTAN_PUBLIC_API(2, 11)
200void sodium_add(uint8_t a[], const uint8_t b[], size_t len);
201
202BOTAN_PUBLIC_API(2, 11)
203void* sodium_malloc(size_t size);
204
205BOTAN_PUBLIC_API(2, 11)
206void* sodium_allocarray(size_t count, size_t size);
207
208BOTAN_PUBLIC_API(2, 11)
209void sodium_free(void* ptr);
210
211BOTAN_PUBLIC_API(2, 11)
212int sodium_mprotect_noaccess(void* ptr);
213
214BOTAN_PUBLIC_API(2, 11)
215int sodium_mprotect_readwrite(void* ptr);
216
217// sodium/randombytes.h
218
219inline size_t randombytes_seedbytes() {
221}
222
223BOTAN_PUBLIC_API(2, 11)
224void randombytes_buf(void* buf, size_t size);
225
226BOTAN_PUBLIC_API(2, 11)
227void randombytes_buf_deterministic(void* buf, size_t size, const uint8_t seed[randombytes_SEEDBYTES]);
228
229BOTAN_PUBLIC_API(2, 11)
230uint32_t randombytes_uniform(uint32_t upper_bound);
231
232inline uint32_t randombytes_random() {
233 uint32_t x = 0;
234 randombytes_buf(&x, 4);
235 return x;
236}
237
238inline void randombytes_stir() {}
239
240inline int randombytes_close() {
241 return 0;
242}
243
245 return "botan";
246}
247
248inline void randombytes(uint8_t buf[], size_t buf_len) {
249 return randombytes_buf(buf, buf_len);
250}
251
252// sodium/crypto_secretbox_xsalsa20poly1305.h
253
257
261
265
269
270BOTAN_PUBLIC_API(2, 11)
272 uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]);
273
274BOTAN_PUBLIC_API(2, 11)
276 uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]);
277
279 return randombytes_buf(k, 32);
280}
281
285
289
290// sodium/crypto_secretbox.h
291
294}
295
299
302}
303
307
308inline const char* crypto_secretbox_primitive() {
309 return "xsalsa20poly1305";
310}
311
312BOTAN_PUBLIC_API(2, 11)
314 uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]);
315
316BOTAN_PUBLIC_API(2, 11)
317int crypto_secretbox_open_detached(uint8_t ptext[],
318 const uint8_t ctext[],
319 const uint8_t mac[],
320 size_t ctext_len,
321 const uint8_t nonce[],
322 const uint8_t key[]);
323
325 uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]) {
326 return crypto_secretbox_detached(ctext + crypto_secretbox_MACBYTES, ctext, ptext, ptext_len, nonce, key);
327}
328
330 uint8_t out[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]) {
331 if(ctext_len < crypto_secretbox_MACBYTES) {
332 return -1;
333 }
334
336 out, ctext + crypto_secretbox_MACBYTES, ctext, ctext_len - crypto_secretbox_MACBYTES, nonce, key);
337}
338
339inline void crypto_secretbox_keygen(uint8_t k[32]) {
340 return randombytes_buf(k, 32);
341}
342
346
350
352 uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]) {
353 return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
354}
355
357 uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]) {
358 return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
359}
360
361// sodium/crypto_aead_xchacha20poly1305.h
362
366
370
374
378
382
383BOTAN_PUBLIC_API(2, 11)
385 unsigned long long* ctext_len,
386 const uint8_t ptext[],
387 size_t ptext_len,
388 const uint8_t ad[],
389 size_t ad_len,
390 const uint8_t unused_secret_nonce[],
391 const uint8_t nonce[],
392 const uint8_t key[]);
393
394BOTAN_PUBLIC_API(2, 11)
396 unsigned long long* ptext_len,
397 uint8_t unused_secret_nonce[],
398 const uint8_t ctext[],
399 size_t ctext_len,
400 const uint8_t ad[],
401 size_t ad_len,
402 const uint8_t nonce[],
403 const uint8_t key[]);
404
405BOTAN_PUBLIC_API(2, 11)
407 uint8_t mac[],
408 unsigned long long* mac_len,
409 const uint8_t ptext[],
410 size_t ptext_len,
411 const uint8_t ad[],
412 size_t ad_len,
413 const uint8_t unused_secret_nonce[],
414 const uint8_t nonce[],
415 const uint8_t key[]);
416
417BOTAN_PUBLIC_API(2, 11)
419 uint8_t unused_secret_nonce[],
420 const uint8_t ctext[],
421 size_t ctext_len,
422 const uint8_t mac[],
423 const uint8_t ad[],
424 size_t ad_len,
425 const uint8_t nonce[],
426 const uint8_t key[]);
427
431
435
439
443
447
451
452BOTAN_PUBLIC_API(2, 11)
453int crypto_aead_chacha20poly1305_encrypt(uint8_t ctext[],
454 unsigned long long* ctext_len,
455 const uint8_t ptext[],
456 size_t ptext_len,
457 const uint8_t ad[],
458 size_t ad_len,
459 const uint8_t unused_secret_nonce[],
460 const uint8_t nonce[],
461 const uint8_t key[]);
462
463BOTAN_PUBLIC_API(2, 11)
465 unsigned long long* ptext_len,
466 uint8_t unused_secret_nonce[],
467 const uint8_t ctext[],
468 size_t ctext_len,
469 const uint8_t ad[],
470 size_t ad_len,
471 const uint8_t nonce[],
472 const uint8_t key[]);
473
474BOTAN_PUBLIC_API(2, 11)
476 uint8_t mac[],
477 unsigned long long* mac_len,
478 const uint8_t ptext[],
479 size_t ptext_len,
480 const uint8_t ad[],
481 size_t ad_len,
482 const uint8_t unused_secret_nonce[],
483 const uint8_t nonce[],
484 const uint8_t key[]);
485
486BOTAN_PUBLIC_API(2, 11)
488 uint8_t unused_secret_nonce[],
489 const uint8_t ctext[],
490 size_t ctext_len,
491 const uint8_t mac[],
492 const uint8_t ad[],
493 size_t ad_len,
494 const uint8_t nonce[],
495 const uint8_t key[]);
496
497inline void crypto_aead_chacha20poly1305_keygen(uint8_t k[32]) {
498 randombytes_buf(k, 32);
499}
500
501// sodium/crypto_aead_xchacha20poly1305.h
502
506
510
514
518
522
523BOTAN_PUBLIC_API(2, 11)
525 unsigned long long* ctext_len,
526 const uint8_t ptext[],
527 size_t ptext_len,
528 const uint8_t ad[],
529 size_t ad_len,
530 const uint8_t unused_secret_nonce[],
531 const uint8_t nonce[],
532 const uint8_t key[]);
533
534BOTAN_PUBLIC_API(2, 11)
536 unsigned long long* ptext_len,
537 uint8_t unused_secret_nonce[],
538 const uint8_t ctext[],
539 size_t ctext_len,
540 const uint8_t ad[],
541 size_t ad_len,
542 const uint8_t nonce[],
543 const uint8_t key[]);
544
545BOTAN_PUBLIC_API(2, 11)
547 uint8_t mac[],
548 unsigned long long* mac_len,
549 const uint8_t ptext[],
550 size_t ptext_len,
551 const uint8_t ad[],
552 size_t ad_len,
553 const uint8_t unused_secret_nonce[],
554 const uint8_t nonce[],
555 const uint8_t key[]);
556
557BOTAN_PUBLIC_API(2, 11)
559 uint8_t unused_secret_nonce[],
560 const uint8_t ctext[],
561 size_t ctext_len,
562 const uint8_t mac[],
563 const uint8_t ad[],
564 size_t ad_len,
565 const uint8_t nonce[],
566 const uint8_t key[]);
567
569 return randombytes_buf(k, 32);
570}
571
572// sodium/crypto_box_curve25519xsalsa20poly1305.h
573
577
581
585
589
593
597
601
605
609
610BOTAN_PUBLIC_API(2, 11)
611int crypto_box_curve25519xsalsa20poly1305_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[32]);
612
613BOTAN_PUBLIC_API(2, 11)
614int crypto_box_curve25519xsalsa20poly1305_keypair(uint8_t pk[32], uint8_t sk[32]);
615
616BOTAN_PUBLIC_API(2, 11)
617int crypto_box_curve25519xsalsa20poly1305_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32]);
618
619BOTAN_PUBLIC_API(2, 11)
620int crypto_box_curve25519xsalsa20poly1305(uint8_t ctext[],
621 const uint8_t ptext[],
622 size_t ptext_len,
623 const uint8_t nonce[],
624 const uint8_t pk[32],
625 const uint8_t sk[32]);
626
627BOTAN_PUBLIC_API(2, 11)
629 const uint8_t ctext[],
630 size_t ctext_len,
631 const uint8_t nonce[],
632 const uint8_t pk[32],
633 const uint8_t sk[32]);
634
636 uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]) {
637 return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
638}
639
641 uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]) {
642 return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
643}
644
645// sodium/crypto_box.h
646
647inline size_t crypto_box_seedbytes() {
649}
650
653}
654
657}
658
659inline size_t crypto_box_noncebytes() {
661}
662
663inline size_t crypto_box_macbytes() {
664 return crypto_box_MACBYTES;
665}
666
670
673}
674
675inline const char* crypto_box_primitive() {
676 return "curve25519xsalsa20poly1305";
677}
678
679inline int crypto_box_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[]) {
681}
682
683inline int crypto_box_keypair(uint8_t pk[32], uint8_t sk[32]) {
685}
686
687BOTAN_PUBLIC_API(2, 11)
688int crypto_box_detached(uint8_t ctext[],
689 uint8_t mac[],
690 const uint8_t ptext[],
691 size_t ptext_len,
692 const uint8_t nonce[],
693 const uint8_t pk[32],
694 const uint8_t sk[32]);
695
696BOTAN_PUBLIC_API(2, 11)
697int crypto_box_open_detached(uint8_t ptext[],
698 const uint8_t ctext[],
699 const uint8_t mac[],
700 size_t ctext_len,
701 const uint8_t nonce[],
702 const uint8_t pk[32],
703 const uint8_t sk[32]);
704
705inline int crypto_box_easy(uint8_t ctext[],
706 const uint8_t ptext[],
707 size_t ptext_len,
708 const uint8_t nonce[],
709 const uint8_t pk[32],
710 const uint8_t sk[32]) {
711 return crypto_box_detached(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, pk, sk);
712}
713
714inline int crypto_box_open_easy(uint8_t ptext[],
715 const uint8_t ctext[],
716 size_t ctext_len,
717 const uint8_t nonce[],
718 const uint8_t pk[32],
719 const uint8_t sk[32]) {
720 if(ctext_len < crypto_box_MACBYTES) {
721 return -1;
722 }
723
725 ptext, ctext + crypto_box_MACBYTES, ctext, ctext_len - crypto_box_MACBYTES, nonce, pk, sk);
726}
727
728inline int crypto_box_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32]) {
730}
731
733 uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]) {
734 return crypto_box_curve25519xsalsa20poly1305_afternm(ctext, ptext, ptext_len, nonce, key);
735}
736
738 uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]) {
739 return crypto_box_curve25519xsalsa20poly1305_open_afternm(ptext, ctext, ctext_len, nonce, key);
740}
741
742inline int crypto_box_open_detached_afternm(uint8_t ptext[],
743 const uint8_t ctext[],
744 const uint8_t mac[],
745 size_t ctext_len,
746 const uint8_t nonce[],
747 const uint8_t key[]) {
748 return crypto_secretbox_open_detached(ptext, ctext, mac, ctext_len, nonce, key);
749}
750
752 uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]) {
753 if(ctext_len < crypto_box_MACBYTES) {
754 return -1;
755 }
756
758 ptext, ctext + crypto_box_MACBYTES, ctext, ctext_len - crypto_box_MACBYTES, nonce, key);
759}
760
761inline int crypto_box_detached_afternm(uint8_t ctext[],
762 uint8_t mac[],
763 const uint8_t ptext[],
764 size_t ptext_len,
765 const uint8_t nonce[],
766 const uint8_t key[]) {
767 return crypto_secretbox_detached(ctext, mac, ptext, ptext_len, nonce, key);
768}
769
771 uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]) {
772 return crypto_box_detached_afternm(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, key);
773}
774
775inline size_t crypto_box_zerobytes() {
777}
778
779inline size_t crypto_box_boxzerobytes() {
781}
782
783inline int crypto_box(uint8_t ctext[],
784 const uint8_t ptext[],
785 size_t ptext_len,
786 const uint8_t nonce[],
787 const uint8_t pk[32],
788 const uint8_t sk[32]) {
789 return crypto_box_curve25519xsalsa20poly1305(ctext, ptext, ptext_len, nonce, pk, sk);
790}
791
792inline int crypto_box_open(uint8_t ptext[],
793 const uint8_t ctext[],
794 size_t ctext_len,
795 const uint8_t nonce[],
796 const uint8_t pk[32],
797 const uint8_t sk[32]) {
798 return crypto_box_curve25519xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, pk, sk);
799}
800
801// sodium/crypto_hash_sha512.h
802
805}
806
807BOTAN_PUBLIC_API(2, 11)
808int crypto_hash_sha512(uint8_t out[64], const uint8_t in[], size_t in_len);
809
810// sodium/crypto_auth_hmacsha512.h
811
815
819
820BOTAN_PUBLIC_API(2, 11)
821int crypto_auth_hmacsha512(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[]);
822
823BOTAN_PUBLIC_API(2, 11)
824int crypto_auth_hmacsha512_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[]);
825
826inline void crypto_auth_hmacsha512_keygen(uint8_t k[32]) {
827 return randombytes_buf(k, 32);
828}
829
830// sodium/crypto_auth_hmacsha512256.h
831
835
839
840BOTAN_PUBLIC_API(2, 11)
841int crypto_auth_hmacsha512256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[]);
842
843BOTAN_PUBLIC_API(2, 11)
844int crypto_auth_hmacsha512256_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[]);
845
846inline void crypto_auth_hmacsha512256_keygen(uint8_t k[32]) {
847 return randombytes_buf(k, 32);
848}
849
850// sodium/crypto_auth.h
851
852inline size_t crypto_auth_bytes() {
853 return crypto_auth_BYTES;
854}
855
856inline size_t crypto_auth_keybytes() {
858}
859
860inline const char* crypto_auth_primitive() {
861 return "hmacsha512256";
862}
863
864inline int crypto_auth(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[]) {
865 return crypto_auth_hmacsha512256(out, in, in_len, key);
866}
867
868inline int crypto_auth_verify(const uint8_t mac[], const uint8_t in[], size_t in_len, const uint8_t key[]) {
869 return crypto_auth_hmacsha512256_verify(mac, in, in_len, key);
870}
871
872inline void crypto_auth_keygen(uint8_t k[]) {
874}
875
876// sodium/crypto_hash_sha256.h
877
880}
881
882BOTAN_PUBLIC_API(2, 11)
883int crypto_hash_sha256(uint8_t out[], const uint8_t in[], size_t in_len);
884
885// sodium/crypto_auth_hmacsha256.h
886
890
894
895BOTAN_PUBLIC_API(2, 11)
896int crypto_auth_hmacsha256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[]);
897
898BOTAN_PUBLIC_API(2, 11)
899int crypto_auth_hmacsha256_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[]);
900
901inline void crypto_auth_hmacsha256_keygen(uint8_t k[32]) {
902 return randombytes_buf(k, 32);
903}
904
905// sodium/crypto_stream_xsalsa20.h
906
910
914
918
919BOTAN_PUBLIC_API(2, 11)
920int crypto_stream_xsalsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]);
921
922BOTAN_PUBLIC_API(2, 11)
924 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]);
925
926BOTAN_PUBLIC_API(2, 11)
928 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[]);
929
930inline void crypto_stream_xsalsa20_keygen(uint8_t k[32]) {
931 return randombytes_buf(k, 32);
932}
933
934// sodium/crypto_core_hsalsa20.h
935
939
943
947
951
952BOTAN_PUBLIC_API(2, 11)
953int crypto_core_hsalsa20(uint8_t out[], const uint8_t in[], const uint8_t key[], const uint8_t c[]);
954
955// sodium/crypto_hash.h
956
957inline size_t crypto_hash_bytes() {
958 return crypto_hash_BYTES;
959}
960
961inline int crypto_hash(uint8_t out[], const uint8_t in[], size_t in_len) {
962 return crypto_hash_sha512(out, in, in_len);
963}
964
965inline const char* crypto_hash_primitive() {
966 return "sha512";
967}
968
969// sodium/crypto_onetimeauth_poly1305.h
970
974
978
979BOTAN_PUBLIC_API(2, 11)
980int crypto_onetimeauth_poly1305(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[]);
981
982BOTAN_PUBLIC_API(2, 11)
983int crypto_onetimeauth_poly1305_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[]);
984
985inline void crypto_onetimeauth_poly1305_keygen(uint8_t k[32]) {
986 return randombytes_buf(k, 32);
987}
988
989// sodium/crypto_onetimeauth.h
990
993}
994
998
999inline const char* crypto_onetimeauth_primitive() {
1000 return "poly1305";
1001}
1002
1003inline int crypto_onetimeauth(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[]) {
1004 return crypto_onetimeauth_poly1305(out, in, in_len, key);
1005}
1006
1007inline int crypto_onetimeauth_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[]) {
1008 return crypto_onetimeauth_poly1305_verify(h, in, in_len, key);
1009}
1010
1011inline void crypto_onetimeauth_keygen(uint8_t k[32]) {
1013}
1014
1015// sodium/crypto_scalarmult_curve25519.h
1016
1020
1024
1025BOTAN_PUBLIC_API(2, 11)
1026int crypto_scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32]);
1027
1028BOTAN_PUBLIC_API(2, 11)
1029int crypto_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32]);
1030
1031// sodium/crypto_scalarmult.h
1032
1036
1040
1041inline const char* crypto_scalarmult_primitive() {
1042 return "curve25519";
1043}
1044
1045inline int crypto_scalarmult_base(uint8_t out[], const uint8_t scalar[]) {
1046 return crypto_scalarmult_curve25519_base(out, scalar);
1047}
1048
1049inline int crypto_scalarmult(uint8_t out[], const uint8_t scalar[], const uint8_t base[]) {
1050 return crypto_scalarmult_curve25519(out, scalar, base);
1051}
1052
1053// sodium/crypto_stream_chacha20.h
1054
1058
1062
1066
1067BOTAN_PUBLIC_API(2, 11)
1068int crypto_stream_chacha20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]);
1069
1070BOTAN_PUBLIC_API(2, 11)
1072 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]);
1073
1074BOTAN_PUBLIC_API(2, 11)
1076 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[]);
1077
1078inline void crypto_stream_chacha20_keygen(uint8_t k[32]) {
1079 return randombytes_buf(k, 32);
1080}
1081
1085
1089
1093
1094BOTAN_PUBLIC_API(2, 11)
1095int crypto_stream_chacha20_ietf(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]);
1096
1097BOTAN_PUBLIC_API(2, 11)
1099 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]);
1100
1101BOTAN_PUBLIC_API(2, 11)
1103 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint32_t ic, const uint8_t key[]);
1104
1105inline void crypto_stream_chacha20_ietf_keygen(uint8_t k[32]) {
1106 return randombytes_buf(k, 32);
1107}
1108
1109// sodium/crypto_stream_xchacha20.h
1110
1114
1118
1122
1123BOTAN_PUBLIC_API(2, 11)
1124int crypto_stream_xchacha20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]);
1125
1126BOTAN_PUBLIC_API(2, 11)
1128 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]);
1129
1130BOTAN_PUBLIC_API(2, 11)
1132 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[]);
1133
1134inline void crypto_stream_xchacha20_keygen(uint8_t k[32]) {
1136}
1137
1138// sodium/crypto_stream_salsa20.h
1139
1143
1147
1151
1152BOTAN_PUBLIC_API(2, 11)
1153int crypto_stream_salsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[]);
1154
1155BOTAN_PUBLIC_API(2, 11)
1157 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[]);
1158
1159BOTAN_PUBLIC_API(2, 11)
1161 uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[]);
1162
1163inline void crypto_stream_salsa20_keygen(uint8_t k[32]) {
1164 return randombytes_buf(k, 32);
1165}
1166
1167// sodium/crypto_stream.h
1168
1169inline size_t crypto_stream_keybytes() {
1171}
1172
1176
1180
1181inline const char* crypto_stream_primitive() {
1182 return "xsalsa20";
1183}
1184
1185inline int crypto_stream(uint8_t out[], size_t out_len, const uint8_t nonce[24], const uint8_t key[32]) {
1186 return crypto_stream_xsalsa20(out, out_len, nonce, key);
1187}
1188
1190 uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t nonce[24], const uint8_t key[32]) {
1191 return crypto_stream_xsalsa20_xor(out, in, in_len, nonce, key);
1192}
1193
1194inline void crypto_stream_keygen(uint8_t key[32]) {
1195 return randombytes_buf(key, 32);
1196}
1197
1198// sodium/crypto_shorthash_siphash24.h
1199
1203
1207
1208BOTAN_PUBLIC_API(2, 11)
1209int crypto_shorthash_siphash24(uint8_t out[8], const uint8_t in[], size_t in_len, const uint8_t key[16]);
1210
1211// sodium/crypto_shorthash.h
1212
1213inline size_t crypto_shorthash_bytes() {
1215}
1216
1220
1221inline const char* crypto_shorthash_primitive() {
1222 return "siphash24";
1223}
1224
1225inline int crypto_shorthash(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t k[16]) {
1226 return crypto_shorthash_siphash24(out, in, in_len, k);
1227}
1228
1232
1233// sodium/crypto_sign_ed25519.h
1234
1237}
1238
1242
1246
1250
1254
1255BOTAN_PUBLIC_API(2, 11)
1257 uint8_t sig[], unsigned long long* sig_len, const uint8_t msg[], size_t msg_len, const uint8_t sk[32]);
1258
1259BOTAN_PUBLIC_API(2, 11)
1260int crypto_sign_ed25519_verify_detached(const uint8_t sig[], const uint8_t msg[], size_t msg_len, const uint8_t pk[32]);
1261
1262BOTAN_PUBLIC_API(2, 11)
1263int crypto_sign_ed25519_keypair(uint8_t pk[32], uint8_t sk[64]);
1264
1265BOTAN_PUBLIC_API(2, 11)
1266int crypto_sign_ed25519_seed_keypair(uint8_t pk[], uint8_t sk[], const uint8_t seed[]);
1267
1268// sodium/crypto_sign.h
1269
1270inline size_t crypto_sign_bytes() {
1271 return crypto_sign_BYTES;
1272}
1273
1274inline size_t crypto_sign_seedbytes() {
1275 return crypto_sign_SEEDBYTES;
1276}
1277
1280}
1281
1284}
1285
1289
1290inline const char* crypto_sign_primitive() {
1291 return "ed25519";
1292}
1293
1294inline int crypto_sign_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[]) {
1295 return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
1296}
1297
1298inline int crypto_sign_keypair(uint8_t pk[32], uint8_t sk[32]) {
1299 return crypto_sign_ed25519_keypair(pk, sk);
1300}
1301
1303 uint8_t sig[], unsigned long long* sig_len, const uint8_t msg[], size_t msg_len, const uint8_t sk[32]) {
1304 return crypto_sign_ed25519_detached(sig, sig_len, msg, msg_len, sk);
1305}
1306
1307inline int crypto_sign_verify_detached(const uint8_t sig[], const uint8_t in[], size_t in_len, const uint8_t pk[32]) {
1308 return crypto_sign_ed25519_verify_detached(sig, in, in_len, pk);
1309}
1310
1311} // namespace Botan::Sodium
1312
1313#endif
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes()
Definition sodium.h:582
size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max()
Definition sodium.h:266
const char * crypto_shorthash_primitive()
Definition sodium.h:1221
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[32])
void crypto_onetimeauth_poly1305_keygen(uint8_t k[32])
Definition sodium.h:985
size_t crypto_secretbox_xsalsa20poly1305_zerobytes()
Definition sodium.h:286
size_t crypto_sign_messagebytes_max()
Definition sodium.h:1286
size_t crypto_core_hsalsa20_outputbytes()
Definition sodium.h:936
size_t crypto_stream_xchacha20_keybytes()
Definition sodium.h:1111
size_t crypto_onetimeauth_poly1305_keybytes()
Definition sodium.h:975
size_t crypto_shorthash_bytes()
Definition sodium.h:1213
size_t crypto_scalarmult_scalarbytes()
Definition sodium.h:1037
int crypto_aead_xchacha20poly1305_ietf_decrypt(uint8_t ptext[], unsigned long long *ptext_len, uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
void crypto_secretbox_xsalsa20poly1305_keygen(uint8_t k[32])
Definition sodium.h:278
size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes()
Definition sodium.h:586
size_t crypto_sign_bytes()
Definition sodium.h:1270
int crypto_stream_xchacha20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_stream_salsa20_keybytes()
Definition sodium.h:1140
int crypto_secretbox(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:351
size_t crypto_onetimeauth_bytes()
Definition sodium.h:991
void crypto_auth_hmacsha256_keygen(uint8_t k[32])
Definition sodium.h:901
size_t crypto_aead_xchacha20poly1305_ietf_keybytes()
Definition sodium.h:503
size_t crypto_stream_chacha20_noncebytes()
Definition sodium.h:1059
const char * crypto_auth_primitive()
Definition sodium.h:860
const char * crypto_secretbox_primitive()
Definition sodium.h:308
size_t crypto_aead_chacha20poly1305_ietf_nsecbytes()
Definition sodium.h:367
int crypto_box_curve25519xsalsa20poly1305_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
int crypto_box_curve25519xsalsa20poly1305_open_afternm(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:640
int crypto_box_curve25519xsalsa20poly1305_keypair(uint8_t pk[32], uint8_t sk[32])
size_t crypto_sign_seedbytes()
Definition sodium.h:1274
const char * randombytes_implementation_name()
Definition sodium.h:244
int crypto_box_open_detached(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int crypto_secretbox_open_easy(uint8_t out[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:329
int crypto_hash_sha256(uint8_t out[], const uint8_t in[], size_t in_len)
uint32_t randombytes_random()
Definition sodium.h:232
int crypto_stream_chacha20_ietf_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_stream_chacha20_keybytes()
Definition sodium.h:1055
int crypto_auth_verify(const uint8_t mac[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition sodium.h:868
int crypto_verify_32(const uint8_t x[32], const uint8_t y[32])
int crypto_box_curve25519xsalsa20poly1305_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
size_t crypto_scalarmult_curve25519_scalarbytes()
Definition sodium.h:1021
int crypto_box_open_detached_afternm(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:742
int crypto_auth_hmacsha512(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
int crypto_box_easy(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition sodium.h:705
int crypto_stream_salsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int crypto_aead_chacha20poly1305_decrypt(uint8_t m[], unsigned long long *ptext_len, uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int crypto_verify_16(const uint8_t x[16], const uint8_t y[16])
size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max()
Definition sodium.h:519
const char * crypto_scalarmult_primitive()
Definition sodium.h:1041
void crypto_aead_chacha20poly1305_ietf_keygen(uint8_t k[32])
Definition sodium.h:428
const char * crypto_sign_primitive()
Definition sodium.h:1290
size_t crypto_box_macbytes()
Definition sodium.h:663
int crypto_box_open_easy_afternm(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:751
size_t crypto_core_hsalsa20_keybytes()
Definition sodium.h:944
int crypto_box_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition sodium.h:792
int crypto_aead_chacha20poly1305_decrypt_detached(uint8_t m[], uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t mac[], const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_stream_xsalsa20_noncebytes()
Definition sodium.h:911
int crypto_aead_chacha20poly1305_ietf_encrypt_detached(uint8_t ctext[], uint8_t mac[], unsigned long long *mac_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
size_t crypto_auth_hmacsha256_bytes()
Definition sodium.h:887
void * sodium_allocarray(size_t count, size_t size)
size_t crypto_aead_chacha20poly1305_ietf_npubbytes()
Definition sodium.h:371
size_t crypto_stream_chacha20_ietf_messagebytes_max()
Definition sodium.h:1090
size_t randombytes_seedbytes()
Definition sodium.h:219
size_t crypto_onetimeauth_poly1305_bytes()
Definition sodium.h:971
int crypto_stream_xsalsa20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
int crypto_box_detached(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int sodium_memcmp(const void *x, const void *y, size_t len)
size_t crypto_box_boxzerobytes()
Definition sodium.h:779
void randombytes_stir()
Definition sodium.h:238
size_t crypto_stream_xchacha20_messagebytes_max()
Definition sodium.h:1119
size_t crypto_sign_ed25519_publickeybytes()
Definition sodium.h:1243
int crypto_shorthash_siphash24(uint8_t out[8], const uint8_t in[], size_t in_len, const uint8_t key[16])
int crypto_sign_ed25519_verify_detached(const uint8_t sig[], const uint8_t msg[], size_t msg_len, const uint8_t pk[32])
@ crypto_stream_salsa20_NONCEBYTES
Definition sodium.h:134
@ crypto_stream_MESSAGEBYTES_MAX
Definition sodium.h:142
@ crypto_aead_chacha20poly1305_ietf_NSECBYTES
Definition sodium.h:32
@ crypto_shorthash_KEYBYTES
Definition sodium.h:113
@ crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
Definition sodium.h:55
@ crypto_scalarmult_SCALARBYTES
Definition sodium.h:93
@ crypto_box_MESSAGEBYTES_MAX
Definition sodium.h:64
@ crypto_box_NONCEBYTES
Definition sodium.h:65
@ crypto_aead_chacha20poly1305_NPUBBYTES
Definition sodium.h:25
@ crypto_sign_ed25519_SECRETKEYBYTES
Definition sodium.h:118
@ crypto_sign_MESSAGEBYTES_MAX
Definition sodium.h:121
@ crypto_scalarmult_curve25519_SCALARBYTES
Definition sodium.h:91
@ crypto_auth_hmacsha256_KEYBYTES
Definition sodium.h:41
@ crypto_auth_BYTES
Definition sodium.h:47
@ crypto_auth_hmacsha256_BYTES
Definition sodium.h:40
@ crypto_aead_xchacha20poly1305_ietf_NSECBYTES
Definition sodium.h:38
@ crypto_sign_BYTES
Definition sodium.h:120
@ crypto_core_hsalsa20_INPUTBYTES
Definition sodium.h:77
@ crypto_onetimeauth_BYTES
Definition sodium.h:87
@ crypto_secretbox_xsalsa20poly1305_NONCEBYTES
Definition sodium.h:99
@ crypto_aead_chacha20poly1305_ietf_ABYTES
Definition sodium.h:28
@ crypto_aead_chacha20poly1305_NSECBYTES
Definition sodium.h:26
@ crypto_verify_16_BYTES
Definition sodium.h:145
@ crypto_shorthash_siphash24_KEYBYTES
Definition sodium.h:111
@ crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
Definition sodium.h:51
@ crypto_sign_PUBLICKEYBYTES
Definition sodium.h:122
@ crypto_shorthash_BYTES
Definition sodium.h:112
@ crypto_stream_xsalsa20_MESSAGEBYTES_MAX
Definition sodium.h:139
@ crypto_stream_chacha20_ietf_KEYBYTES
Definition sodium.h:129
@ crypto_secretbox_KEYBYTES
Definition sodium.h:104
@ crypto_hash_BYTES
Definition sodium.h:83
@ crypto_aead_chacha20poly1305_ietf_NPUBBYTES
Definition sodium.h:31
@ crypto_secretbox_ZEROBYTES
Definition sodium.h:108
@ crypto_sign_ed25519_PUBLICKEYBYTES
Definition sodium.h:117
@ crypto_box_ZEROBYTES
Definition sodium.h:69
@ crypto_secretbox_xsalsa20poly1305_ZEROBYTES
Definition sodium.h:100
@ crypto_stream_xchacha20_MESSAGEBYTES_MAX
Definition sodium.h:136
@ crypto_onetimeauth_poly1305_KEYBYTES
Definition sodium.h:86
@ crypto_auth_KEYBYTES
Definition sodium.h:48
@ crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
Definition sodium.h:54
@ crypto_core_hchacha20_OUTPUTBYTES
Definition sodium.h:74
@ crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
Definition sodium.h:56
@ crypto_stream_xsalsa20_KEYBYTES
Definition sodium.h:138
@ crypto_core_hchacha20_CONSTBYTES
Definition sodium.h:71
@ crypto_stream_chacha20_ietf_NONCEBYTES
Definition sodium.h:131
@ crypto_aead_chacha20poly1305_KEYBYTES
Definition sodium.h:23
@ crypto_sign_ed25519_BYTES
Definition sodium.h:115
@ crypto_stream_salsa20_MESSAGEBYTES_MAX
Definition sodium.h:133
@ crypto_stream_xchacha20_KEYBYTES
Definition sodium.h:135
@ crypto_secretbox_xsalsa20poly1305_KEYBYTES
Definition sodium.h:96
@ crypto_aead_xchacha20poly1305_ietf_KEYBYTES
Definition sodium.h:35
@ crypto_sign_ed25519_MESSAGEBYTES_MAX
Definition sodium.h:116
@ crypto_verify_64_BYTES
Definition sodium.h:147
@ crypto_secretbox_MACBYTES
Definition sodium.h:105
@ crypto_stream_chacha20_MESSAGEBYTES_MAX
Definition sodium.h:127
@ crypto_core_hsalsa20_CONSTBYTES
Definition sodium.h:76
@ crypto_aead_chacha20poly1305_ietf_KEYBYTES
Definition sodium.h:29
@ crypto_stream_NONCEBYTES
Definition sodium.h:143
@ crypto_auth_hmacsha512_BYTES
Definition sodium.h:44
@ crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX
Definition sodium.h:130
@ crypto_box_curve25519xsalsa20poly1305_MACBYTES
Definition sodium.h:52
@ crypto_stream_xchacha20_NONCEBYTES
Definition sodium.h:137
@ crypto_scalarmult_curve25519_BYTES
Definition sodium.h:90
@ crypto_aead_chacha20poly1305_ABYTES
Definition sodium.h:22
@ crypto_sign_SECRETKEYBYTES
Definition sodium.h:123
@ crypto_box_BEFORENMBYTES
Definition sodium.h:61
@ crypto_box_BOXZEROBYTES
Definition sodium.h:62
@ crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
Definition sodium.h:30
@ crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
Definition sodium.h:58
@ randombytes_SEEDBYTES
Definition sodium.h:149
@ crypto_sign_ed25519_SEEDBYTES
Definition sodium.h:119
@ crypto_stream_chacha20_NONCEBYTES
Definition sodium.h:128
@ crypto_stream_chacha20_KEYBYTES
Definition sodium.h:126
@ crypto_stream_KEYBYTES
Definition sodium.h:141
@ crypto_box_PUBLICKEYBYTES
Definition sodium.h:66
@ crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
Definition sodium.h:53
@ crypto_scalarmult_BYTES
Definition sodium.h:92
@ crypto_secretbox_NONCEBYTES
Definition sodium.h:107
@ crypto_core_hsalsa20_OUTPUTBYTES
Definition sodium.h:79
@ crypto_box_MACBYTES
Definition sodium.h:63
@ crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
Definition sodium.h:95
@ crypto_hash_sha512_BYTES
Definition sodium.h:82
@ crypto_onetimeauth_poly1305_BYTES
Definition sodium.h:85
@ crypto_box_SEEDBYTES
Definition sodium.h:68
@ crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX
Definition sodium.h:24
@ crypto_verify_32_BYTES
Definition sodium.h:146
@ crypto_box_SECRETKEYBYTES
Definition sodium.h:67
@ crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
Definition sodium.h:98
@ crypto_auth_hmacsha512256_KEYBYTES
Definition sodium.h:43
@ crypto_sign_SEEDBYTES
Definition sodium.h:124
@ crypto_aead_xchacha20poly1305_ietf_ABYTES
Definition sodium.h:34
@ crypto_auth_hmacsha512_KEYBYTES
Definition sodium.h:45
@ crypto_core_hchacha20_KEYBYTES
Definition sodium.h:73
@ crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
Definition sodium.h:37
@ crypto_onetimeauth_KEYBYTES
Definition sodium.h:88
@ crypto_auth_hmacsha512256_BYTES
Definition sodium.h:42
@ crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
Definition sodium.h:50
@ crypto_stream_xsalsa20_NONCEBYTES
Definition sodium.h:140
@ crypto_core_hsalsa20_KEYBYTES
Definition sodium.h:78
@ crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
Definition sodium.h:36
@ crypto_secretbox_xsalsa20poly1305_MACBYTES
Definition sodium.h:97
@ crypto_hash_sha256_BYTES
Definition sodium.h:81
@ SODIUM_SIZE_MAX
Definition sodium.h:20
@ crypto_stream_salsa20_KEYBYTES
Definition sodium.h:132
@ crypto_secretbox_BOXZEROBYTES
Definition sodium.h:103
@ crypto_secretbox_MESSAGEBYTES_MAX
Definition sodium.h:106
@ crypto_shorthash_siphash24_BYTES
Definition sodium.h:110
@ crypto_core_hchacha20_INPUTBYTES
Definition sodium.h:72
@ crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
Definition sodium.h:57
size_t crypto_sign_ed25519_messagebytes_max()
Definition sodium.h:1251
int crypto_hash_sha512(uint8_t out[64], const uint8_t in[], size_t in_len)
size_t crypto_box_zerobytes()
Definition sodium.h:775
size_t crypto_stream_noncebytes()
Definition sodium.h:1173
size_t crypto_secretbox_macbytes()
Definition sodium.h:300
size_t crypto_sign_ed25519_seedbytes()
Definition sodium.h:1239
size_t crypto_box_messagebytes_max()
Definition sodium.h:667
size_t crypto_sign_publickeybytes()
Definition sodium.h:1278
size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes()
Definition sodium.h:602
void crypto_stream_chacha20_keygen(uint8_t k[32])
Definition sodium.h:1078
size_t crypto_box_noncebytes()
Definition sodium.h:659
size_t crypto_box_seedbytes()
Definition sodium.h:647
size_t crypto_secretbox_noncebytes()
Definition sodium.h:296
int crypto_onetimeauth_poly1305_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t crypto_stream_xsalsa20_keybytes()
Definition sodium.h:907
int sodium_init()
Definition sodium.h:168
size_t crypto_aead_chacha20poly1305_ietf_keybytes()
Definition sodium.h:363
int crypto_box_open_afternm(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:737
int crypto_stream_xchacha20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
int crypto_verify_64(const uint8_t x[64], const uint8_t y[64])
int crypto_auth_hmacsha512256_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
const char * crypto_hash_primitive()
Definition sodium.h:965
int sodium_library_minimal()
Definition sodium.h:164
int crypto_stream_chacha20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
int crypto_aead_chacha20poly1305_encrypt(uint8_t ctext[], unsigned long long *ctext_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
int crypto_secretbox_xsalsa20poly1305_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_box_curve25519xsalsa20poly1305_macbytes()
Definition sodium.h:594
int crypto_scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32])
int crypto_stream_chacha20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int crypto_stream_xor(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t nonce[24], const uint8_t key[32])
Definition sodium.h:1189
size_t crypto_aead_chacha20poly1305_ietf_abytes()
Definition sodium.h:375
int sodium_library_version_major()
Definition sodium.h:156
void crypto_onetimeauth_keygen(uint8_t k[32])
Definition sodium.h:1011
size_t crypto_core_hsalsa20_constbytes()
Definition sodium.h:948
size_t crypto_aead_xchacha20poly1305_ietf_npubbytes()
Definition sodium.h:511
size_t crypto_aead_xchacha20poly1305_ietf_abytes()
Definition sodium.h:515
int crypto_stream_salsa20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
const char * crypto_stream_primitive()
Definition sodium.h:1181
size_t crypto_stream_xchacha20_noncebytes()
Definition sodium.h:1115
size_t crypto_box_curve25519xsalsa20poly1305_noncebytes()
Definition sodium.h:590
size_t crypto_box_secretkeybytes()
Definition sodium.h:655
void sodium_add(uint8_t a[], const uint8_t b[], size_t len)
size_t crypto_stream_xsalsa20_messagebytes_max()
Definition sodium.h:915
int crypto_auth_hmacsha256_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
int crypto_stream_chacha20_ietf(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
void crypto_auth_hmacsha512_keygen(uint8_t k[32])
Definition sodium.h:826
size_t crypto_secretbox_xsalsa20poly1305_noncebytes()
Definition sodium.h:258
int crypto_secretbox_open_detached(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_box_publickeybytes()
Definition sodium.h:651
size_t crypto_stream_salsa20_messagebytes_max()
Definition sodium.h:1148
void * sodium_malloc(size_t size)
void sodium_increment(uint8_t n[], size_t nlen)
size_t crypto_shorthash_siphash24_bytes()
Definition sodium.h:1200
int crypto_auth(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition sodium.h:864
int sodium_compare(const uint8_t x[], const uint8_t y[], size_t len)
void randombytes(uint8_t buf[], size_t buf_len)
Definition sodium.h:248
size_t crypto_stream_chacha20_messagebytes_max()
Definition sodium.h:1063
void crypto_stream_xsalsa20_keygen(uint8_t k[32])
Definition sodium.h:930
int crypto_aead_chacha20poly1305_ietf_encrypt(uint8_t ctext[], unsigned long long *ctext_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
int crypto_box(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition sodium.h:783
int randombytes_close()
Definition sodium.h:240
int crypto_stream_salsa20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
size_t crypto_shorthash_siphash24_keybytes()
Definition sodium.h:1204
int crypto_sign_ed25519_detached(uint8_t sig[], unsigned long long *sig_len, const uint8_t msg[], size_t msg_len, const uint8_t sk[32])
size_t crypto_aead_chacha20poly1305_abytes()
Definition sodium.h:444
int sodium_library_version_minor()
Definition sodium.h:160
size_t crypto_aead_chacha20poly1305_messagebytes_max()
Definition sodium.h:448
int crypto_secretbox_easy(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:324
int crypto_box_easy_afternm(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:770
int crypto_box_open_easy(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition sodium.h:714
size_t crypto_sign_ed25519_bytes()
Definition sodium.h:1235
int crypto_box_afternm(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:732
int crypto_aead_xchacha20poly1305_ietf_encrypt(uint8_t ctext[], unsigned long long *ctext_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
int crypto_box_curve25519xsalsa20poly1305(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
size_t crypto_box_beforenmbytes()
Definition sodium.h:671
int crypto_stream_chacha20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_auth_keybytes()
Definition sodium.h:856
size_t crypto_hash_sha256_bytes()
Definition sodium.h:878
int sodium_mprotect_noaccess(void *ptr)
int crypto_sign_detached(uint8_t sig[], unsigned long long *sig_len, const uint8_t msg[], size_t msg_len, const uint8_t sk[32])
Definition sodium.h:1302
void randombytes_buf_deterministic(void *buf, size_t size, const uint8_t seed[randombytes_SEEDBYTES])
int crypto_box_keypair(uint8_t pk[32], uint8_t sk[32])
Definition sodium.h:683
int crypto_sign_keypair(uint8_t pk[32], uint8_t sk[32])
Definition sodium.h:1298
int crypto_box_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition sodium.h:728
size_t crypto_shorthash_keybytes()
Definition sodium.h:1217
int crypto_secretbox_xsalsa20poly1305(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int crypto_onetimeauth_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition sodium.h:1007
void crypto_auth_keygen(uint8_t k[])
Definition sodium.h:872
size_t crypto_stream_salsa20_noncebytes()
Definition sodium.h:1144
int crypto_onetimeauth_poly1305(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
void crypto_auth_hmacsha512256_keygen(uint8_t k[32])
Definition sodium.h:846
int crypto_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32])
const char * sodium_version_string()
Definition sodium.h:152
size_t crypto_stream_chacha20_ietf_noncebytes()
Definition sodium.h:1086
size_t crypto_auth_hmacsha512_keybytes()
Definition sodium.h:816
int crypto_shorthash(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t k[16])
Definition sodium.h:1225
int sodium_is_zero(const uint8_t nonce[], size_t nlen)
void crypto_stream_xchacha20_keygen(uint8_t k[32])
Definition sodium.h:1134
void sodium_free(void *ptr)
size_t crypto_box_curve25519xsalsa20poly1305_seedbytes()
Definition sodium.h:574
size_t crypto_core_hsalsa20_inputbytes()
Definition sodium.h:940
size_t crypto_scalarmult_curve25519_bytes()
Definition sodium.h:1017
void crypto_stream_chacha20_ietf_keygen(uint8_t k[32])
Definition sodium.h:1105
size_t crypto_sign_secretkeybytes()
Definition sodium.h:1282
int crypto_core_hsalsa20(uint8_t out[], const uint8_t in[], const uint8_t key[], const uint8_t c[])
int crypto_box_curve25519xsalsa20poly1305_afternm(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:635
int crypto_aead_chacha20poly1305_ietf_decrypt(uint8_t ptext[], unsigned long long *ptext_len, uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int crypto_sign_ed25519_keypair(uint8_t pk[32], uint8_t sk[64])
size_t crypto_box_curve25519xsalsa20poly1305_zerobytes()
Definition sodium.h:606
int crypto_scalarmult(uint8_t out[], const uint8_t scalar[], const uint8_t base[])
Definition sodium.h:1049
void crypto_shorthash_keygen(uint8_t k[16])
Definition sodium.h:1229
void crypto_aead_chacha20poly1305_keygen(uint8_t k[32])
Definition sodium.h:497
uint32_t randombytes_uniform(uint32_t upper_bound)
int crypto_stream_xchacha20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int crypto_box_detached_afternm(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:761
size_t crypto_auth_bytes()
Definition sodium.h:852
size_t crypto_scalarmult_bytes()
Definition sodium.h:1033
void crypto_aead_xchacha20poly1305_ietf_keygen(uint8_t k[32])
Definition sodium.h:568
int crypto_sign_ed25519_seed_keypair(uint8_t pk[], uint8_t sk[], const uint8_t seed[])
int crypto_sign_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[])
Definition sodium.h:1294
int crypto_aead_chacha20poly1305_encrypt_detached(uint8_t ctext[], uint8_t mac[], unsigned long long *mac_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
int sodium_mprotect_readwrite(void *ptr)
size_t crypto_onetimeauth_keybytes()
Definition sodium.h:995
size_t crypto_hash_bytes()
Definition sodium.h:957
int crypto_aead_xchacha20poly1305_ietf_encrypt_detached(uint8_t ctext[], uint8_t mac[], unsigned long long *mac_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
size_t crypto_stream_chacha20_ietf_keybytes()
Definition sodium.h:1082
void crypto_stream_salsa20_keygen(uint8_t k[32])
Definition sodium.h:1163
size_t crypto_auth_hmacsha512256_bytes()
Definition sodium.h:832
size_t crypto_secretbox_keybytes()
Definition sodium.h:292
size_t crypto_auth_hmacsha256_keybytes()
Definition sodium.h:891
size_t crypto_sign_ed25519_secretkeybytes()
Definition sodium.h:1247
size_t crypto_secretbox_boxzerobytes()
Definition sodium.h:347
int crypto_stream_xsalsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
void sodium_memzero(void *ptr, size_t len)
size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max()
Definition sodium.h:379
size_t crypto_aead_chacha20poly1305_keybytes()
Definition sodium.h:432
int crypto_auth_hmacsha512256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
int crypto_stream_xsalsa20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_stream_messagebytes_max()
Definition sodium.h:1177
size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max()
Definition sodium.h:598
size_t crypto_aead_chacha20poly1305_npubbytes()
Definition sodium.h:440
size_t crypto_auth_hmacsha512_bytes()
Definition sodium.h:812
const char * crypto_onetimeauth_primitive()
Definition sodium.h:999
int crypto_onetimeauth(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition sodium.h:1003
int crypto_box_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[])
Definition sodium.h:679
int crypto_auth_hmacsha256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
int crypto_stream_chacha20_ietf_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint32_t ic, const uint8_t key[])
int crypto_stream(uint8_t out[], size_t out_len, const uint8_t nonce[24], const uint8_t key[32])
Definition sodium.h:1185
size_t crypto_aead_chacha20poly1305_nsecbytes()
Definition sodium.h:436
int crypto_secretbox_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition sodium.h:356
size_t crypto_auth_hmacsha512256_keybytes()
Definition sodium.h:836
size_t crypto_secretbox_messagebytes_max()
Definition sodium.h:304
void crypto_secretbox_keygen(uint8_t k[32])
Definition sodium.h:339
int crypto_aead_chacha20poly1305_ietf_decrypt_detached(uint8_t m[], uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t mac[], const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int crypto_auth_hmacsha512_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t crypto_aead_xchacha20poly1305_ietf_nsecbytes()
Definition sodium.h:507
int crypto_hash(uint8_t out[], const uint8_t in[], size_t in_len)
Definition sodium.h:961
size_t crypto_stream_keybytes()
Definition sodium.h:1169
int crypto_secretbox_detached(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
const char * crypto_box_primitive()
Definition sodium.h:675
void crypto_stream_keygen(uint8_t key[32])
Definition sodium.h:1194
size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes()
Definition sodium.h:578
int crypto_aead_xchacha20poly1305_ietf_decrypt_detached(uint8_t ptext[], uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t mac[], const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_secretbox_xsalsa20poly1305_keybytes()
Definition sodium.h:254
size_t crypto_secretbox_xsalsa20poly1305_macbytes()
Definition sodium.h:262
size_t crypto_hash_sha512_bytes()
Definition sodium.h:803
void randombytes_buf(void *buf, size_t size)
size_t crypto_secretbox_zerobytes()
Definition sodium.h:343
int crypto_sign_verify_detached(const uint8_t sig[], const uint8_t in[], size_t in_len, const uint8_t pk[32])
Definition sodium.h:1307
int crypto_scalarmult_base(uint8_t out[], const uint8_t scalar[])
Definition sodium.h:1045
size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes()
Definition sodium.h:282
const SIMD_8x32 & b