Merge branch 'master' of github.com:jedisct1/libsodium

* 'master' of github.com:jedisct1/libsodium:
  Simplify
  Just a simple script to match constants with functions
  + emscripten-wasm.sh
  Update the exported list of JS symbols
  Add *_messagebytes_max() wrappers
  Revert "wasm tests: skip over *.asm.js files"
  wasm tests: skip over *.asm.js files
  [Findsodium.cmake] DON'T OVERWRITE LIBRARY SUFFIXES (#576)
  Revert "+ sodium_alloc_overhead()"
  + sodium_alloc_overhead()
  Remove TOTAL_MEMORY from wasm builds
  Include private/common.h for COMPILER_ASSERT
  Sort
  Node need for --expose-wasm any more with recent nodejs versions
This commit is contained in:
Frank Denis
2017-08-04 17:43:23 +02:00
53 changed files with 251 additions and 34 deletions
+2
View File
@@ -130,6 +130,7 @@ elseif (WIN32)
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}
)
if (NOT sodium_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(sodium_DLL_DEBUG libsodium
HINTS ${sodium_DIR}
@@ -139,6 +140,7 @@ elseif (WIN32)
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}
)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK})
endif()
elseif(_GCC_COMPATIBLE)
+1
View File
@@ -9,6 +9,7 @@ EXTRA_DIST = \
android-x86.sh \
android-x86_64.sh \
emscripten.sh \
emscripten-wasm.sh \
ios.sh \
msys2-win32.sh \
msys2-win64.sh \
+35 -16
View File
@@ -11,6 +11,7 @@ _crypto_aead_aes256gcm_encrypt_detached_afternm 0 0
_crypto_aead_aes256gcm_is_available 0 0
_crypto_aead_aes256gcm_keybytes 0 0
_crypto_aead_aes256gcm_keygen 0 0
_crypto_aead_aes256gcm_messagebytes_max 0 0
_crypto_aead_aes256gcm_npubbytes 0 0
_crypto_aead_aes256gcm_nsecbytes 0 0
_crypto_aead_aes256gcm_statebytes 0 0
@@ -25,13 +26,15 @@ _crypto_aead_chacha20poly1305_ietf_decrypt_detached 1 1
_crypto_aead_chacha20poly1305_ietf_encrypt 1 1
_crypto_aead_chacha20poly1305_ietf_encrypt_detached 1 1
_crypto_aead_chacha20poly1305_ietf_keybytes 1 1
_crypto_aead_chacha20poly1305_ietf_keygen 1 1
_crypto_aead_chacha20poly1305_ietf_messagebytes_max 0 0
_crypto_aead_chacha20poly1305_ietf_npubbytes 1 1
_crypto_aead_chacha20poly1305_ietf_nsecbytes 1 1
_crypto_aead_chacha20poly1305_keybytes 1 1
_crypto_aead_chacha20poly1305_keygen 1 1
_crypto_aead_chacha20poly1305_messagebytes_max 0 0
_crypto_aead_chacha20poly1305_npubbytes 1 1
_crypto_aead_chacha20poly1305_nsecbytes 1 1
_crypto_aead_chacha20poly1305_ietf_keygen 1 1
_crypto_aead_chacha20poly1305_keygen 1 1
_crypto_aead_xchacha20poly1305_ietf_abytes 1 1
_crypto_aead_xchacha20poly1305_ietf_decrypt 1 1
_crypto_aead_xchacha20poly1305_ietf_decrypt_detached 1 1
@@ -39,6 +42,7 @@ _crypto_aead_xchacha20poly1305_ietf_encrypt 1 1
_crypto_aead_xchacha20poly1305_ietf_encrypt_detached 1 1
_crypto_aead_xchacha20poly1305_ietf_keybytes 1 1
_crypto_aead_xchacha20poly1305_ietf_keygen 1 1
_crypto_aead_xchacha20poly1305_ietf_messagebytes_max 0 0
_crypto_aead_xchacha20poly1305_ietf_npubbytes 1 1
_crypto_aead_xchacha20poly1305_ietf_nsecbytes 1 1
_crypto_auth 1 1
@@ -87,6 +91,7 @@ _crypto_box_curve25519xchacha20poly1305_easy 0 1
_crypto_box_curve25519xchacha20poly1305_easy_afternm 0 1
_crypto_box_curve25519xchacha20poly1305_keypair 0 1
_crypto_box_curve25519xchacha20poly1305_macbytes 0 1
_crypto_box_curve25519xchacha20poly1305_messagebytes_max 0 0
_crypto_box_curve25519xchacha20poly1305_noncebytes 0 1
_crypto_box_curve25519xchacha20poly1305_open_detached 0 1
_crypto_box_curve25519xchacha20poly1305_open_detached_afternm 0 1
@@ -106,6 +111,7 @@ _crypto_box_curve25519xsalsa20poly1305_beforenmbytes 0 1
_crypto_box_curve25519xsalsa20poly1305_boxzerobytes 0 1
_crypto_box_curve25519xsalsa20poly1305_keypair 0 1
_crypto_box_curve25519xsalsa20poly1305_macbytes 0 1
_crypto_box_curve25519xsalsa20poly1305_messagebytes_max 0 0
_crypto_box_curve25519xsalsa20poly1305_noncebytes 0 1
_crypto_box_curve25519xsalsa20poly1305_open 0 1
_crypto_box_curve25519xsalsa20poly1305_open_afternm 0 1
@@ -120,6 +126,7 @@ _crypto_box_easy 1 1
_crypto_box_easy_afternm 1 1
_crypto_box_keypair 1 1
_crypto_box_macbytes 1 1
_crypto_box_messagebytes_max 0 0
_crypto_box_noncebytes 1 1
_crypto_box_open 0 1
_crypto_box_open_afternm 0 1
@@ -247,21 +254,22 @@ _crypto_onetimeauth_update 0 1
_crypto_onetimeauth_verify 0 1
_crypto_pwhash 0 1
_crypto_pwhash_alg_argon2i13 0 1
_crypto_pwhash_alg_argon2id13 0 1
_crypto_pwhash_alg_default 0 1
_crypto_pwhash_argon2i 0 1
_crypto_pwhash_argon2i_alg_argon2i13 0 1
_crypto_pwhash_argon2i_bytes_max 0 1
_crypto_pwhash_argon2i_bytes_min 0 1
_crypto_pwhash_argon2i_memlimit_interactive 0 1
_crypto_pwhash_argon2i_memlimit_moderate 0 1
_crypto_pwhash_argon2i_memlimit_sensitive 0 1
_crypto_pwhash_argon2i_memlimit_max 0 1
_crypto_pwhash_argon2i_memlimit_min 0 1
_crypto_pwhash_argon2i_memlimit_moderate 0 1
_crypto_pwhash_argon2i_memlimit_sensitive 0 1
_crypto_pwhash_argon2i_opslimit_interactive 0 1
_crypto_pwhash_argon2i_opslimit_moderate 0 1
_crypto_pwhash_argon2i_opslimit_sensitive 0 1
_crypto_pwhash_argon2i_opslimit_max 0 1
_crypto_pwhash_argon2i_opslimit_min 0 1
_crypto_pwhash_argon2i_opslimit_moderate 0 1
_crypto_pwhash_argon2i_opslimit_sensitive 0 1
_crypto_pwhash_argon2i_passwd_max 0 1
_crypto_pwhash_argon2i_passwd_min 0 1
_crypto_pwhash_argon2i_saltbytes 0 1
@@ -269,7 +277,6 @@ _crypto_pwhash_argon2i_str 0 1
_crypto_pwhash_argon2i_str_verify 0 1
_crypto_pwhash_argon2i_strbytes 0 1
_crypto_pwhash_argon2i_strprefix 0 1
_crypto_pwhash_alg_argon2id13 0 1
_crypto_pwhash_argon2id 0 1
_crypto_pwhash_argon2id_alg_argon2id13 0 1
_crypto_pwhash_argon2id_bytes_max 0 1
@@ -308,24 +315,24 @@ _crypto_pwhash_passwd_min 1 1
_crypto_pwhash_primitive 0 1
_crypto_pwhash_saltbytes 0 1
_crypto_pwhash_scryptsalsa208sha256 0 1
_crypto_pwhash_scryptsalsa208sha256_bytes_max 0 1
_crypto_pwhash_scryptsalsa208sha256_bytes_min 0 1
_crypto_pwhash_scryptsalsa208sha256_ll 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_max 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_min 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_max 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_min 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive 0 1
_crypto_pwhash_scryptsalsa208sha256_passwd_max 0 1
_crypto_pwhash_scryptsalsa208sha256_passwd_min 0 1
_crypto_pwhash_scryptsalsa208sha256_saltbytes 0 1
_crypto_pwhash_scryptsalsa208sha256_str 0 1
_crypto_pwhash_scryptsalsa208sha256_str_verify 0 1
_crypto_pwhash_scryptsalsa208sha256_strbytes 0 1
_crypto_pwhash_scryptsalsa208sha256_strprefix 0 1
_crypto_pwhash_scryptsalsa208sha256_bytes_max 0 1
_crypto_pwhash_scryptsalsa208sha256_bytes_min 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_max 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_min 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_max 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_min 0 1
_crypto_pwhash_scryptsalsa208sha256_passwd_max 0 1
_crypto_pwhash_scryptsalsa208sha256_passwd_min 0 1
_crypto_pwhash_str 0 1
_crypto_pwhash_str_verify 0 1
_crypto_pwhash_strbytes 0 1
@@ -346,6 +353,7 @@ _crypto_secretbox_easy 1 1
_crypto_secretbox_keybytes 1 1
_crypto_secretbox_keygen 1 1
_crypto_secretbox_macbytes 1 1
_crypto_secretbox_messagebytes_max 0 0
_crypto_secretbox_noncebytes 1 1
_crypto_secretbox_open 0 1
_crypto_secretbox_open_detached 1 1
@@ -355,17 +363,19 @@ _crypto_secretbox_xchacha20poly1305_detached 0 1
_crypto_secretbox_xchacha20poly1305_easy 0 1
_crypto_secretbox_xchacha20poly1305_keybytes 0 1
_crypto_secretbox_xchacha20poly1305_macbytes 0 1
_crypto_secretbox_xchacha20poly1305_messagebytes_max 0 0
_crypto_secretbox_xchacha20poly1305_noncebytes 0 1
_crypto_secretbox_xchacha20poly1305_open_detached 0 1
_crypto_secretbox_xchacha20poly1305_open_easy 0 1
_crypto_secretbox_xsalsa20poly1305 0 1
_crypto_secretbox_xsalsa20poly1305_boxzerobytes 0 1
_crypto_secretbox_xsalsa20poly1305_keybytes 0 1
_crypto_secretbox_xsalsa20poly1305_keygen 0 1
_crypto_secretbox_xsalsa20poly1305_macbytes 0 1
_crypto_secretbox_xsalsa20poly1305_messagebytes_max 0 0
_crypto_secretbox_xsalsa20poly1305_noncebytes 0 1
_crypto_secretbox_xsalsa20poly1305_open 0 1
_crypto_secretbox_xsalsa20poly1305_zerobytes 0 1
_crypto_secretbox_xsalsa20poly1305_keygen 0 1
_crypto_secretbox_zerobytes 0 1
_crypto_shorthash 1 1
_crypto_shorthash_bytes 1 1
@@ -385,6 +395,7 @@ _crypto_sign_ed25519 0 1
_crypto_sign_ed25519_bytes 0 1
_crypto_sign_ed25519_detached 0 1
_crypto_sign_ed25519_keypair 0 1
_crypto_sign_ed25519_messagebytes_max 0 0
_crypto_sign_ed25519_open 0 1
_crypto_sign_ed25519_pk_to_curve25519 1 1
_crypto_sign_ed25519_publickeybytes 0 1
@@ -407,6 +418,7 @@ _crypto_sign_final_create 1 1
_crypto_sign_final_verify 1 1
_crypto_sign_init 1 1
_crypto_sign_keypair 1 1
_crypto_sign_messagebytes_max 0 0
_crypto_sign_open 1 1
_crypto_sign_primitive 0 1
_crypto_sign_publickeybytes 1 1
@@ -429,22 +441,26 @@ _crypto_stream_chacha20 0 1
_crypto_stream_chacha20_ietf 0 1
_crypto_stream_chacha20_ietf_keybytes 0 1
_crypto_stream_chacha20_ietf_keygen 0 1
_crypto_stream_chacha20_ietf_messagebytes_max 0 0
_crypto_stream_chacha20_ietf_noncebytes 0 1
_crypto_stream_chacha20_ietf_xor 0 1
_crypto_stream_chacha20_ietf_xor_ic 0 1
_crypto_stream_chacha20_keybytes 0 1
_crypto_stream_chacha20_keygen 0 1
_crypto_stream_chacha20_messagebytes_max 0 0
_crypto_stream_chacha20_noncebytes 0 1
_crypto_stream_chacha20_xor 0 1
_crypto_stream_chacha20_xor_ic 0 1
_crypto_stream_keybytes 0 1
_crypto_stream_keygen 1 1
_crypto_stream_messagebytes_max 0 0
_crypto_stream_noncebytes 0 1
_crypto_stream_primitive 0 1
_crypto_stream_salsa20 0 1
_crypto_stream_salsa2012 0 1
_crypto_stream_salsa2012_keybytes 0 1
_crypto_stream_salsa2012_keygen 0 1
_crypto_stream_salsa2012_messagebytes_max 0 0
_crypto_stream_salsa2012_noncebytes 0 1
_crypto_stream_salsa2012_xor 0 1
_crypto_stream_salsa208 0 1
@@ -454,12 +470,14 @@ _crypto_stream_salsa208_noncebytes 0 1
_crypto_stream_salsa208_xor 0 1
_crypto_stream_salsa20_keybytes 0 1
_crypto_stream_salsa20_keygen 0 1
_crypto_stream_salsa20_messagebytes_max 0 0
_crypto_stream_salsa20_noncebytes 0 1
_crypto_stream_salsa20_xor 0 1
_crypto_stream_salsa20_xor_ic 0 1
_crypto_stream_xchacha20 0 1
_crypto_stream_xchacha20_keybytes 0 1
_crypto_stream_xchacha20_keygen 0 1
_crypto_stream_xchacha20_messagebytes_max 0 0
_crypto_stream_xchacha20_noncebytes 0 1
_crypto_stream_xchacha20_xor 0 1
_crypto_stream_xchacha20_xor_ic 0 1
@@ -467,6 +485,7 @@ _crypto_stream_xor 0 1
_crypto_stream_xsalsa20 0 1
_crypto_stream_xsalsa20_keybytes 0 1
_crypto_stream_xsalsa20_keygen 0 1
_crypto_stream_xsalsa20_messagebytes_max 0 0
_crypto_stream_xsalsa20_noncebytes 0 1
_crypto_stream_xsalsa20_xor 0 1
_crypto_stream_xsalsa20_xor_ic 0 1
File diff suppressed because one or more lines are too long
@@ -1058,6 +1058,12 @@ crypto_aead_aes256gcm_statebytes(void)
return (sizeof(crypto_aead_aes256gcm_state) + (size_t) 15U) & ~(size_t) 15U;
}
size_t
crypto_aead_aes256gcm_messagebytes_max(void)
{
return crypto_aead_aes256gcm_MESSAGEBYTES_MAX;
}
void
crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
{
@@ -350,6 +350,12 @@ crypto_aead_chacha20poly1305_ietf_abytes(void)
return crypto_aead_chacha20poly1305_ietf_ABYTES;
}
size_t
crypto_aead_chacha20poly1305_ietf_messagebytes_max(void)
{
return crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX;
}
void
crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES])
{
@@ -380,6 +386,12 @@ crypto_aead_chacha20poly1305_abytes(void)
return crypto_aead_chacha20poly1305_ABYTES;
}
size_t
crypto_aead_chacha20poly1305_messagebytes_max(void)
{
return crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX;
}
void
crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES])
{
@@ -147,6 +147,12 @@ crypto_aead_xchacha20poly1305_ietf_abytes(void)
return crypto_aead_xchacha20poly1305_ietf_ABYTES;
}
size_t
crypto_aead_xchacha20poly1305_ietf_messagebytes_max(void)
{
return crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX;
}
void
crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
{
+6
View File
@@ -49,6 +49,12 @@ crypto_box_macbytes(void)
return crypto_box_MACBYTES;
}
size_t
crypto_box_messagebytes_max(void)
{
return crypto_box_MESSAGEBYTES_MAX;
}
const char *
crypto_box_primitive(void)
{
@@ -196,3 +196,9 @@ crypto_box_curve25519xchacha20poly1305_macbytes(void)
{
return crypto_box_curve25519xchacha20poly1305_MACBYTES;
}
size_t
crypto_box_curve25519xchacha20poly1305_messagebytes_max(void)
{
return crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX;
}
@@ -148,3 +148,9 @@ crypto_box_curve25519xsalsa20poly1305_macbytes(void)
{
return crypto_box_curve25519xsalsa20poly1305_MACBYTES;
}
size_t
crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void)
{
return crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX;
}
@@ -32,6 +32,12 @@ crypto_secretbox_macbytes(void)
return crypto_secretbox_MACBYTES;
}
size_t
crypto_secretbox_messagebytes_max(void)
{
return crypto_secretbox_MESSAGEBYTES_MAX;
}
const char *
crypto_secretbox_primitive(void)
{
@@ -169,3 +169,9 @@ crypto_secretbox_xchacha20poly1305_macbytes(void)
{
return crypto_secretbox_xchacha20poly1305_MACBYTES;
}
size_t
crypto_secretbox_xchacha20poly1305_messagebytes_max(void)
{
return crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX;
}
@@ -76,6 +76,12 @@ crypto_secretbox_xsalsa20poly1305_macbytes(void)
return crypto_secretbox_xsalsa20poly1305_MACBYTES;
}
size_t
crypto_secretbox_xsalsa20poly1305_messagebytes_max(void)
{
return crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX;
}
void
crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES])
{
+6
View File
@@ -31,6 +31,12 @@ crypto_sign_secretkeybytes(void)
return crypto_sign_SECRETKEYBYTES;
}
size_t
crypto_sign_messagebytes_max(void)
{
return crypto_sign_MESSAGEBYTES_MAX;
}
const char *
crypto_sign_primitive(void)
{
@@ -35,6 +35,12 @@ crypto_sign_ed25519_secretkeybytes(void)
return crypto_sign_ed25519_SECRETKEYBYTES;
}
size_t
crypto_sign_ed25519_messagebytes_max(void)
{
return crypto_sign_ed25519_MESSAGEBYTES_MAX;
}
int
crypto_sign_ed25519_sk_to_seed(unsigned char *seed, const unsigned char *sk)
{
@@ -26,6 +26,12 @@ crypto_stream_chacha20_noncebytes(void) {
return crypto_stream_chacha20_NONCEBYTES;
}
size_t
crypto_stream_chacha20_messagebytes_max(void)
{
return crypto_stream_chacha20_MESSAGEBYTES_MAX;
}
size_t
crypto_stream_chacha20_ietf_keybytes(void) {
return crypto_stream_chacha20_ietf_KEYBYTES;
@@ -36,6 +42,12 @@ crypto_stream_chacha20_ietf_noncebytes(void) {
return crypto_stream_chacha20_ietf_NONCEBYTES;
}
size_t
crypto_stream_chacha20_ietf_messagebytes_max(void)
{
return crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX;
}
int
crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
@@ -14,6 +14,12 @@ crypto_stream_noncebytes(void)
return crypto_stream_NONCEBYTES;
}
size_t
crypto_stream_messagebytes_max(void)
{
return crypto_stream_MESSAGEBYTES_MAX;
}
const char *
crypto_stream_primitive(void)
{
@@ -37,6 +37,12 @@ crypto_stream_salsa20_noncebytes(void)
return crypto_stream_salsa20_NONCEBYTES;
}
size_t
crypto_stream_salsa20_messagebytes_max(void)
{
return crypto_stream_salsa20_MESSAGEBYTES_MAX;
}
int
crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
@@ -13,6 +13,12 @@ crypto_stream_salsa2012_noncebytes(void)
return crypto_stream_salsa2012_NONCEBYTES;
}
size_t
crypto_stream_salsa2012_messagebytes_max(void)
{
return crypto_stream_salsa2012_MESSAGEBYTES_MAX;
}
void
crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
{
@@ -13,6 +13,12 @@ crypto_stream_salsa208_noncebytes(void)
return crypto_stream_salsa208_NONCEBYTES;
}
size_t
crypto_stream_salsa208_messagebyte_max(void)
{
return crypto_stream_salsa208_MESSAGEBYTES_MAX;
}
void
crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES])
{
@@ -19,6 +19,12 @@ crypto_stream_xchacha20_noncebytes(void)
return crypto_stream_xchacha20_NONCEBYTES;
}
size_t
crypto_stream_xchacha20_messagebytes_max(void)
{
return crypto_stream_xchacha20_MESSAGEBYTES_MAX;
}
int
crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
@@ -53,6 +53,12 @@ crypto_stream_xsalsa20_noncebytes(void)
return crypto_stream_xsalsa20_NONCEBYTES;
}
size_t
crypto_stream_xsalsa20_messagebytes_max(void)
{
return crypto_stream_xsalsa20_MESSAGEBYTES_MAX;
}
void
crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES])
{
@@ -33,6 +33,8 @@ size_t crypto_aead_aes256gcm_abytes(void);
#define crypto_aead_aes256gcm_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \
(16ULL * ((1ULL << 32) - 2ULL)) - crypto_aead_aes256gcm_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_messagebytes_max(void);
typedef CRYPTO_ALIGN(16) unsigned char crypto_aead_aes256gcm_state[512];
@@ -33,6 +33,8 @@ size_t crypto_aead_chacha20poly1305_ietf_abytes(void);
#define crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ietf_ABYTES, \
(64ULL * (1ULL << 32) - 64ULL) - crypto_aead_chacha20poly1305_ietf_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max(void);
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
@@ -104,6 +106,8 @@ size_t crypto_aead_chacha20poly1305_abytes(void);
#define crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX \
(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_chacha20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
@@ -157,10 +161,11 @@ void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20pol
/* Aliases */
#define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
#define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
#define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
#define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
#define crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
#ifdef __cplusplus
}
@@ -29,6 +29,8 @@ size_t crypto_aead_xchacha20poly1305_ietf_abytes(void);
#define crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX \
(SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max(void);
SODIUM_EXPORT
int crypto_aead_xchacha20poly1305_ietf_encrypt(unsigned char *c,
@@ -82,10 +84,11 @@ void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchac
/* Aliases */
#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
#define crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
#ifdef __cplusplus
}
@@ -41,6 +41,8 @@ SODIUM_EXPORT
size_t crypto_box_macbytes(void);
#define crypto_box_MESSAGEBYTES_MAX crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_box_messagebytes_max(void);
#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
SODIUM_EXPORT
@@ -39,6 +39,8 @@ size_t crypto_box_curve25519xchacha20poly1305_macbytes(void);
#define crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX \
(crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)
SODIUM_EXPORT
size_t crypto_box_curve25519xchacha20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char *pk,
@@ -39,6 +39,8 @@ 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
size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
@@ -30,6 +30,8 @@ SODIUM_EXPORT
const char *crypto_secretbox_primitive(void);
#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_secretbox_messagebytes_max(void);
SODIUM_EXPORT
int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
@@ -26,6 +26,8 @@ size_t crypto_secretbox_xchacha20poly1305_macbytes(void);
#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \
(crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
SODIUM_EXPORT
size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
@@ -27,6 +27,8 @@ 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_MACBYTES)
SODIUM_EXPORT
size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
@@ -42,6 +42,8 @@ SODIUM_EXPORT
size_t crypto_sign_secretkeybytes(void);
#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_sign_messagebytes_max(void);
#define crypto_sign_PRIMITIVE "ed25519"
SODIUM_EXPORT
@@ -36,6 +36,8 @@ SODIUM_EXPORT
size_t crypto_sign_ed25519_secretkeybytes(void);
#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)
SODIUM_EXPORT
size_t crypto_sign_ed25519_messagebytes_max(void);
SODIUM_EXPORT
int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
@@ -30,6 +30,8 @@ SODIUM_EXPORT
size_t crypto_stream_noncebytes(void);
#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_stream_messagebytes_max(void);
#define crypto_stream_PRIMITIVE "xsalsa20"
SODIUM_EXPORT
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_chacha20_noncebytes(void);
#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_chacha20_messagebytes_max(void);
/* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */
@@ -62,6 +64,8 @@ size_t crypto_stream_chacha20_ietf_noncebytes(void);
#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32))
SODIUM_EXPORT
size_t crypto_stream_chacha20_ietf_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_salsa20_noncebytes(void);
#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_salsa20_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
@@ -28,6 +28,8 @@ SODIUM_EXPORT
size_t crypto_stream_salsa2012_noncebytes(void);
#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_salsa2012_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
@@ -28,6 +28,8 @@ SODIUM_EXPORT
size_t crypto_stream_salsa208_noncebytes(void);
#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_salsa208_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_xchacha20_noncebytes(void);
#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_xchacha20_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_xsalsa20_noncebytes(void);
#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_xsalsa20_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
@@ -29,10 +29,10 @@
#include "crypto_core_salsa20.h"
#include "crypto_generichash.h"
#include "crypto_stream_salsa20.h"
#include "private/common.h"
#include "randombytes.h"
#include "randombytes_salsa20_random.h"
#include "utils.h"
#include "private/common.h"
#ifdef _WIN32
# include <windows.h>
@@ -25,6 +25,7 @@
#endif
#include "core.h"
#include "private/common.h"
#include "randombytes.h"
#include "randombytes_sysrandom.h"
#include "utils.h"
+18
View File
@@ -0,0 +1,18 @@
#! /bin/sh
CT='ct.c'
echo '#include <assert.h>' > "$CT"
echo '#include <sodium.h>' >> "$CT"
echo 'int main(void) {' >> "$CT"
for macro in $(egrep -r '#define crypto_.*BYTES ' src/libsodium/include | \
cut -d: -f2- | cut -d' ' -f2 | \
fgrep -v edwards25519sha512batch | sort -u); do
func=$(echo "$macro" | tr A-Z a-z)
echo " assert($func() == $macro);" >> "$CT"
done
echo "return 0; }" >> "$CT"
cc "$CT" -lsodium && ./a.out
rm -f a.out "$CT"
+1
View File
@@ -3236,6 +3236,7 @@ main(void)
assert(crypto_aead_aes256gcm_npubbytes() == crypto_aead_aes256gcm_NPUBBYTES);
assert(crypto_aead_aes256gcm_abytes() == crypto_aead_aes256gcm_ABYTES);
assert(crypto_aead_aes256gcm_statebytes() >= sizeof(crypto_aead_aes256gcm_state));
assert(crypto_aead_aes256gcm_messagebytes_max() == crypto_aead_aes256gcm_MESSAGEBYTES_MAX);
printf("OK\n");
return 0;
+2
View File
@@ -346,10 +346,12 @@ tv_ietf(void)
assert(crypto_aead_chacha20poly1305_ietf_npubbytes() > crypto_aead_chacha20poly1305_npubbytes());
assert(crypto_aead_chacha20poly1305_ietf_nsecbytes() == 0U);
assert(crypto_aead_chacha20poly1305_ietf_nsecbytes() == crypto_aead_chacha20poly1305_nsecbytes());
assert(crypto_aead_chacha20poly1305_ietf_messagebytes_max() == crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
assert(crypto_aead_chacha20poly1305_IETF_KEYBYTES == crypto_aead_chacha20poly1305_ietf_KEYBYTES);
assert(crypto_aead_chacha20poly1305_IETF_NSECBYTES == crypto_aead_chacha20poly1305_ietf_NSECBYTES);
assert(crypto_aead_chacha20poly1305_IETF_NPUBBYTES == crypto_aead_chacha20poly1305_ietf_NPUBBYTES);
assert(crypto_aead_chacha20poly1305_IETF_ABYTES == crypto_aead_chacha20poly1305_ietf_ABYTES);
assert(crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX == crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
return 0;
}
+2
View File
@@ -179,10 +179,12 @@ tv(void)
assert(crypto_aead_xchacha20poly1305_ietf_npubbytes() == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
assert(crypto_aead_xchacha20poly1305_ietf_nsecbytes() == 0U);
assert(crypto_aead_xchacha20poly1305_ietf_nsecbytes() == crypto_aead_xchacha20poly1305_ietf_NSECBYTES);
assert(crypto_aead_xchacha20poly1305_ietf_messagebytes_max() == crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX);
assert(crypto_aead_xchacha20poly1305_IETF_KEYBYTES == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
assert(crypto_aead_xchacha20poly1305_IETF_NSECBYTES == crypto_aead_xchacha20poly1305_ietf_NSECBYTES);
assert(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
assert(crypto_aead_xchacha20poly1305_IETF_ABYTES == crypto_aead_xchacha20poly1305_ietf_ABYTES);
assert(crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX == crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX);
return 0;
}
+3
View File
@@ -87,6 +87,7 @@ main(void)
assert(crypto_box_zerobytes() > 0U);
assert(crypto_box_boxzerobytes() > 0U);
assert(crypto_box_macbytes() > 0U);
assert(crypto_box_messagebytes_max() > 0U);
assert(strcmp(crypto_box_primitive(), "curve25519xsalsa20poly1305") == 0);
assert(crypto_box_curve25519xsalsa20poly1305_seedbytes() ==
crypto_box_seedbytes());
@@ -104,6 +105,8 @@ main(void)
crypto_box_boxzerobytes());
assert(crypto_box_curve25519xsalsa20poly1305_macbytes() ==
crypto_box_macbytes());
assert(crypto_box_curve25519xsalsa20poly1305_messagebytes_max() ==
crypto_box_messagebytes_max());
return 0;
}
+2
View File
@@ -175,10 +175,12 @@ main(void)
assert(crypto_stream_chacha20_keybytes() == crypto_stream_chacha20_KEYBYTES);
assert(crypto_stream_chacha20_noncebytes() > 0U);
assert(crypto_stream_chacha20_noncebytes() == crypto_stream_chacha20_NONCEBYTES);
assert(crypto_stream_chacha20_messagebytes_max() == crypto_stream_chacha20_MESSAGEBYTES_MAX);
assert(crypto_stream_chacha20_ietf_keybytes() > 0U);
assert(crypto_stream_chacha20_ietf_keybytes() == crypto_stream_chacha20_ietf_KEYBYTES);
assert(crypto_stream_chacha20_ietf_noncebytes() > 0U);
assert(crypto_stream_chacha20_ietf_noncebytes() == crypto_stream_chacha20_ietf_NONCEBYTES);
assert(crypto_stream_chacha20_ietf_messagebytes_max() == crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX);
return 0;
}
+3
View File
@@ -65,6 +65,7 @@ main(void)
assert(crypto_secretbox_zerobytes() > 0U);
assert(crypto_secretbox_boxzerobytes() > 0U);
assert(crypto_secretbox_macbytes() > 0U);
assert(crypto_secretbox_messagebytes_max() > 0U);
assert(strcmp(crypto_secretbox_primitive(), "xsalsa20poly1305") == 0);
assert(crypto_secretbox_keybytes() ==
crypto_secretbox_xsalsa20poly1305_keybytes());
@@ -76,6 +77,8 @@ main(void)
crypto_secretbox_xsalsa20poly1305_boxzerobytes());
assert(crypto_secretbox_macbytes() ==
crypto_secretbox_xsalsa20poly1305_macbytes());
assert(crypto_secretbox_messagebytes_max() ==
crypto_secretbox_xsalsa20poly1305_messagebytes_max());
return 0;
}
+2
View File
@@ -1300,9 +1300,11 @@ int main(void)
assert(crypto_sign_seedbytes() > 0U);
assert(crypto_sign_publickeybytes() > 0U);
assert(crypto_sign_secretkeybytes() > 0U);
assert(crypto_sign_messagebytes_max() > 0U);
assert(strcmp(crypto_sign_primitive(), "ed25519") == 0);
assert(crypto_sign_bytes() == crypto_sign_ed25519_bytes());
assert(crypto_sign_seedbytes() == crypto_sign_ed25519_seedbytes());
assert(crypto_sign_messagebytes_max() == crypto_sign_ed25519_messagebytes_max());
assert(crypto_sign_publickeybytes()
== crypto_sign_ed25519_publickeybytes());
assert(crypto_sign_secretkeybytes()
+2
View File
@@ -55,9 +55,11 @@ main(void)
assert(crypto_stream_keybytes() > 0U);
assert(crypto_stream_noncebytes() > 0U);
assert(crypto_stream_messagebytes_max() > 0U);
assert(strcmp(crypto_stream_primitive(), "xsalsa20") == 0);
assert(crypto_stream_keybytes() == crypto_stream_xsalsa20_keybytes());
assert(crypto_stream_noncebytes() == crypto_stream_xsalsa20_noncebytes());
assert(crypto_stream_messagebytes_max() == crypto_stream_xsalsa20_messagebytes_max());
return 0;
}
+1
View File
@@ -41,6 +41,7 @@ main(void)
assert(crypto_stream_salsa20_keybytes() > 0U);
assert(crypto_stream_salsa20_noncebytes() > 0U);
assert(crypto_stream_salsa20_messagebytes_max() > 0U);
return 0;
}
+1
View File
@@ -405,6 +405,7 @@ tv_box_xchacha20poly1305(void)
assert(crypto_box_curve25519xchacha20poly1305_beforenmbytes() == crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES);
assert(crypto_box_curve25519xchacha20poly1305_noncebytes() == crypto_box_curve25519xchacha20poly1305_NONCEBYTES);
assert(crypto_box_curve25519xchacha20poly1305_macbytes() == crypto_box_curve25519xchacha20poly1305_MACBYTES);
assert(crypto_box_curve25519xchacha20poly1305_messagebytes_max() == crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX);
printf("tv_box_xchacha20poly1305: ok\n");
}