crypto_stream.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef crypto_stream_H
  2. #define crypto_stream_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 "crypto_stream_xsalsa20.h"
  12. #include "export.h"
  13. #ifdef __cplusplus
  14. # ifdef __GNUC__
  15. # pragma GCC diagnostic ignored "-Wlong-long"
  16. # endif
  17. extern "C" {
  18. #endif
  19. #define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
  20. SODIUM_EXPORT
  21. size_t crypto_stream_keybytes(void);
  22. #define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
  23. SODIUM_EXPORT
  24. size_t crypto_stream_noncebytes(void);
  25. #define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX
  26. SODIUM_EXPORT
  27. size_t crypto_stream_messagebytes_max(void);
  28. #define crypto_stream_PRIMITIVE "xsalsa20"
  29. SODIUM_EXPORT
  30. const char *crypto_stream_primitive(void);
  31. SODIUM_EXPORT
  32. int crypto_stream(unsigned char *c, unsigned long long clen,
  33. const unsigned char *n, const unsigned char *k)
  34. __attribute__ ((nonnull));
  35. SODIUM_EXPORT
  36. int crypto_stream_xor(unsigned char *c, const unsigned char *m,
  37. unsigned long long mlen, const unsigned char *n,
  38. const unsigned char *k)
  39. __attribute__ ((nonnull));
  40. SODIUM_EXPORT
  41. void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES])
  42. __attribute__ ((nonnull));
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif