libsodium (1.0.19)

(root)/
include/
sodium/
crypto_stream.h
       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              __attribute__ ((nonnull));
      44  
      45  SODIUM_EXPORT
      46  int crypto_stream_xor(unsigned char *c, const unsigned char *m,
      47                        unsigned long long mlen, const unsigned char *n,
      48                        const unsigned char *k)
      49              __attribute__ ((nonnull));
      50  
      51  SODIUM_EXPORT
      52  void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES])
      53              __attribute__ ((nonnull));
      54  
      55  #ifdef __cplusplus
      56  }
      57  #endif
      58  
      59  #endif