gnunet-android

GNUnet for Android
Log | Files | Refs | README

crypto_secretbox_xchacha20poly1305.h (2853B)


      1 #ifndef crypto_secretbox_xchacha20poly1305_H
      2 #define crypto_secretbox_xchacha20poly1305_H
      3 
      4 #include <stddef.h>
      5 #include "crypto_stream_xchacha20.h"
      6 #include "export.h"
      7 
      8 #ifdef __cplusplus
      9 # ifdef __GNUC__
     10 #  pragma GCC diagnostic ignored "-Wlong-long"
     11 # endif
     12 extern "C" {
     13 #endif
     14 
     15 #define crypto_secretbox_xchacha20poly1305_KEYBYTES 32U
     16 SODIUM_EXPORT
     17 size_t crypto_secretbox_xchacha20poly1305_keybytes(void);
     18 
     19 #define crypto_secretbox_xchacha20poly1305_NONCEBYTES 24U
     20 SODIUM_EXPORT
     21 size_t crypto_secretbox_xchacha20poly1305_noncebytes(void);
     22 
     23 #define crypto_secretbox_xchacha20poly1305_MACBYTES 16U
     24 SODIUM_EXPORT
     25 size_t crypto_secretbox_xchacha20poly1305_macbytes(void);
     26 
     27 #define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \
     28     (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
     29 SODIUM_EXPORT
     30 size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void);
     31 
     32 SODIUM_EXPORT
     33 int crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
     34                                             const unsigned char *m,
     35                                             unsigned long long mlen,
     36                                             const unsigned char *n,
     37                                             const unsigned char *k)
     38             __attribute__ ((nonnull(1, 4, 5)));
     39 
     40 SODIUM_EXPORT
     41 int crypto_secretbox_xchacha20poly1305_open_easy(unsigned char *m,
     42                                                  const unsigned char *c,
     43                                                  unsigned long long clen,
     44                                                  const unsigned char *n,
     45                                                  const unsigned char *k)
     46             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
     47 
     48 SODIUM_EXPORT
     49 int crypto_secretbox_xchacha20poly1305_detached(unsigned char *c,
     50                                                 unsigned char *mac,
     51                                                 const unsigned char *m,
     52                                                 unsigned long long mlen,
     53                                                 const unsigned char *n,
     54                                                 const unsigned char *k)
     55             __attribute__ ((nonnull(1, 2, 5, 6)));
     56 
     57 SODIUM_EXPORT
     58 int crypto_secretbox_xchacha20poly1305_open_detached(unsigned char *m,
     59                                                      const unsigned char *c,
     60                                                      const unsigned char *mac,
     61                                                      unsigned long long clen,
     62                                                      const unsigned char *n,
     63                                                      const unsigned char *k)
     64             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
     65 
     66 #ifdef __cplusplus
     67 }
     68 #endif
     69 
     70 #endif