1 #ifndef crypto_stream_H
2 #define crypto_stream_H
3 
4 /*
5  *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6  *  While it provides some protection against eavesdropping, it does NOT
7  *  provide any security against active attacks.
8  *  Unless you know what you're doing, what you are looking for is probably
9  *  the crypto_box functions.
10  */
11 
12 #include <stddef.h>
13 
14 #include "crypto_stream_xsalsa20.h"
15 #include "export.h"
16 
17 #ifdef __cplusplus
18 # ifdef __GNUC__
19 #  pragma GCC diagnostic ignored "-Wlong-long"
20 # endif
21 extern "C" {
22 #endif
23 
24 #define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
25 SODIUM_EXPORT
26 size_t  crypto_stream_keybytes(void);
27 
28 #define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
29 SODIUM_EXPORT
30 size_t  crypto_stream_noncebytes(void);
31 
32 #define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX
33 SODIUM_EXPORT
34 size_t  crypto_stream_messagebytes_max(void);
35 
36 #define crypto_stream_PRIMITIVE "xsalsa20"
37 SODIUM_EXPORT
38 const char *crypto_stream_primitive(void);
39 
40 SODIUM_EXPORT
41 int crypto_stream(unsigned char *c, unsigned long long clen,
42                   const unsigned char *n, const unsigned char *k);
43 
44 SODIUM_EXPORT
45 int crypto_stream_xor(unsigned char *c, const unsigned char *m,
46                       unsigned long long mlen, const unsigned char *n,
47                       const unsigned char *k);
48 
49 SODIUM_EXPORT
50 void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]);
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #endif
57