diff --git a/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h index 4a0e1455..77c9e3af 100644 --- a/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +++ b/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h @@ -12,8 +12,6 @@ extern "C" { #endif -/* -- NaCl compatibility interface ; Requires padding -- */ - #define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U SODIUM_EXPORT size_t crypto_box_curve25519xsalsa20poly1305_seedbytes(void); @@ -38,6 +36,27 @@ size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void); +/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */ +#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \ + (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES) + +SODIUM_EXPORT +int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk, + unsigned char *sk, + const unsigned char *seed); + +SODIUM_EXPORT +int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk, + unsigned char *sk); + +SODIUM_EXPORT +int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k, + const unsigned char *pk, + const unsigned char *sk) + __attribute__ ((warn_unused_result)); + +/* -- NaCl compatibility interface ; Requires padding -- */ + #define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U SODIUM_EXPORT size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void); @@ -48,9 +67,6 @@ size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void); SODIUM_EXPORT size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void); -#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \ - (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_ZEROBYTES) - SODIUM_EXPORT int crypto_box_curve25519xsalsa20poly1305(unsigned char *c, const unsigned char *m, @@ -69,21 +85,6 @@ int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m, const unsigned char *sk) __attribute__ ((warn_unused_result)); -SODIUM_EXPORT -int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk, - unsigned char *sk, - const unsigned char *seed); - -SODIUM_EXPORT -int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk, - unsigned char *sk); - -SODIUM_EXPORT -int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k, - const unsigned char *pk, - const unsigned char *sk) - __attribute__ ((warn_unused_result)); - SODIUM_EXPORT int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c, const unsigned char *m, diff --git a/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h index 04006a03..471271fd 100644 --- a/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +++ b/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h @@ -24,8 +24,9 @@ size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_secretbox_xsalsa20poly1305_macbytes(void); +/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */ #define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \ - (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_ZEROBYTES) + (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES) SODIUM_EXPORT int crypto_secretbox_xsalsa20poly1305(unsigned char *c,