crypto_stream_salsa2012.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef crypto_stream_salsa2012_H
  2. #define crypto_stream_salsa2012_H
  3. /*
  4. * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
  5. * While it provides some protection against eavesdropping, it does NOT
  6. * provide any security against active attacks.
  7. * Unless you know what you're doing, what you are looking for is probably
  8. * the crypto_box functions.
  9. */
  10. #include <stddef.h>
  11. #include "export.h"
  12. #ifdef __cplusplus
  13. # ifdef __GNUC__
  14. # pragma GCC diagnostic ignored "-Wlong-long"
  15. # endif
  16. extern "C" {
  17. #endif
  18. #define crypto_stream_salsa2012_KEYBYTES 32U
  19. SODIUM_EXPORT
  20. size_t crypto_stream_salsa2012_keybytes(void);
  21. #define crypto_stream_salsa2012_NONCEBYTES 8U
  22. SODIUM_EXPORT
  23. size_t crypto_stream_salsa2012_noncebytes(void);
  24. #define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
  25. SODIUM_EXPORT
  26. size_t crypto_stream_salsa2012_messagebytes_max(void);
  27. SODIUM_EXPORT
  28. int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
  29. const unsigned char *n, const unsigned char *k)
  30. __attribute__ ((nonnull));
  31. SODIUM_EXPORT
  32. int crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m,
  33. unsigned long long mlen, const unsigned char *n,
  34. const unsigned char *k)
  35. __attribute__ ((nonnull));
  36. SODIUM_EXPORT
  37. void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
  38. __attribute__ ((nonnull));
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif