crypto_stream.c 919 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "crypto_stream.h"
  2. #include "randombytes.h"
  3. size_t
  4. crypto_stream_keybytes(void)
  5. {
  6. return crypto_stream_KEYBYTES;
  7. }
  8. size_t
  9. crypto_stream_noncebytes(void)
  10. {
  11. return crypto_stream_NONCEBYTES;
  12. }
  13. size_t
  14. crypto_stream_messagebytes_max(void)
  15. {
  16. return crypto_stream_MESSAGEBYTES_MAX;
  17. }
  18. const char *
  19. crypto_stream_primitive(void)
  20. {
  21. return crypto_stream_PRIMITIVE;
  22. }
  23. int
  24. crypto_stream(unsigned char *c, unsigned long long clen,
  25. const unsigned char *n, const unsigned char *k)
  26. {
  27. return crypto_stream_xsalsa20(c, clen, n, k);
  28. }
  29. int
  30. crypto_stream_xor(unsigned char *c, const unsigned char *m,
  31. unsigned long long mlen, const unsigned char *n,
  32. const unsigned char *k)
  33. {
  34. return crypto_stream_xsalsa20_xor(c, m, mlen, n, k);
  35. }
  36. void
  37. crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES])
  38. {
  39. randombytes_buf(k, crypto_stream_KEYBYTES);
  40. }