Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/sodium/crypto_secretbox.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef crypto_secretbox_H
0002 #define crypto_secretbox_H
0003 
0004 #include <stddef.h>
0005 
0006 #include "crypto_secretbox_xsalsa20poly1305.h"
0007 #include "export.h"
0008 
0009 #ifdef __cplusplus
0010 # ifdef __GNUC__
0011 #  pragma GCC diagnostic ignored "-Wlong-long"
0012 # endif
0013 extern "C" {
0014 #endif
0015 
0016 #define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES
0017 SODIUM_EXPORT
0018 size_t  crypto_secretbox_keybytes(void);
0019 
0020 #define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
0021 SODIUM_EXPORT
0022 size_t  crypto_secretbox_noncebytes(void);
0023 
0024 #define crypto_secretbox_MACBYTES crypto_secretbox_xsalsa20poly1305_MACBYTES
0025 SODIUM_EXPORT
0026 size_t  crypto_secretbox_macbytes(void);
0027 
0028 #define crypto_secretbox_PRIMITIVE "xsalsa20poly1305"
0029 SODIUM_EXPORT
0030 const char *crypto_secretbox_primitive(void);
0031 
0032 #define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
0033 SODIUM_EXPORT
0034 size_t crypto_secretbox_messagebytes_max(void);
0035 
0036 SODIUM_EXPORT
0037 int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
0038                           unsigned long long mlen, const unsigned char *n,
0039                           const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
0040 
0041 SODIUM_EXPORT
0042 int crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
0043                                unsigned long long clen, const unsigned char *n,
0044                                const unsigned char *k)
0045             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
0046 
0047 SODIUM_EXPORT
0048 int crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
0049                               const unsigned char *m,
0050                               unsigned long long mlen,
0051                               const unsigned char *n,
0052                               const unsigned char *k)
0053             __attribute__ ((nonnull(1, 2, 5, 6)));
0054 
0055 SODIUM_EXPORT
0056 int crypto_secretbox_open_detached(unsigned char *m,
0057                                    const unsigned char *c,
0058                                    const unsigned char *mac,
0059                                    unsigned long long clen,
0060                                    const unsigned char *n,
0061                                    const unsigned char *k)
0062             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
0063 
0064 SODIUM_EXPORT
0065 void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES])
0066             __attribute__ ((nonnull));
0067 
0068 /* -- NaCl compatibility interface ; Requires padding -- */
0069 
0070 #define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
0071 SODIUM_EXPORT
0072 size_t  crypto_secretbox_zerobytes(void);
0073 
0074 #define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
0075 SODIUM_EXPORT
0076 size_t  crypto_secretbox_boxzerobytes(void);
0077 
0078 SODIUM_EXPORT
0079 int crypto_secretbox(unsigned char *c, const unsigned char *m,
0080                      unsigned long long mlen, const unsigned char *n,
0081                      const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
0082 
0083 SODIUM_EXPORT
0084 int crypto_secretbox_open(unsigned char *m, const unsigned char *c,
0085                           unsigned long long clen, const unsigned char *n,
0086                           const unsigned char *k)
0087             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
0088 
0089 #ifdef __cplusplus
0090 }
0091 #endif
0092 
0093 #endif