1c06512ba262135a62d29da37f5e5a862e466542
[trex.git] /
1 #ifndef crypto_stream_salsa20_H
2 #define crypto_stream_salsa20_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 #include <stdint.h>
14 #include "export.h"
15
16 #ifdef __cplusplus
17 # if __GNUC__
18 #  pragma GCC diagnostic ignored "-Wlong-long"
19 # endif
20 extern "C" {
21 #endif
22
23 #define crypto_stream_salsa20_KEYBYTES 32U
24 SODIUM_EXPORT
25 size_t crypto_stream_salsa20_keybytes(void);
26
27 #define crypto_stream_salsa20_NONCEBYTES 8U
28 SODIUM_EXPORT
29 size_t crypto_stream_salsa20_noncebytes(void);
30
31 SODIUM_EXPORT
32 int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
33                           const unsigned char *n, const unsigned char *k);
34
35 SODIUM_EXPORT
36 int crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
37                               unsigned long long mlen, const unsigned char *n,
38                               const unsigned char *k);
39
40 SODIUM_EXPORT
41 int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m,
42                                  unsigned long long mlen,
43                                  const unsigned char *n, uint64_t ic,
44                                  const unsigned char *k);
45 #ifdef __cplusplus
46 }
47 #endif
48
49 #endif