Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/sodium/crypto_secretbox_xsalsa20poly1305.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_xsalsa20poly1305_H
0002 #define crypto_secretbox_xsalsa20poly1305_H
0003 
0004 #include <stddef.h>
0005 #include "crypto_stream_xsalsa20.h"
0006 #include "export.h"
0007 
0008 #ifdef __cplusplus
0009 # ifdef __GNUC__
0010 #  pragma GCC diagnostic ignored "-Wlong-long"
0011 # endif
0012 extern "C" {
0013 #endif
0014 
0015 #define crypto_secretbox_xsalsa20poly1305_KEYBYTES 32U
0016 SODIUM_EXPORT
0017 size_t crypto_secretbox_xsalsa20poly1305_keybytes(void);
0018 
0019 #define crypto_secretbox_xsalsa20poly1305_NONCEBYTES 24U
0020 SODIUM_EXPORT
0021 size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void);
0022 
0023 #define crypto_secretbox_xsalsa20poly1305_MACBYTES 16U
0024 SODIUM_EXPORT
0025 size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
0026 
0027 /* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
0028 #define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \
0029     (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES)
0030 SODIUM_EXPORT
0031 size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void);
0032 
0033 SODIUM_EXPORT
0034 int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
0035                                       const unsigned char *m,
0036                                       unsigned long long mlen,
0037                                       const unsigned char *n,
0038                                       const unsigned char *k)
0039             __attribute__ ((nonnull(1, 4, 5)));
0040 
0041 SODIUM_EXPORT
0042 int crypto_secretbox_xsalsa20poly1305_open(unsigned char *m,
0043                                            const unsigned char *c,
0044                                            unsigned long long clen,
0045                                            const unsigned char *n,
0046                                            const unsigned char *k)
0047             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
0048 
0049 SODIUM_EXPORT
0050 void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES])
0051             __attribute__ ((nonnull));
0052 
0053 /* -- NaCl compatibility interface ; Requires padding -- */
0054 
0055 #define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U
0056 SODIUM_EXPORT
0057 size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void);
0058 
0059 #define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \
0060     (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \
0061      crypto_secretbox_xsalsa20poly1305_MACBYTES)
0062 SODIUM_EXPORT
0063 size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void);
0064 
0065 #ifdef __cplusplus
0066 }
0067 #endif
0068 
0069 #endif