From 2d380c97f322a2880466cbb47fe2d3139f79668b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 6 Jan 2015 18:28:07 +0100 Subject: [PATCH] Move prototypes of functions requiring padding together --- src/libsodium/include/sodium/crypto_box.h | 2 +- .../include/sodium/crypto_secretbox.h | 38 ++++++++++--------- src/libsodium/include/sodium/randombytes.h | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/libsodium/include/sodium/crypto_box.h b/src/libsodium/include/sodium/crypto_box.h index cf29f6c1..8fff2d27 100644 --- a/src/libsodium/include/sodium/crypto_box.h +++ b/src/libsodium/include/sodium/crypto_box.h @@ -106,7 +106,7 @@ int crypto_box_open_detached_afternm(unsigned char *m, const unsigned char *c, unsigned long long clen, const unsigned char *n, const unsigned char *k); -/* -- Compatibility layer with NaCl -- */ +/* -- NaCl compatibility interface ; Requires padding -- */ #define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES SODIUM_EXPORT diff --git a/src/libsodium/include/sodium/crypto_secretbox.h b/src/libsodium/include/sodium/crypto_secretbox.h index 5027b06c..e0d6969e 100644 --- a/src/libsodium/include/sodium/crypto_secretbox.h +++ b/src/libsodium/include/sodium/crypto_secretbox.h @@ -21,14 +21,6 @@ size_t crypto_secretbox_keybytes(void); SODIUM_EXPORT size_t crypto_secretbox_noncebytes(void); -#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES -SODIUM_EXPORT -size_t crypto_secretbox_zerobytes(void); - -#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES -SODIUM_EXPORT -size_t crypto_secretbox_boxzerobytes(void); - #define crypto_secretbox_MACBYTES crypto_secretbox_xsalsa20poly1305_MACBYTES SODIUM_EXPORT size_t crypto_secretbox_macbytes(void); @@ -37,16 +29,6 @@ size_t crypto_secretbox_macbytes(void); SODIUM_EXPORT const char *crypto_secretbox_primitive(void); -SODIUM_EXPORT -int crypto_secretbox(unsigned char *c, const unsigned char *m, - unsigned long long mlen, const unsigned char *n, - const unsigned char *k); - -SODIUM_EXPORT -int crypto_secretbox_open(unsigned char *m, const unsigned char *c, - unsigned long long clen, const unsigned char *n, - const unsigned char *k); - SODIUM_EXPORT int crypto_secretbox_easy(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, @@ -71,6 +53,26 @@ int crypto_secretbox_open_detached(unsigned char *m, unsigned long long clen, const unsigned char *n, const unsigned char *k); + +/* -- NaCl compatibility interface ; Requires padding -- */ + +#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES +SODIUM_EXPORT +size_t crypto_secretbox_zerobytes(void); + +#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES +SODIUM_EXPORT +size_t crypto_secretbox_boxzerobytes(void); + +SODIUM_EXPORT +int crypto_secretbox(unsigned char *c, const unsigned char *m, + unsigned long long mlen, const unsigned char *n, + const unsigned char *k); + +SODIUM_EXPORT +int crypto_secretbox_open(unsigned char *m, const unsigned char *c, + unsigned long long clen, const unsigned char *n, + const unsigned char *k); #ifdef __cplusplus } #endif diff --git a/src/libsodium/include/sodium/randombytes.h b/src/libsodium/include/sodium/randombytes.h index 4d07cd59..d92c1a4d 100644 --- a/src/libsodium/include/sodium/randombytes.h +++ b/src/libsodium/include/sodium/randombytes.h @@ -46,7 +46,7 @@ int randombytes_set_implementation(randombytes_implementation *impl); SODIUM_EXPORT const char *randombytes_implementation_name(void); -/* -- Compatibility layer with NaCl -- */ +/* -- NaCl compatibility interface -- */ SODIUM_EXPORT void randombytes(unsigned char * const buf, const unsigned long long buf_len);