1#ifndef crypto_box_curve25519xsalsa20poly1305_H 2#define crypto_box_curve25519xsalsa20poly1305_H 3 4#include <stddef.h> 5#include "crypto_stream_xsalsa20.h" 6#include "export.h" 7 8#ifdef __cplusplus 9# ifdef __GNUC__ 10# pragma GCC diagnostic ignored "-Wlong-long" 11# endif 12extern "C" { 13#endif 14 15#define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U 16SODIUM_EXPORT 17size_t crypto_box_curve25519xsalsa20poly1305_seedbytes(void); 18 19#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U 20SODIUM_EXPORT 21size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void); 22 23#define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES 32U 24SODIUM_EXPORT 25size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void); 26 27#define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES 32U 28SODIUM_EXPORT 29size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void); 30 31#define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES 24U 32SODIUM_EXPORT 33size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void); 34 35#define crypto_box_curve25519xsalsa20poly1305_MACBYTES 16U 36SODIUM_EXPORT 37size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void); 38 39/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */ 40#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \ 41 (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES) 42SODIUM_EXPORT 43size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void); 44 45SODIUM_EXPORT 46int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk, 47 unsigned char *sk, 48 const unsigned char *seed); 49 50SODIUM_EXPORT 51int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk, 52 unsigned char *sk); 53 54SODIUM_EXPORT 55int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k, 56 const unsigned char *pk, 57 const unsigned char *sk) 58 __attribute__ ((warn_unused_result)); 59 60/* -- NaCl compatibility interface ; Requires padding -- */ 61 62#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U 63SODIUM_EXPORT 64size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void); 65 66#define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES \ 67 (crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES + \ 68 crypto_box_curve25519xsalsa20poly1305_MACBYTES) 69SODIUM_EXPORT 70size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void); 71 72SODIUM_EXPORT 73int crypto_box_curve25519xsalsa20poly1305(unsigned char *c, 74 const unsigned char *m, 75 unsigned long long mlen, 76 const unsigned char *n, 77 const unsigned char *pk, 78 const unsigned char *sk) 79 __attribute__ ((warn_unused_result)); 80 81SODIUM_EXPORT 82int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m, 83 const unsigned char *c, 84 unsigned long long clen, 85 const unsigned char *n, 86 const unsigned char *pk, 87 const unsigned char *sk) 88 __attribute__ ((warn_unused_result)); 89 90SODIUM_EXPORT 91int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c, 92 const unsigned char *m, 93 unsigned long long mlen, 94 const unsigned char *n, 95 const unsigned char *k); 96 97SODIUM_EXPORT 98int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m, 99 const unsigned char *c, 100 unsigned long long clen, 101 const unsigned char *n, 102 const unsigned char *k) 103 __attribute__ ((warn_unused_result)); 104 105#ifdef __cplusplus 106} 107#endif 108 109#endif 110