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