Botan  2.16.0
Crypto and TLS for C++11
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 namespace Botan {
13 
14 /**
15 * The Sodium namespace contains a partial implementation of the
16 * libsodium API.
17 */
18 namespace Sodium {
19 
20 // sodium/randombytes.h
21 enum Sodium_Constants : size_t {
22  SODIUM_SIZE_MAX = 0xFFFFFFFF,
23 
29 
35 
41 
48 
51 
61 
71 
76 
81 
85 
90 
95 
102 
109 
114 
125 
144 
148 
150 };
151 
152 inline const char* sodium_version_string() { return "Botan Sodium Compat"; }
153 
154 inline int sodium_library_version_major() { return 0; }
155 
156 inline int sodium_library_version_minor() { return 0; }
157 
158 inline int sodium_library_minimal() { return 0; }
159 
160 inline int sodium_init() { return 0; }
161 
162 // sodium/crypto_verify_{16,32,64}.h
163 
164 BOTAN_PUBLIC_API(2,11)
165 int crypto_verify_16(const uint8_t x[16], const uint8_t y[16]);
166 
167 BOTAN_PUBLIC_API(2,11)
168 int crypto_verify_32(const uint8_t x[32], const uint8_t y[32]);
169 
170 BOTAN_PUBLIC_API(2,11)
171 int crypto_verify_64(const uint8_t x[64], const uint8_t y[64]);
172 
173 // sodium/utils.h
174 BOTAN_PUBLIC_API(2,11)
175 void sodium_memzero(void* ptr, size_t len);
176 
177 BOTAN_PUBLIC_API(2,11)
178 int sodium_memcmp(const void* x, const void* y, size_t len);
179 
180 BOTAN_PUBLIC_API(2,11)
181 int sodium_compare(const uint8_t x[], const uint8_t y[], size_t len);
182 
183 BOTAN_PUBLIC_API(2,11)
184 int sodium_is_zero(const uint8_t nonce[], size_t nlen);
185 
186 BOTAN_PUBLIC_API(2,11)
187 void sodium_increment(uint8_t n[], size_t nlen);
188 
189 BOTAN_PUBLIC_API(2,11)
190 void sodium_add(uint8_t a[], const uint8_t b[], size_t len);
191 
192 BOTAN_PUBLIC_API(2,11)
193 void* sodium_malloc(size_t size);
194 
195 BOTAN_PUBLIC_API(2,11)
196 void* sodium_allocarray(size_t count, size_t size);
197 
198 BOTAN_PUBLIC_API(2,11)
199 void sodium_free(void* ptr);
200 
201 BOTAN_PUBLIC_API(2,11)
202 int sodium_mprotect_noaccess(void* ptr);
203 
204 BOTAN_PUBLIC_API(2,11)
205 int sodium_mprotect_readwrite(void* ptr);
206 
207 // sodium/randombytes.h
208 
209 inline size_t randombytes_seedbytes() { return randombytes_SEEDBYTES; }
210 
211 BOTAN_PUBLIC_API(2,11)
212 void randombytes_buf(void* buf, size_t size);
213 
214 BOTAN_PUBLIC_API(2,11)
215 void randombytes_buf_deterministic(void* buf, size_t size,
216  const uint8_t seed[randombytes_SEEDBYTES]);
217 
218 BOTAN_PUBLIC_API(2,11)
219 uint32_t randombytes_uniform(uint32_t upper_bound);
220 
221 inline uint32_t randombytes_random()
222  {
223  uint32_t x = 0;
224  randombytes_buf(&x, 4);
225  return x;
226  }
227 
228 inline void randombytes_stir() {}
229 
230 inline int randombytes_close() { return 0; }
231 
233  {
234  return "botan";
235  }
236 
237 inline void randombytes(uint8_t buf[], size_t buf_len)
238  {
239  return randombytes_buf(buf, buf_len);
240  }
241 
242 // sodium/crypto_secretbox_xsalsa20poly1305.h
243 
245  {
247  }
248 
250  {
252  }
253 
255  {
257  }
258 
260  {
262  }
263 
264 BOTAN_PUBLIC_API(2,11)
265 int crypto_secretbox_xsalsa20poly1305(uint8_t ctext[],
266  const uint8_t ptext[],
267  size_t ptext_len,
268  const uint8_t nonce[],
269  const uint8_t key[]);
270 
271 BOTAN_PUBLIC_API(2,11)
272 int crypto_secretbox_xsalsa20poly1305_open(uint8_t ptext[],
273  const uint8_t ctext[],
274  size_t ctext_len,
275  const uint8_t nonce[],
276  const uint8_t key[]);
277 
279  {
280  return randombytes_buf(k, 32);
281  }
282 
284  {
286  }
287 
289  {
291  }
292 
293 // sodium/crypto_secretbox.h
294 
296 
298 
300 
302 
303 inline const char* crypto_secretbox_primitive() { return "xsalsa20poly1305"; }
304 
305 BOTAN_PUBLIC_API(2,11)
306 int crypto_secretbox_detached(uint8_t ctext[], uint8_t mac[],
307  const uint8_t ptext[],
308  size_t ptext_len,
309  const uint8_t nonce[],
310  const uint8_t key[]);
311 
312 BOTAN_PUBLIC_API(2,11)
313 int crypto_secretbox_open_detached(uint8_t ptext[],
314  const uint8_t ctext[],
315  const uint8_t mac[],
316  size_t ctext_len,
317  const uint8_t nonce[],
318  const uint8_t key[]);
319 
320 inline int crypto_secretbox_easy(uint8_t ctext[], const uint8_t ptext[],
321  size_t ptext_len, const uint8_t nonce[],
322  const uint8_t key[])
323  {
325  ptext, ptext_len, nonce, key);
326  }
327 
328 inline int crypto_secretbox_open_easy(uint8_t out[], const uint8_t ctext[], size_t ctext_len,
329  const uint8_t nonce[], const uint8_t key[])
330  {
331  if(ctext_len < crypto_secretbox_MACBYTES)
332  {
333  return -1;
334  }
335 
337  ctext, ctext_len - crypto_secretbox_MACBYTES,
338  nonce, key);
339  }
340 
341 inline void crypto_secretbox_keygen(uint8_t k[32])
342  {
343  return randombytes_buf(k, 32);
344  }
345 
347  {
349  }
350 
352  {
354  }
355 
356 inline int crypto_secretbox(uint8_t ctext[], const uint8_t ptext[],
357  size_t ptext_len, const uint8_t nonce[],
358  const uint8_t key[])
359  {
360  return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
361  }
362 
363 inline int crypto_secretbox_open(uint8_t ptext[], const uint8_t ctext[],
364  size_t ctext_len, const uint8_t nonce[],
365  const uint8_t key[])
366  {
367  return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
368  }
369 
370 // sodium/crypto_aead_xchacha20poly1305.h
371 
373  {
375  }
376 
378  {
380  }
381 
383  {
385  }
386 
388  {
390  }
391 
393  {
395  }
396 
397 BOTAN_PUBLIC_API(2,11)
399  unsigned long long* ctext_len,
400  const uint8_t ptext[],
401  size_t ptext_len,
402  const uint8_t ad[],
403  size_t ad_len,
404  const uint8_t unused_secret_nonce[],
405  const uint8_t nonce[],
406  const uint8_t key[]);
407 
408 BOTAN_PUBLIC_API(2,11)
410  unsigned long long* ptext_len,
411  uint8_t unused_secret_nonce[],
412  const uint8_t ctext[],
413  size_t ctext_len,
414  const uint8_t ad[],
415  size_t ad_len,
416  const uint8_t nonce[],
417  const uint8_t key[]);
418 
419 BOTAN_PUBLIC_API(2,11)
421  uint8_t mac[],
422  unsigned long long* mac_len,
423  const uint8_t ptext[],
424  size_t ptext_len,
425  const uint8_t ad[],
426  size_t ad_len,
427  const uint8_t unused_secret_nonce[],
428  const uint8_t nonce[],
429  const uint8_t key[]);
430 
431 BOTAN_PUBLIC_API(2,11)
433  uint8_t unused_secret_nonce[],
434  const uint8_t ctext[],
435  size_t ctext_len,
436  const uint8_t mac[],
437  const uint8_t ad[],
438  size_t ad_len,
439  const uint8_t nonce[],
440  const uint8_t key[]);
441 
443  {
445  }
446 
448  {
450  }
451 
453  {
455  }
456 
458  {
460  }
461 
463  {
465  }
466 
468  {
470  }
471 
472 BOTAN_PUBLIC_API(2,11)
473 int crypto_aead_chacha20poly1305_encrypt(uint8_t ctext[],
474  unsigned long long* ctext_len,
475  const uint8_t ptext[],
476  size_t ptext_len,
477  const uint8_t ad[],
478  size_t ad_len,
479  const uint8_t unused_secret_nonce[],
480  const uint8_t nonce[],
481  const uint8_t key[]);
482 
483 BOTAN_PUBLIC_API(2,11)
485  unsigned long long* ptext_len,
486  uint8_t unused_secret_nonce[],
487  const uint8_t ctext[],
488  size_t ctext_len,
489  const uint8_t ad[],
490  size_t ad_len,
491  const uint8_t nonce[],
492  const uint8_t key[]);
493 
494 BOTAN_PUBLIC_API(2,11)
496  uint8_t mac[],
497  unsigned long long* mac_len,
498  const uint8_t ptext[],
499  size_t ptext_len,
500  const uint8_t ad[],
501  size_t ad_len,
502  const uint8_t unused_secret_nonce[],
503  const uint8_t nonce[],
504  const uint8_t key[]);
505 
506 BOTAN_PUBLIC_API(2,11)
508  uint8_t unused_secret_nonce[],
509  const uint8_t ctext[],
510  size_t ctext_len,
511  const uint8_t mac[],
512  const uint8_t ad[],
513  size_t ad_len,
514  const uint8_t nonce[],
515  const uint8_t key[]);
516 
517 inline void crypto_aead_chacha20poly1305_keygen(uint8_t k[32])
518  {
519  randombytes_buf(k, 32);
520  }
521 
522 // sodium/crypto_aead_xchacha20poly1305.h
523 
525  {
527  }
528 
530  {
532  }
533 
535  {
537  }
538 
540  {
542  }
543 
545  {
547  }
548 
549 BOTAN_PUBLIC_API(2,11)
551  unsigned long long* ctext_len,
552  const uint8_t ptext[],
553  size_t ptext_len,
554  const uint8_t ad[],
555  size_t ad_len,
556  const uint8_t unused_secret_nonce[],
557  const uint8_t nonce[],
558  const uint8_t key[]);
559 
560 BOTAN_PUBLIC_API(2,11)
562  unsigned long long* ptext_len,
563  uint8_t unused_secret_nonce[],
564  const uint8_t ctext[],
565  size_t ctext_len,
566  const uint8_t ad[],
567  size_t ad_len,
568  const uint8_t nonce[],
569  const uint8_t key[]);
570 
571 BOTAN_PUBLIC_API(2,11)
573  uint8_t mac[],
574  unsigned long long* mac_len,
575  const uint8_t ptext[],
576  size_t ptext_len,
577  const uint8_t ad[],
578  size_t ad_len,
579  const uint8_t unused_secret_nonce[],
580  const uint8_t nonce[],
581  const uint8_t key[]);
582 
583 BOTAN_PUBLIC_API(2,11)
585  uint8_t unused_secret_nonce[],
586  const uint8_t ctext[],
587  size_t ctext_len,
588  const uint8_t mac[],
589  const uint8_t ad[],
590  size_t ad_len,
591  const uint8_t nonce[],
592  const uint8_t key[]);
593 
595  {
596  return randombytes_buf(k, 32);
597  }
598 
599 // sodium/crypto_box_curve25519xsalsa20poly1305.h
600 
602  {
604  }
605 
607  {
609  }
610 
612  {
614  }
615 
617  {
619  }
620 
622  {
624  }
625 
627  {
629  }
630 
632  {
634  }
635 
637  {
639  }
640 
642  {
644  }
645 
646 BOTAN_PUBLIC_API(2,11)
648  uint8_t sk[32],
649  const uint8_t seed[32]);
650 
651 BOTAN_PUBLIC_API(2,11)
653  uint8_t sk[32]);
654 
655 BOTAN_PUBLIC_API(2,11)
657  const uint8_t pk[32],
658  const uint8_t sk[32]);
659 
660 BOTAN_PUBLIC_API(2,11)
661 int crypto_box_curve25519xsalsa20poly1305(uint8_t ctext[],
662  const uint8_t ptext[],
663  size_t ptext_len,
664  const uint8_t nonce[],
665  const uint8_t pk[32],
666  const uint8_t sk[32]);
667 
668 BOTAN_PUBLIC_API(2,11)
670  const uint8_t ctext[],
671  size_t ctext_len,
672  const uint8_t nonce[],
673  const uint8_t pk[32],
674  const uint8_t sk[32]);
675 
677  const uint8_t ptext[],
678  size_t ptext_len,
679  const uint8_t nonce[],
680  const uint8_t key[])
681  {
682  return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
683  }
684 
686  const uint8_t ctext[],
687  size_t ctext_len,
688  const uint8_t nonce[],
689  const uint8_t key[])
690  {
691  return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
692  }
693 
694 // sodium/crypto_box.h
695 
696 inline size_t crypto_box_seedbytes()
697  {
698  return crypto_box_SEEDBYTES;
699  }
700 
702  {
704  }
705 
707  {
709  }
710 
711 inline size_t crypto_box_noncebytes()
712  {
713  return crypto_box_NONCEBYTES;
714  }
715 
716 inline size_t crypto_box_macbytes()
717  {
718  return crypto_box_MACBYTES;
719  }
720 
722  {
724  }
725 
727  {
729  }
730 
731 inline const char* crypto_box_primitive() { return "curve25519xsalsa20poly1305"; }
732 
733 inline int crypto_box_seed_keypair(uint8_t pk[32], uint8_t sk[32],
734  const uint8_t seed[])
735  {
737  }
738 
739 inline int crypto_box_keypair(uint8_t pk[32], uint8_t sk[32])
740  {
742  }
743 
744 BOTAN_PUBLIC_API(2,11)
745 int crypto_box_detached(uint8_t ctext[], uint8_t mac[],
746  const uint8_t ptext[], size_t ptext_len,
747  const uint8_t nonce[], const uint8_t pk[32],
748  const uint8_t sk[32]);
749 
750 BOTAN_PUBLIC_API(2,11)
751 int crypto_box_open_detached(uint8_t ptext[], const uint8_t ctext[],
752  const uint8_t mac[],
753  size_t ctext_len,
754  const uint8_t nonce[],
755  const uint8_t pk[32],
756  const uint8_t sk[32]);
757 
758 inline int crypto_box_easy(uint8_t ctext[], const uint8_t ptext[],
759  size_t ptext_len, const uint8_t nonce[],
760  const uint8_t pk[32], const uint8_t sk[32])
761  {
762  return crypto_box_detached(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, pk, sk);
763  }
764 
765 inline int crypto_box_open_easy(uint8_t ptext[], const uint8_t ctext[],
766  size_t ctext_len, const uint8_t nonce[],
767  const uint8_t pk[32], const uint8_t sk[32])
768  {
769  if(ctext_len < crypto_box_MACBYTES)
770  {
771  return -1;
772  }
773 
774  return crypto_box_open_detached(ptext, ctext + crypto_box_MACBYTES,
775  ctext, ctext_len - crypto_box_MACBYTES,
776  nonce, pk, sk);
777  }
778 
779 inline int crypto_box_beforenm(uint8_t key[], const uint8_t pk[32],
780  const uint8_t sk[32])
781  {
783  }
784 
785 inline int crypto_box_afternm(uint8_t ctext[], const uint8_t ptext[],
786  size_t ptext_len, const uint8_t nonce[],
787  const uint8_t key[])
788  {
789  return crypto_box_curve25519xsalsa20poly1305_afternm(ctext, ptext, ptext_len, nonce, key);
790  }
791 
792 inline int crypto_box_open_afternm(uint8_t ptext[], const uint8_t ctext[],
793  size_t ctext_len, const uint8_t nonce[],
794  const uint8_t key[])
795  {
796  return crypto_box_curve25519xsalsa20poly1305_open_afternm(ptext, ctext, ctext_len, nonce, key);
797  }
798 
799 inline int crypto_box_open_detached_afternm(uint8_t ptext[], const uint8_t ctext[],
800  const uint8_t mac[],
801  size_t ctext_len, const uint8_t nonce[],
802  const uint8_t key[])
803  {
804  return crypto_secretbox_open_detached(ptext, ctext, mac, ctext_len, nonce, key);
805  }
806 
807 inline int crypto_box_open_easy_afternm(uint8_t ptext[], const uint8_t ctext[],
808  size_t ctext_len, const uint8_t nonce[],
809  const uint8_t key[])
810  {
811  if(ctext_len < crypto_box_MACBYTES)
812  {
813  return -1;
814  }
815 
817  ctext, ctext_len - crypto_box_MACBYTES,
818  nonce, key);
819  }
820 
821 inline int crypto_box_detached_afternm(uint8_t ctext[], uint8_t mac[],
822  const uint8_t ptext[], size_t ptext_len,
823  const uint8_t nonce[], const uint8_t key[])
824  {
825  return crypto_secretbox_detached(ctext, mac, ptext, ptext_len, nonce, key);
826  }
827 
828 inline int crypto_box_easy_afternm(uint8_t ctext[], const uint8_t ptext[],
829  size_t ptext_len, const uint8_t nonce[],
830  const uint8_t key[])
831  {
832  return crypto_box_detached_afternm(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, key);
833  }
834 
835 inline size_t crypto_box_zerobytes() { return crypto_box_ZEROBYTES; }
836 
838 
839 inline int crypto_box(uint8_t ctext[], const uint8_t ptext[],
840  size_t ptext_len, const uint8_t nonce[],
841  const uint8_t pk[32], const uint8_t sk[32])
842  {
843  return crypto_box_curve25519xsalsa20poly1305(ctext, ptext, ptext_len, nonce, pk, sk);
844  }
845 
846 inline int crypto_box_open(uint8_t ptext[], const uint8_t ctext[],
847  size_t ctext_len, const uint8_t nonce[],
848  const uint8_t pk[32], const uint8_t sk[32])
849  {
850  return crypto_box_curve25519xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, pk, sk);
851  }
852 
853 // sodium/crypto_hash_sha512.h
854 
856 
857 BOTAN_PUBLIC_API(2,11)
858 int crypto_hash_sha512(uint8_t out[64], const uint8_t in[], size_t in_len);
859 
860 // sodium/crypto_auth_hmacsha512.h
861 
863 
865 
866 BOTAN_PUBLIC_API(2,11)
867 int crypto_auth_hmacsha512(uint8_t out[],
868  const uint8_t in[],
869  size_t in_len,
870  const uint8_t key[]);
871 
872 BOTAN_PUBLIC_API(2,11)
873 int crypto_auth_hmacsha512_verify(const uint8_t h[],
874  const uint8_t in[],
875  size_t in_len,
876  const uint8_t key[]);
877 
878 inline void crypto_auth_hmacsha512_keygen(uint8_t k[32])
879  {
880  return randombytes_buf(k, 32);
881  }
882 
883 // sodium/crypto_auth_hmacsha512256.h
884 
886  {
888  }
889 
891  {
893  }
894 
895 BOTAN_PUBLIC_API(2,11)
896 int crypto_auth_hmacsha512256(uint8_t out[],
897  const uint8_t in[],
898  size_t in_len,
899  const uint8_t key[]);
900 
901 BOTAN_PUBLIC_API(2,11)
902 int crypto_auth_hmacsha512256_verify(const uint8_t h[],
903  const uint8_t in[],
904  size_t in_len,
905  const uint8_t key[]);
906 
907 inline void crypto_auth_hmacsha512256_keygen(uint8_t k[32])
908  {
909  return randombytes_buf(k, 32);
910  }
911 
912 // sodium/crypto_auth.h
913 
914 inline size_t crypto_auth_bytes() { return crypto_auth_BYTES; }
915 
916 inline size_t crypto_auth_keybytes() { return crypto_auth_KEYBYTES; }
917 
918 inline const char* crypto_auth_primitive() { return "hmacsha512256"; }
919 
920 inline int crypto_auth(uint8_t out[], const uint8_t in[],
921  size_t in_len, const uint8_t key[])
922  {
923  return crypto_auth_hmacsha512256(out, in, in_len, key);
924  }
925 
926 inline int crypto_auth_verify(const uint8_t mac[], const uint8_t in[],
927  size_t in_len, const uint8_t key[])
928  {
929  return crypto_auth_hmacsha512256_verify(mac, in, in_len, key);
930  }
931 
932 inline void crypto_auth_keygen(uint8_t k[])
933  {
935  }
936 
937 // sodium/crypto_hash_sha256.h
938 
940  {
942  }
943 
944 BOTAN_PUBLIC_API(2,11)
945 int crypto_hash_sha256(uint8_t out[], const uint8_t in[], size_t in_len);
946 
947 // sodium/crypto_auth_hmacsha256.h
948 
950  {
952  }
953 
955  {
957  }
958 
959 BOTAN_PUBLIC_API(2,11)
960 int crypto_auth_hmacsha256(uint8_t out[],
961  const uint8_t in[],
962  size_t in_len,
963  const uint8_t key[]);
964 
965 BOTAN_PUBLIC_API(2,11)
966 int crypto_auth_hmacsha256_verify(const uint8_t h[],
967  const uint8_t in[],
968  size_t in_len,
969  const uint8_t key[]);
970 
971 inline void crypto_auth_hmacsha256_keygen(uint8_t k[32])
972  {
973  return randombytes_buf(k, 32);
974  }
975 
976 // sodium/crypto_stream_xsalsa20.h
977 
979  {
981  }
982 
984  {
986  }
987 
989  {
991  }
992 
993 BOTAN_PUBLIC_API(2,11)
994 int crypto_stream_xsalsa20(uint8_t out[], size_t ctext_len,
995  const uint8_t nonce[], const uint8_t key[]);
996 
997 BOTAN_PUBLIC_API(2,11)
998 int crypto_stream_xsalsa20_xor(uint8_t out[], const uint8_t ptext[],
999  size_t ptext_len, const uint8_t nonce[],
1000  const uint8_t key[]);
1001 
1002 BOTAN_PUBLIC_API(2,11)
1003 int crypto_stream_xsalsa20_xor_ic(uint8_t out[], const uint8_t ptext[],
1004  size_t ptext_len,
1005  const uint8_t nonce[], uint64_t ic,
1006  const uint8_t key[]);
1007 
1008 inline void crypto_stream_xsalsa20_keygen(uint8_t k[32])
1009  {
1010  return randombytes_buf(k, 32);
1011  }
1012 
1013 // sodium/crypto_core_hsalsa20.h
1014 
1016  {
1018  }
1019 
1021  {
1023  }
1024 
1026  {
1028  }
1029 
1031  {
1033  }
1034 
1035 BOTAN_PUBLIC_API(2,11)
1036 int crypto_core_hsalsa20(uint8_t out[], const uint8_t in[],
1037  const uint8_t key[], const uint8_t c[]);
1038 
1039 // sodium/crypto_hash.h
1040 
1041 inline size_t crypto_hash_bytes()
1042  {
1043  return crypto_hash_BYTES;
1044  }
1045 
1046 inline int crypto_hash(uint8_t out[], const uint8_t in[], size_t in_len)
1047  {
1048  return crypto_hash_sha512(out, in, in_len);
1049  }
1050 
1051 inline const char* crypto_hash_primitive() { return "sha512"; }
1052 
1053 // sodium/crypto_onetimeauth_poly1305.h
1054 
1056  {
1058  }
1059 
1061  {
1063  }
1064 
1065 BOTAN_PUBLIC_API(2,11)
1066 int crypto_onetimeauth_poly1305(uint8_t out[],
1067  const uint8_t in[],
1068  size_t in_len,
1069  const uint8_t key[]);
1070 
1071 BOTAN_PUBLIC_API(2,11)
1072 int crypto_onetimeauth_poly1305_verify(const uint8_t h[],
1073  const uint8_t in[],
1074  size_t in_len,
1075  const uint8_t key[]);
1076 
1077 inline void crypto_onetimeauth_poly1305_keygen(uint8_t k[32])
1078  {
1079  return randombytes_buf(k, 32);
1080  }
1081 
1082 // sodium/crypto_onetimeauth.h
1083 
1085 
1087 
1088 inline const char* crypto_onetimeauth_primitive() { return "poly1305"; }
1089 
1090 inline int crypto_onetimeauth(uint8_t out[], const uint8_t in[],
1091  size_t in_len, const uint8_t key[])
1092  {
1093  return crypto_onetimeauth_poly1305(out, in, in_len, key);
1094  }
1095 
1096 inline int crypto_onetimeauth_verify(const uint8_t h[], const uint8_t in[],
1097  size_t in_len, const uint8_t key[])
1098  {
1099  return crypto_onetimeauth_poly1305_verify(h, in, in_len, key);
1100  }
1101 
1102 inline void crypto_onetimeauth_keygen(uint8_t k[32])
1103  {
1105  }
1106 
1107 // sodium/crypto_scalarmult_curve25519.h
1108 
1110  {
1112  }
1113 
1115  {
1117  }
1118 
1119 BOTAN_PUBLIC_API(2,11)
1120 int crypto_scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32]);
1121 
1122 BOTAN_PUBLIC_API(2,11)
1123 int crypto_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32]);
1124 
1125 // sodium/crypto_scalarmult.h
1126 
1128 
1130 
1131 inline const char* crypto_scalarmult_primitive() { return "curve25519"; }
1132 
1133 inline int crypto_scalarmult_base(uint8_t out[], const uint8_t scalar[])
1134  {
1135  return crypto_scalarmult_curve25519_base(out, scalar);
1136  }
1137 
1138 inline int crypto_scalarmult(uint8_t out[], const uint8_t scalar[], const uint8_t base[])
1139  {
1140  return crypto_scalarmult_curve25519(out, scalar, base);
1141  }
1142 
1143 // sodium/crypto_stream_chacha20.h
1144 
1146  {
1148  }
1149 
1151  {
1153  }
1154 
1156  {
1158  }
1159 
1160 BOTAN_PUBLIC_API(2,11)
1161 int crypto_stream_chacha20(uint8_t out[], size_t ctext_len,
1162  const uint8_t nonce[], const uint8_t key[]);
1163 
1164 BOTAN_PUBLIC_API(2,11)
1165 int crypto_stream_chacha20_xor(uint8_t out[], const uint8_t ptext[],
1166  size_t ptext_len, const uint8_t nonce[],
1167  const uint8_t key[]);
1168 
1169 BOTAN_PUBLIC_API(2,11)
1170 int crypto_stream_chacha20_xor_ic(uint8_t out[], const uint8_t ptext[],
1171  size_t ptext_len,
1172  const uint8_t nonce[], uint64_t ic,
1173  const uint8_t key[]);
1174 
1175 inline void crypto_stream_chacha20_keygen(uint8_t k[32])
1176  {
1177  return randombytes_buf(k, 32);
1178  }
1179 
1181  {
1183  }
1184 
1186  {
1188  }
1189 
1191  {
1193  }
1194 
1195 BOTAN_PUBLIC_API(2,11)
1196 int crypto_stream_chacha20_ietf(uint8_t out[], size_t ctext_len,
1197  const uint8_t nonce[], const uint8_t key[]);
1198 
1199 BOTAN_PUBLIC_API(2,11)
1200 int crypto_stream_chacha20_ietf_xor(uint8_t out[], const uint8_t ptext[],
1201  size_t ptext_len, const uint8_t nonce[],
1202  const uint8_t key[]);
1203 
1204 BOTAN_PUBLIC_API(2,11)
1205 int crypto_stream_chacha20_ietf_xor_ic(uint8_t out[], const uint8_t ptext[],
1206  size_t ptext_len,
1207  const uint8_t nonce[], uint32_t ic,
1208  const uint8_t key[]);
1209 
1210 inline void crypto_stream_chacha20_ietf_keygen(uint8_t k[32])
1211  {
1212  return randombytes_buf(k, 32);
1213  }
1214 
1215 // sodium/crypto_stream_xchacha20.h
1216 
1218  {
1220  }
1221 
1223  {
1225  }
1226 
1228  {
1230  }
1231 
1232 BOTAN_PUBLIC_API(2,11)
1233 int crypto_stream_xchacha20(uint8_t out[], size_t ctext_len,
1234  const uint8_t nonce[], const uint8_t key[]);
1235 
1236 BOTAN_PUBLIC_API(2,11)
1237 int crypto_stream_xchacha20_xor(uint8_t out[], const uint8_t ptext[],
1238  size_t ptext_len, const uint8_t nonce[],
1239  const uint8_t key[]);
1240 
1241 BOTAN_PUBLIC_API(2,11)
1242 int crypto_stream_xchacha20_xor_ic(uint8_t out[], const uint8_t ptext[],
1243  size_t ptext_len,
1244  const uint8_t nonce[], uint64_t ic,
1245  const uint8_t key[]);
1246 
1247 inline void crypto_stream_xchacha20_keygen(uint8_t k[32])
1248  {
1250  }
1251 
1252 // sodium/crypto_stream_salsa20.h
1253 
1255  {
1257  }
1258 
1260  {
1262  }
1263 
1265  {
1267  }
1268 
1269 BOTAN_PUBLIC_API(2,11)
1270 int crypto_stream_salsa20(uint8_t out[], size_t ctext_len,
1271  const uint8_t nonce[], const uint8_t key[]);
1272 
1273 BOTAN_PUBLIC_API(2,11)
1274 int crypto_stream_salsa20_xor(uint8_t out[], const uint8_t ptext[],
1275  size_t ptext_len, const uint8_t nonce[],
1276  const uint8_t key[]);
1277 
1278 BOTAN_PUBLIC_API(2,11)
1279 int crypto_stream_salsa20_xor_ic(uint8_t out[], const uint8_t ptext[],
1280  size_t ptext_len,
1281  const uint8_t nonce[], uint64_t ic,
1282  const uint8_t key[]);
1283 
1284 inline void crypto_stream_salsa20_keygen(uint8_t k[32])
1285  {
1286  return randombytes_buf(k, 32);
1287  }
1288 
1289 // sodium/crypto_stream.h
1290 
1292 
1294 
1296 
1297 inline const char* crypto_stream_primitive() { return "xsalsa20"; }
1298 
1299 inline int crypto_stream(uint8_t out[], size_t out_len,
1300  const uint8_t nonce[24], const uint8_t key[32])
1301  {
1302  return crypto_stream_xsalsa20(out, out_len, nonce, key);
1303  }
1304 
1305 inline int crypto_stream_xor(uint8_t out[], const uint8_t in[], size_t in_len,
1306  const uint8_t nonce[24], const uint8_t key[32])
1307  {
1308  return crypto_stream_xsalsa20_xor(out, in, in_len, nonce, key);
1309  }
1310 
1311 inline void crypto_stream_keygen(uint8_t key[32])
1312  {
1313  return randombytes_buf(key, 32);
1314  }
1315 
1316 // sodium/crypto_shorthash_siphash24.h
1317 
1319 
1321 
1322 BOTAN_PUBLIC_API(2,11)
1323 int crypto_shorthash_siphash24(uint8_t out[8], const uint8_t in[], size_t in_len, const uint8_t key[16]);
1324 
1325 // sodium/crypto_shorthash.h
1326 
1328 
1330 
1331 inline const char* crypto_shorthash_primitive() { return "siphash24"; }
1332 
1333 inline int crypto_shorthash(uint8_t out[], const uint8_t in[],
1334  size_t in_len, const uint8_t k[16])
1335  {
1336  return crypto_shorthash_siphash24(out, in, in_len, k);
1337  }
1338 
1339 inline void crypto_shorthash_keygen(uint8_t k[16])
1340  {
1342  }
1343 
1344 // sodium/crypto_sign_ed25519.h
1345 
1347  {
1349  }
1350 
1352  {
1354  }
1355 
1357  {
1359  }
1360 
1362  {
1364  }
1365 
1367  {
1369  }
1370 
1371 BOTAN_PUBLIC_API(2,11)
1372 int crypto_sign_ed25519_detached(uint8_t sig[],
1373  unsigned long long* sig_len,
1374  const uint8_t msg[],
1375  size_t msg_len,
1376  const uint8_t sk[32]);
1377 
1378 BOTAN_PUBLIC_API(2,11)
1379 int crypto_sign_ed25519_verify_detached(const uint8_t sig[],
1380  const uint8_t msg[],
1381  size_t msg_len,
1382  const uint8_t pk[32]);
1383 
1384 BOTAN_PUBLIC_API(2,11)
1385 int crypto_sign_ed25519_keypair(uint8_t pk[32], uint8_t sk[64]);
1386 
1387 BOTAN_PUBLIC_API(2,11)
1388 int crypto_sign_ed25519_seed_keypair(uint8_t pk[], uint8_t sk[],
1389  const uint8_t seed[]);
1390 
1391 // sodium/crypto_sign.h
1392 
1393 inline size_t crypto_sign_bytes()
1394  {
1395  return crypto_sign_BYTES;
1396  }
1397 
1398 inline size_t crypto_sign_seedbytes()
1399  {
1400  return crypto_sign_SEEDBYTES;
1401  }
1402 
1404  {
1406  }
1407 
1409  {
1411  }
1412 
1414  {
1416  }
1417 
1418 inline const char* crypto_sign_primitive()
1419  {
1420  return "ed25519";
1421  }
1422 
1423 inline int crypto_sign_seed_keypair(uint8_t pk[32], uint8_t sk[32],
1424  const uint8_t seed[])
1425  {
1426  return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
1427  }
1428 
1429 inline int crypto_sign_keypair(uint8_t pk[32], uint8_t sk[32])
1430  {
1431  return crypto_sign_ed25519_keypair(pk, sk);
1432  }
1433 
1434 inline int crypto_sign_detached(uint8_t sig[], unsigned long long* sig_len,
1435  const uint8_t msg[], size_t msg_len,
1436  const uint8_t sk[32])
1437  {
1438  return crypto_sign_ed25519_detached(sig, sig_len, msg, msg_len, sk);
1439  }
1440 
1441 inline int crypto_sign_verify_detached(const uint8_t sig[],
1442  const uint8_t in[],
1443  size_t in_len,
1444  const uint8_t pk[32])
1445  {
1446  return crypto_sign_ed25519_verify_detached(sig, in, in_len, pk);
1447  }
1448 
1449 }
1450 
1451 }
1452 
1453 #endif
int crypto_core_hsalsa20(uint8_t out[], const uint8_t in[], const uint8_t key[], const uint8_t c[])
int crypto_box_keypair(uint8_t pk[32], uint8_t sk[32])
Definition: sodium.h:739
int crypto_hash(uint8_t out[], const uint8_t in[], size_t in_len)
Definition: sodium.h:1046
size_t crypto_scalarmult_scalarbytes()
Definition: sodium.h:1129
void crypto_stream_chacha20_ietf_keygen(uint8_t k[32])
Definition: sodium.h:1210
size_t crypto_core_hsalsa20_outputbytes()
Definition: sodium.h:1015
size_t crypto_stream_chacha20_keybytes()
Definition: sodium.h:1145
void crypto_aead_chacha20poly1305_keygen(uint8_t k[32])
Definition: sodium.h:517
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])
Definition: sodium_box.cpp:42
size_t crypto_secretbox_noncebytes()
Definition: sodium.h:297
void crypto_stream_keygen(uint8_t key[32])
Definition: sodium.h:1311
size_t crypto_sign_ed25519_bytes()
Definition: sodium.h:1346
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:839
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:356
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[])
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])
Definition: sodium_box.cpp:85
void sodium_memzero(void *ptr, size_t len)
size_t crypto_auth_hmacsha256_keybytes()
Definition: sodium.h:954
int crypto_onetimeauth_poly1305(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:39
size_t crypto_aead_chacha20poly1305_ietf_npubbytes()
Definition: sodium.h:382
int crypto_hash_sha256(uint8_t out[], const uint8_t in[], size_t in_len)
Definition: sodium_auth.cpp:21
uint32_t randombytes_random()
Definition: sodium.h:221
int crypto_onetimeauth(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium.h:1090
void crypto_stream_salsa20_keygen(uint8_t k[32])
Definition: sodium.h:1284
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:799
size_t crypto_aead_chacha20poly1305_nsecbytes()
Definition: sodium.h:452
void sodium_increment(uint8_t n[], size_t nlen)
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:758
void * sodium_allocarray(size_t count, size_t size)
void crypto_stream_chacha20_keygen(uint8_t k[32])
Definition: sodium.h:1175
size_t crypto_box_publickeybytes()
Definition: sodium.h:701
void crypto_onetimeauth_poly1305_keygen(uint8_t k[32])
Definition: sodium.h:1077
size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max()
Definition: sodium.h:392
size_t crypto_box_macbytes()
Definition: sodium.h:716
int crypto_stream(uint8_t out[], size_t out_len, const uint8_t nonce[24], const uint8_t key[32])
Definition: sodium.h:1299
size_t crypto_box_zerobytes()
Definition: sodium.h:835
size_t crypto_shorthash_siphash24_keybytes()
Definition: sodium.h:1320
void * sodium_malloc(size_t size)
size_t crypto_aead_chacha20poly1305_ietf_keybytes()
Definition: sodium.h:372
size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max()
Definition: sodium.h:631
void randombytes_buf_deterministic(void *buf, size_t size, const uint8_t seed[randombytes_SEEDBYTES])
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[])
size_t crypto_box_curve25519xsalsa20poly1305_zerobytes()
Definition: sodium.h:641
int crypto_box_curve25519xsalsa20poly1305_keypair(uint8_t pk[32], uint8_t sk[32])
Definition: sodium_box.cpp:22
int crypto_stream_chacha20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
void sodium_add(uint8_t a[], const uint8_t b[], size_t len)
int crypto_shorthash(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t k[16])
Definition: sodium.h:1333
size_t crypto_aead_chacha20poly1305_abytes()
Definition: sodium.h:462
size_t crypto_scalarmult_curve25519_scalarbytes()
Definition: sodium.h:1114
const char * crypto_secretbox_primitive()
Definition: sodium.h:303
int crypto_secretbox_xsalsa20poly1305(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_stream_salsa20_noncebytes()
Definition: sodium.h:1259
size_t crypto_secretbox_macbytes()
Definition: sodium.h:299
const char * crypto_sign_primitive()
Definition: sodium.h:1418
int crypto_hash_sha512(uint8_t out[64], const uint8_t in[], size_t in_len)
Definition: sodium_auth.cpp:13
void crypto_shorthash_keygen(uint8_t k[16])
Definition: sodium.h:1339
size_t crypto_stream_xsalsa20_keybytes()
Definition: sodium.h:978
int crypto_scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32])
size_t crypto_onetimeauth_poly1305_keybytes()
Definition: sodium.h:1060
size_t crypto_hash_sha512_bytes()
Definition: sodium.h:855
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
void crypto_auth_hmacsha512_keygen(uint8_t k[32])
Definition: sodium.h:878
int crypto_verify_16(const uint8_t x[16], const uint8_t y[16])
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[])
size_t crypto_stream_chacha20_ietf_keybytes()
Definition: sodium.h:1180
void crypto_aead_xchacha20poly1305_ietf_keygen(uint8_t k[32])
Definition: sodium.h:594
size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes()
Definition: sodium.h:283
void randombytes_stir()
Definition: sodium.h:228
int crypto_box_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[])
Definition: sodium.h:733
int sodium_mprotect_readwrite(void *ptr)
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_auth_hmacsha512256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:83
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:765
void crypto_onetimeauth_keygen(uint8_t k[32])
Definition: sodium.h:1102
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[])
int crypto_stream_xchacha20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int sodium_library_minimal()
Definition: sodium.h:158
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[])
int sodium_mprotect_noaccess(void *ptr)
const char * crypto_scalarmult_primitive()
Definition: sodium.h:1131
int crypto_stream_salsa20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
void crypto_secretbox_xsalsa20poly1305_keygen(uint8_t k[32])
Definition: sodium.h:278
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[])
size_t crypto_stream_keybytes()
Definition: sodium.h:1291
size_t crypto_sign_publickeybytes()
Definition: sodium.h:1403
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[])
void crypto_stream_xsalsa20_keygen(uint8_t k[32])
Definition: sodium.h:1008
size_t crypto_scalarmult_bytes()
Definition: sodium.h:1127
size_t crypto_box_curve25519xsalsa20poly1305_macbytes()
Definition: sodium.h:626
size_t crypto_shorthash_bytes()
Definition: sodium.h:1327
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 sodium_library_version_minor()
Definition: sodium.h:156
void sodium_free(void *ptr)
int crypto_stream_chacha20_ietf(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t crypto_aead_xchacha20poly1305_ietf_abytes()
Definition: sodium.h:539
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_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32])
int sodium_memcmp(const void *x, const void *y, size_t len)
void randombytes_buf(void *buf, size_t size)
int crypto_onetimeauth_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium.h:1096
int crypto_sign_ed25519_seed_keypair(uint8_t pk[], uint8_t sk[], const uint8_t seed[])
size_t crypto_auth_hmacsha512_bytes()
Definition: sodium.h:862
int crypto_stream_xsalsa20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int crypto_auth_verify(const uint8_t mac[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium.h:926
size_t crypto_stream_chacha20_noncebytes()
Definition: sodium.h:1150
size_t randombytes_seedbytes()
Definition: sodium.h:209
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:807
void crypto_auth_hmacsha256_keygen(uint8_t k[32])
Definition: sodium.h:971
size_t crypto_sign_bytes()
Definition: sodium.h:1393
size_t crypto_scalarmult_curve25519_bytes()
Definition: sodium.h:1109
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_auth_hmacsha256_bytes()
Definition: sodium.h:949
size_t crypto_aead_xchacha20poly1305_ietf_nsecbytes()
Definition: sodium.h:529
size_t crypto_box_boxzerobytes()
Definition: sodium.h:837
size_t crypto_box_beforenmbytes()
Definition: sodium.h:726
size_t crypto_box_secretkeybytes()
Definition: sodium.h:706
int crypto_auth_hmacsha256_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t crypto_secretbox_boxzerobytes()
Definition: sodium.h:351
size_t crypto_core_hsalsa20_keybytes()
Definition: sodium.h:1025
const char * crypto_shorthash_primitive()
Definition: sodium.h:1331
int crypto_onetimeauth_poly1305_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:51
const char * crypto_auth_primitive()
Definition: sodium.h:918
size_t crypto_aead_chacha20poly1305_npubbytes()
Definition: sodium.h:457
int crypto_auth_hmacsha512(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:61
size_t crypto_sign_messagebytes_max()
Definition: sodium.h:1413
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:785
size_t crypto_stream_xchacha20_messagebytes_max()
Definition: sodium.h:1227
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 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_secretbox_keybytes()
Definition: sodium.h:295
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_aead_chacha20poly1305_ietf_abytes()
Definition: sodium.h:387
int sodium_compare(const uint8_t x[], const uint8_t y[], size_t len)
size_t crypto_box_curve25519xsalsa20poly1305_seedbytes()
Definition: sodium.h:601
size_t crypto_auth_keybytes()
Definition: sodium.h:916
size_t crypto_secretbox_xsalsa20poly1305_zerobytes()
Definition: sodium.h:288
int crypto_scalarmult(uint8_t out[], const uint8_t scalar[], const uint8_t base[])
Definition: sodium.h:1138
size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max()
Definition: sodium.h:259
size_t crypto_sign_secretkeybytes()
Definition: sodium.h:1408
int crypto_verify_64(const uint8_t x[64], const uint8_t y[64])
int crypto_sign_keypair(uint8_t pk[32], uint8_t sk[32])
Definition: sodium.h:1429
size_t crypto_auth_bytes()
Definition: sodium.h:914
size_t crypto_sign_ed25519_seedbytes()
Definition: sodium.h:1351
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:363
size_t crypto_secretbox_xsalsa20poly1305_noncebytes()
Definition: sodium.h:249
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])
Definition: sodium_box.cpp:72
size_t crypto_aead_chacha20poly1305_messagebytes_max()
Definition: sodium.h:467
int crypto_sign_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[])
Definition: sodium.h:1423
size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max()
Definition: sodium.h:544
void crypto_stream_xchacha20_keygen(uint8_t k[32])
Definition: sodium.h:1247
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[])
int crypto_box_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium.h:779
size_t crypto_stream_chacha20_ietf_noncebytes()
Definition: sodium.h:1185
size_t crypto_onetimeauth_poly1305_bytes()
Definition: sodium.h:1055
const char * sodium_version_string()
Definition: sodium.h:152
int sodium_library_version_major()
Definition: sodium.h:154
Definition: alg_id.cpp:13
size_t crypto_box_messagebytes_max()
Definition: sodium.h:721
size_t crypto_stream_messagebytes_max()
Definition: sodium.h:1295
Sodium_Constants
Definition: sodium.h:21
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_secretbox_messagebytes_max()
Definition: sodium.h:301
size_t crypto_stream_chacha20_messagebytes_max()
Definition: sodium.h:1155
void crypto_aead_chacha20poly1305_ietf_keygen(uint8_t k[32])
Definition: sodium.h:442
size_t crypto_stream_salsa20_keybytes()
Definition: sodium.h:1254
size_t crypto_onetimeauth_bytes()
Definition: sodium.h:1084
size_t crypto_sign_seedbytes()
Definition: sodium.h:1398
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:821
size_t crypto_hash_sha256_bytes()
Definition: sodium.h:939
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_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:1434
void crypto_secretbox_keygen(uint8_t k[32])
Definition: sodium.h:341
size_t crypto_box_curve25519xsalsa20poly1305_noncebytes()
Definition: sodium.h:621
size_t crypto_stream_xsalsa20_messagebytes_max()
Definition: sodium.h:988
void crypto_auth_hmacsha512256_keygen(uint8_t k[32])
Definition: sodium.h:907
int crypto_auth_hmacsha512_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:73
size_t crypto_auth_hmacsha512_keybytes()
Definition: sodium.h:864
size_t crypto_secretbox_xsalsa20poly1305_keybytes()
Definition: sodium.h:244
int crypto_sign_ed25519_keypair(uint8_t pk[32], uint8_t sk[64])
int randombytes_close()
Definition: sodium.h:230
const char * randombytes_implementation_name()
Definition: sodium.h:232
size_t crypto_sign_ed25519_secretkeybytes()
Definition: sodium.h:1361
size_t crypto_core_hsalsa20_inputbytes()
Definition: sodium.h:1020
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:320
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:328
size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes()
Definition: sodium.h:611
size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes()
Definition: sodium.h:606
size_t crypto_aead_xchacha20poly1305_ietf_npubbytes()
Definition: sodium.h:534
void randombytes(uint8_t buf[], size_t buf_len)
Definition: sodium.h:237
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[])
size_t crypto_stream_noncebytes()
Definition: sodium.h:1293
int crypto_sign_ed25519_verify_detached(const uint8_t sig[], const uint8_t msg[], size_t msg_len, const uint8_t pk[32])
int sodium_is_zero(const uint8_t nonce[], size_t nlen)
void crypto_auth_keygen(uint8_t k[])
Definition: sodium.h:932
size_t crypto_sign_ed25519_messagebytes_max()
Definition: sodium.h:1366
int crypto_auth(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium.h:920
size_t crypto_box_noncebytes()
Definition: sodium.h:711
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[])
size_t crypto_box_seedbytes()
Definition: sodium.h:696
size_t crypto_aead_chacha20poly1305_keybytes()
Definition: sodium.h:447
uint32_t randombytes_uniform(uint32_t upper_bound)
size_t crypto_stream_salsa20_messagebytes_max()
Definition: sodium.h:1264
const char * crypto_hash_primitive()
Definition: sodium.h:1051
int crypto_stream_xchacha20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
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[])
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:792
const char * crypto_onetimeauth_primitive()
Definition: sodium.h:1088
const char * crypto_box_primitive()
Definition: sodium.h:731
size_t crypto_stream_chacha20_ietf_messagebytes_max()
Definition: sodium.h:1190
size_t crypto_auth_hmacsha512256_bytes()
Definition: sodium.h:885
int crypto_verify_32(const uint8_t x[32], const uint8_t y[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:685
size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes()
Definition: sodium.h:636
size_t crypto_auth_hmacsha512256_keybytes()
Definition: sodium.h:890
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:1441
size_t crypto_aead_xchacha20poly1305_ietf_keybytes()
Definition: sodium.h:524
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:846
size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes()
Definition: sodium.h:616
size_t crypto_secretbox_xsalsa20poly1305_macbytes()
Definition: sodium.h:254
const char * crypto_stream_primitive()
Definition: sodium.h:1297
int crypto_stream_salsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int crypto_auth_hmacsha256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t crypto_shorthash_siphash24_bytes()
Definition: sodium.h:1318
size_t crypto_core_hsalsa20_constbytes()
Definition: sodium.h:1030
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:1305
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:676
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])
Definition: sodium_box.cpp:57
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[32])
Definition: sodium_box.cpp:12
size_t crypto_shorthash_keybytes()
Definition: sodium.h:1329
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:828
size_t crypto_onetimeauth_keybytes()
Definition: sodium.h:1086
int crypto_auth_hmacsha512256_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:99
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_stream_xchacha20_noncebytes()
Definition: sodium.h:1222
int crypto_scalarmult_base(uint8_t out[], const uint8_t scalar[])
Definition: sodium.h:1133
size_t crypto_aead_chacha20poly1305_ietf_nsecbytes()
Definition: sodium.h:377
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[])
size_t crypto_hash_bytes()
Definition: sodium.h:1041
size_t crypto_stream_xsalsa20_noncebytes()
Definition: sodium.h:983
size_t crypto_stream_xchacha20_keybytes()
Definition: sodium.h:1217
int crypto_box_curve25519xsalsa20poly1305_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:29
int sodium_init()
Definition: sodium.h:160
int crypto_shorthash_siphash24(uint8_t out[8], const uint8_t in[], size_t in_len, const uint8_t key[16])
Definition: sodium_auth.cpp:29
size_t crypto_secretbox_zerobytes()
Definition: sodium.h:346
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_sign_ed25519_publickeybytes()
Definition: sodium.h:1356
int crypto_stream_xsalsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])