gnunet-android

GNUnet for Android
Log | Files | Refs | README

crypto_stream_salsa2012.h (1532B)


      1 #ifndef crypto_stream_salsa2012_H
      2 #define crypto_stream_salsa2012_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 "export.h"
     14 
     15 #ifdef __cplusplus
     16 # ifdef __GNUC__
     17 #  pragma GCC diagnostic ignored "-Wlong-long"
     18 # endif
     19 extern "C" {
     20 #endif
     21 
     22 #define crypto_stream_salsa2012_KEYBYTES 32U
     23 SODIUM_EXPORT
     24 size_t crypto_stream_salsa2012_keybytes(void);
     25 
     26 #define crypto_stream_salsa2012_NONCEBYTES 8U
     27 SODIUM_EXPORT
     28 size_t crypto_stream_salsa2012_noncebytes(void);
     29 
     30 #define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
     31 SODIUM_EXPORT
     32 size_t crypto_stream_salsa2012_messagebytes_max(void);
     33 
     34 SODIUM_EXPORT
     35 int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
     36                             const unsigned char *n, const unsigned char *k)
     37             __attribute__ ((nonnull));
     38 
     39 SODIUM_EXPORT
     40 int crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m,
     41                                 unsigned long long mlen, const unsigned char *n,
     42                                 const unsigned char *k)
     43             __attribute__ ((nonnull));
     44 
     45 SODIUM_EXPORT
     46 void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
     47             __attribute__ ((nonnull));
     48 
     49 #ifdef __cplusplus
     50 }
     51 #endif
     52 
     53 #endif