Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/sodium/crypto_stream_xchacha20.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_stream_xchacha20_H
0002 #define crypto_stream_xchacha20_H
0003 
0004 /*
0005  *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
0006  *  While it provides some protection against eavesdropping, it does NOT
0007  *  provide any security against active attacks.
0008  *  Unless you know what you're doing, what you are looking for is probably
0009  *  the crypto_box functions.
0010  */
0011 
0012 #include <stddef.h>
0013 #include <stdint.h>
0014 #include "export.h"
0015 
0016 #ifdef __cplusplus
0017 # ifdef __GNUC__
0018 #  pragma GCC diagnostic ignored "-Wlong-long"
0019 # endif
0020 extern "C" {
0021 #endif
0022 
0023 #define crypto_stream_xchacha20_KEYBYTES 32U
0024 SODIUM_EXPORT
0025 size_t crypto_stream_xchacha20_keybytes(void);
0026 
0027 #define crypto_stream_xchacha20_NONCEBYTES 24U
0028 SODIUM_EXPORT
0029 size_t crypto_stream_xchacha20_noncebytes(void);
0030 
0031 #define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
0032 SODIUM_EXPORT
0033 size_t crypto_stream_xchacha20_messagebytes_max(void);
0034 
0035 SODIUM_EXPORT
0036 int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
0037                             const unsigned char *n, const unsigned char *k)
0038             __attribute__ ((nonnull));
0039 
0040 SODIUM_EXPORT
0041 int crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m,
0042                                 unsigned long long mlen, const unsigned char *n,
0043                                 const unsigned char *k)
0044             __attribute__ ((nonnull));
0045 
0046 SODIUM_EXPORT
0047 int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m,
0048                                    unsigned long long mlen,
0049                                    const unsigned char *n, uint64_t ic,
0050                                    const unsigned char *k)
0051             __attribute__ ((nonnull));
0052 
0053 SODIUM_EXPORT
0054 void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES])
0055             __attribute__ ((nonnull));
0056 
0057 #ifdef __cplusplus
0058 }
0059 #endif
0060 
0061 #endif