diff --git a/contrib/Findsodium.cmake b/contrib/Findsodium.cmake index ad7031e5..9d306d15 100644 --- a/contrib/Findsodium.cmake +++ b/contrib/Findsodium.cmake @@ -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) diff --git a/dist-build/Makefile.am b/dist-build/Makefile.am index 3d0a0e63..d01107b9 100644 --- a/dist-build/Makefile.am +++ b/dist-build/Makefile.am @@ -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 \ diff --git a/dist-build/emscripten-symbols.def b/dist-build/emscripten-symbols.def index 8ac770c3..d62004c0 100644 --- a/dist-build/emscripten-symbols.def +++ b/dist-build/emscripten-symbols.def @@ -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 diff --git a/dist-build/emscripten-wasm.sh b/dist-build/emscripten-wasm.sh index 3ff6ed92..d3212846 100755 --- a/dist-build/emscripten-wasm.sh +++ b/dist-build/emscripten-wasm.sh @@ -3,8 +3,6 @@ export MAKE_FLAGS='-j4' export EXPORTED_FUNCTIONS_STANDARD='["_crypto_aead_chacha20poly1305_abytes","_crypto_aead_chacha20poly1305_decrypt","_crypto_aead_chacha20poly1305_decrypt_detached","_crypto_aead_chacha20poly1305_encrypt","_crypto_aead_chacha20poly1305_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_abytes","_crypto_aead_chacha20poly1305_ietf_decrypt","_crypto_aead_chacha20poly1305_ietf_decrypt_detached","_crypto_aead_chacha20poly1305_ietf_encrypt","_crypto_aead_chacha20poly1305_ietf_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_keybytes","_crypto_aead_chacha20poly1305_ietf_keygen","_crypto_aead_chacha20poly1305_ietf_npubbytes","_crypto_aead_chacha20poly1305_ietf_nsecbytes","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_keygen","_crypto_aead_chacha20poly1305_npubbytes","_crypto_aead_chacha20poly1305_nsecbytes","_crypto_aead_xchacha20poly1305_ietf_abytes","_crypto_aead_xchacha20poly1305_ietf_decrypt","_crypto_aead_xchacha20poly1305_ietf_decrypt_detached","_crypto_aead_xchacha20poly1305_ietf_encrypt","_crypto_aead_xchacha20poly1305_ietf_encrypt_detached","_crypto_aead_xchacha20poly1305_ietf_keybytes","_crypto_aead_xchacha20poly1305_ietf_keygen","_crypto_aead_xchacha20poly1305_ietf_npubbytes","_crypto_aead_xchacha20poly1305_ietf_nsecbytes","_crypto_auth","_crypto_auth_bytes","_crypto_auth_keybytes","_crypto_auth_keygen","_crypto_auth_verify","_crypto_box_beforenm","_crypto_box_beforenmbytes","_crypto_box_detached","_crypto_box_detached_afternm","_crypto_box_easy","_crypto_box_easy_afternm","_crypto_box_keypair","_crypto_box_macbytes","_crypto_box_noncebytes","_crypto_box_open_detached","_crypto_box_open_detached_afternm","_crypto_box_open_easy","_crypto_box_open_easy_afternm","_crypto_box_publickeybytes","_crypto_box_seal","_crypto_box_seal_open","_crypto_box_sealbytes","_crypto_box_secretkeybytes","_crypto_box_seed_keypair","_crypto_box_seedbytes","_crypto_core_hchacha20","_crypto_core_hchacha20_constbytes","_crypto_core_hchacha20_inputbytes","_crypto_core_hchacha20_keybytes","_crypto_core_hchacha20_outputbytes","_crypto_generichash","_crypto_generichash_bytes","_crypto_generichash_bytes_max","_crypto_generichash_bytes_min","_crypto_generichash_final","_crypto_generichash_init","_crypto_generichash_keybytes","_crypto_generichash_keybytes_max","_crypto_generichash_keybytes_min","_crypto_generichash_keygen","_crypto_generichash_statebytes","_crypto_generichash_update","_crypto_hash","_crypto_hash_bytes","_crypto_kdf_bytes_max","_crypto_kdf_bytes_min","_crypto_kdf_contextbytes","_crypto_kdf_derive_from_key","_crypto_kdf_keybytes","_crypto_kdf_keygen","_crypto_kx_client_session_keys","_crypto_kx_keypair","_crypto_kx_publickeybytes","_crypto_kx_secretkeybytes","_crypto_kx_seed_keypair","_crypto_kx_seedbytes","_crypto_kx_server_session_keys","_crypto_kx_sessionkeybytes","_crypto_pwhash_bytes_max","_crypto_pwhash_bytes_min","_crypto_pwhash_memlimit_max","_crypto_pwhash_memlimit_min","_crypto_pwhash_opslimit_max","_crypto_pwhash_opslimit_min","_crypto_pwhash_passwd_max","_crypto_pwhash_passwd_min","_crypto_scalarmult","_crypto_scalarmult_base","_crypto_scalarmult_bytes","_crypto_scalarmult_scalarbytes","_crypto_secretbox_detached","_crypto_secretbox_easy","_crypto_secretbox_keybytes","_crypto_secretbox_keygen","_crypto_secretbox_macbytes","_crypto_secretbox_noncebytes","_crypto_secretbox_open_detached","_crypto_secretbox_open_easy","_crypto_shorthash","_crypto_shorthash_bytes","_crypto_shorthash_keybytes","_crypto_shorthash_keygen","_crypto_sign","_crypto_sign_bytes","_crypto_sign_detached","_crypto_sign_ed25519_pk_to_curve25519","_crypto_sign_ed25519_sk_to_curve25519","_crypto_sign_final_create","_crypto_sign_final_verify","_crypto_sign_init","_crypto_sign_keypair","_crypto_sign_open","_crypto_sign_publickeybytes","_crypto_sign_secretkeybytes","_crypto_sign_seed_keypair","_crypto_sign_seedbytes","_crypto_sign_statebytes","_crypto_sign_update","_crypto_sign_verify_detached","_crypto_stream_keygen","_randombytes","_randombytes_buf","_randombytes_buf_deterministic","_randombytes_close","_randombytes_random","_randombytes_seedbytes","_randombytes_stir","_randombytes_uniform","_sodium_bin2hex","_sodium_hex2bin","_sodium_init","_sodium_library_minimal","_sodium_library_version_major","_sodium_library_version_minor","_sodium_version_string"]' export EXPORTED_FUNCTIONS_SUMO='["_crypto_aead_chacha20poly1305_abytes","_crypto_aead_chacha20poly1305_decrypt","_crypto_aead_chacha20poly1305_decrypt_detached","_crypto_aead_chacha20poly1305_encrypt","_crypto_aead_chacha20poly1305_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_abytes","_crypto_aead_chacha20poly1305_ietf_decrypt","_crypto_aead_chacha20poly1305_ietf_decrypt_detached","_crypto_aead_chacha20poly1305_ietf_encrypt","_crypto_aead_chacha20poly1305_ietf_encrypt_detached","_crypto_aead_chacha20poly1305_ietf_keybytes","_crypto_aead_chacha20poly1305_ietf_keygen","_crypto_aead_chacha20poly1305_ietf_npubbytes","_crypto_aead_chacha20poly1305_ietf_nsecbytes","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_keygen","_crypto_aead_chacha20poly1305_npubbytes","_crypto_aead_chacha20poly1305_nsecbytes","_crypto_aead_xchacha20poly1305_ietf_abytes","_crypto_aead_xchacha20poly1305_ietf_decrypt","_crypto_aead_xchacha20poly1305_ietf_decrypt_detached","_crypto_aead_xchacha20poly1305_ietf_encrypt","_crypto_aead_xchacha20poly1305_ietf_encrypt_detached","_crypto_aead_xchacha20poly1305_ietf_keybytes","_crypto_aead_xchacha20poly1305_ietf_keygen","_crypto_aead_xchacha20poly1305_ietf_npubbytes","_crypto_aead_xchacha20poly1305_ietf_nsecbytes","_crypto_auth","_crypto_auth_bytes","_crypto_auth_hmacsha256","_crypto_auth_hmacsha256_bytes","_crypto_auth_hmacsha256_final","_crypto_auth_hmacsha256_init","_crypto_auth_hmacsha256_keybytes","_crypto_auth_hmacsha256_keygen","_crypto_auth_hmacsha256_statebytes","_crypto_auth_hmacsha256_update","_crypto_auth_hmacsha256_verify","_crypto_auth_hmacsha512","_crypto_auth_hmacsha512256","_crypto_auth_hmacsha512256_bytes","_crypto_auth_hmacsha512256_final","_crypto_auth_hmacsha512256_init","_crypto_auth_hmacsha512256_keybytes","_crypto_auth_hmacsha512256_keygen","_crypto_auth_hmacsha512256_statebytes","_crypto_auth_hmacsha512256_update","_crypto_auth_hmacsha512256_verify","_crypto_auth_hmacsha512_bytes","_crypto_auth_hmacsha512_final","_crypto_auth_hmacsha512_init","_crypto_auth_hmacsha512_keybytes","_crypto_auth_hmacsha512_keygen","_crypto_auth_hmacsha512_statebytes","_crypto_auth_hmacsha512_update","_crypto_auth_hmacsha512_verify","_crypto_auth_keybytes","_crypto_auth_keygen","_crypto_auth_primitive","_crypto_auth_verify","_crypto_box","_crypto_box_afternm","_crypto_box_beforenm","_crypto_box_beforenmbytes","_crypto_box_boxzerobytes","_crypto_box_curve25519xchacha20poly1305_beforenm","_crypto_box_curve25519xchacha20poly1305_beforenmbytes","_crypto_box_curve25519xchacha20poly1305_detached","_crypto_box_curve25519xchacha20poly1305_detached_afternm","_crypto_box_curve25519xchacha20poly1305_easy","_crypto_box_curve25519xchacha20poly1305_easy_afternm","_crypto_box_curve25519xchacha20poly1305_keypair","_crypto_box_curve25519xchacha20poly1305_macbytes","_crypto_box_curve25519xchacha20poly1305_noncebytes","_crypto_box_curve25519xchacha20poly1305_open_detached","_crypto_box_curve25519xchacha20poly1305_open_detached_afternm","_crypto_box_curve25519xchacha20poly1305_open_easy","_crypto_box_curve25519xchacha20poly1305_open_easy_afternm","_crypto_box_curve25519xchacha20poly1305_publickeybytes","_crypto_box_curve25519xchacha20poly1305_seal","_crypto_box_curve25519xchacha20poly1305_seal_open","_crypto_box_curve25519xchacha20poly1305_sealbytes","_crypto_box_curve25519xchacha20poly1305_secretkeybytes","_crypto_box_curve25519xchacha20poly1305_seed_keypair","_crypto_box_curve25519xchacha20poly1305_seedbytes","_crypto_box_curve25519xsalsa20poly1305","_crypto_box_curve25519xsalsa20poly1305_afternm","_crypto_box_curve25519xsalsa20poly1305_beforenm","_crypto_box_curve25519xsalsa20poly1305_beforenmbytes","_crypto_box_curve25519xsalsa20poly1305_boxzerobytes","_crypto_box_curve25519xsalsa20poly1305_keypair","_crypto_box_curve25519xsalsa20poly1305_macbytes","_crypto_box_curve25519xsalsa20poly1305_noncebytes","_crypto_box_curve25519xsalsa20poly1305_open","_crypto_box_curve25519xsalsa20poly1305_open_afternm","_crypto_box_curve25519xsalsa20poly1305_publickeybytes","_crypto_box_curve25519xsalsa20poly1305_secretkeybytes","_crypto_box_curve25519xsalsa20poly1305_seed_keypair","_crypto_box_curve25519xsalsa20poly1305_seedbytes","_crypto_box_curve25519xsalsa20poly1305_zerobytes","_crypto_box_detached","_crypto_box_detached_afternm","_crypto_box_easy","_crypto_box_easy_afternm","_crypto_box_keypair","_crypto_box_macbytes","_crypto_box_noncebytes","_crypto_box_open","_crypto_box_open_afternm","_crypto_box_open_detached","_crypto_box_open_detached_afternm","_crypto_box_open_easy","_crypto_box_open_easy_afternm","_crypto_box_primitive","_crypto_box_publickeybytes","_crypto_box_seal","_crypto_box_seal_open","_crypto_box_sealbytes","_crypto_box_secretkeybytes","_crypto_box_seed_keypair","_crypto_box_seedbytes","_crypto_box_zerobytes","_crypto_core_hchacha20","_crypto_core_hchacha20_constbytes","_crypto_core_hchacha20_inputbytes","_crypto_core_hchacha20_keybytes","_crypto_core_hchacha20_outputbytes","_crypto_core_hsalsa20","_crypto_core_hsalsa20_constbytes","_crypto_core_hsalsa20_inputbytes","_crypto_core_hsalsa20_keybytes","_crypto_core_hsalsa20_outputbytes","_crypto_core_salsa20","_crypto_core_salsa2012","_crypto_core_salsa2012_constbytes","_crypto_core_salsa2012_inputbytes","_crypto_core_salsa2012_keybytes","_crypto_core_salsa2012_outputbytes","_crypto_core_salsa208","_crypto_core_salsa208_constbytes","_crypto_core_salsa208_inputbytes","_crypto_core_salsa208_keybytes","_crypto_core_salsa208_outputbytes","_crypto_core_salsa20_constbytes","_crypto_core_salsa20_inputbytes","_crypto_core_salsa20_keybytes","_crypto_core_salsa20_outputbytes","_crypto_generichash","_crypto_generichash_blake2b","_crypto_generichash_blake2b_bytes","_crypto_generichash_blake2b_bytes_max","_crypto_generichash_blake2b_bytes_min","_crypto_generichash_blake2b_final","_crypto_generichash_blake2b_init","_crypto_generichash_blake2b_init_salt_personal","_crypto_generichash_blake2b_keybytes","_crypto_generichash_blake2b_keybytes_max","_crypto_generichash_blake2b_keybytes_min","_crypto_generichash_blake2b_keygen","_crypto_generichash_blake2b_personalbytes","_crypto_generichash_blake2b_salt_personal","_crypto_generichash_blake2b_saltbytes","_crypto_generichash_blake2b_statebytes","_crypto_generichash_blake2b_update","_crypto_generichash_bytes","_crypto_generichash_bytes_max","_crypto_generichash_bytes_min","_crypto_generichash_final","_crypto_generichash_init","_crypto_generichash_keybytes","_crypto_generichash_keybytes_max","_crypto_generichash_keybytes_min","_crypto_generichash_keygen","_crypto_generichash_primitive","_crypto_generichash_statebytes","_crypto_generichash_update","_crypto_hash","_crypto_hash_bytes","_crypto_hash_primitive","_crypto_hash_sha256","_crypto_hash_sha256_bytes","_crypto_hash_sha256_final","_crypto_hash_sha256_init","_crypto_hash_sha256_statebytes","_crypto_hash_sha256_update","_crypto_hash_sha512","_crypto_hash_sha512_bytes","_crypto_hash_sha512_final","_crypto_hash_sha512_init","_crypto_hash_sha512_statebytes","_crypto_hash_sha512_update","_crypto_kdf_blake2b_bytes_max","_crypto_kdf_blake2b_bytes_min","_crypto_kdf_blake2b_contextbytes","_crypto_kdf_blake2b_derive_from_key","_crypto_kdf_blake2b_keybytes","_crypto_kdf_bytes_max","_crypto_kdf_bytes_min","_crypto_kdf_contextbytes","_crypto_kdf_derive_from_key","_crypto_kdf_keybytes","_crypto_kdf_keygen","_crypto_kdf_primitive","_crypto_kx_client_session_keys","_crypto_kx_keypair","_crypto_kx_primitive","_crypto_kx_publickeybytes","_crypto_kx_secretkeybytes","_crypto_kx_seed_keypair","_crypto_kx_seedbytes","_crypto_kx_server_session_keys","_crypto_kx_sessionkeybytes","_crypto_onetimeauth","_crypto_onetimeauth_bytes","_crypto_onetimeauth_final","_crypto_onetimeauth_init","_crypto_onetimeauth_keybytes","_crypto_onetimeauth_keygen","_crypto_onetimeauth_poly1305","_crypto_onetimeauth_poly1305_bytes","_crypto_onetimeauth_poly1305_final","_crypto_onetimeauth_poly1305_init","_crypto_onetimeauth_poly1305_keybytes","_crypto_onetimeauth_poly1305_keygen","_crypto_onetimeauth_poly1305_statebytes","_crypto_onetimeauth_poly1305_update","_crypto_onetimeauth_poly1305_verify","_crypto_onetimeauth_primitive","_crypto_onetimeauth_statebytes","_crypto_onetimeauth_update","_crypto_onetimeauth_verify","_crypto_pwhash","_crypto_pwhash_alg_argon2i13","_crypto_pwhash_alg_argon2id13","_crypto_pwhash_alg_default","_crypto_pwhash_argon2i","_crypto_pwhash_argon2i_alg_argon2i13","_crypto_pwhash_argon2i_bytes_max","_crypto_pwhash_argon2i_bytes_min","_crypto_pwhash_argon2i_memlimit_interactive","_crypto_pwhash_argon2i_memlimit_max","_crypto_pwhash_argon2i_memlimit_min","_crypto_pwhash_argon2i_memlimit_moderate","_crypto_pwhash_argon2i_memlimit_sensitive","_crypto_pwhash_argon2i_opslimit_interactive","_crypto_pwhash_argon2i_opslimit_max","_crypto_pwhash_argon2i_opslimit_min","_crypto_pwhash_argon2i_opslimit_moderate","_crypto_pwhash_argon2i_opslimit_sensitive","_crypto_pwhash_argon2i_passwd_max","_crypto_pwhash_argon2i_passwd_min","_crypto_pwhash_argon2i_saltbytes","_crypto_pwhash_argon2i_str","_crypto_pwhash_argon2i_str_verify","_crypto_pwhash_argon2i_strbytes","_crypto_pwhash_argon2i_strprefix","_crypto_pwhash_argon2id","_crypto_pwhash_argon2id_alg_argon2id13","_crypto_pwhash_argon2id_bytes_max","_crypto_pwhash_argon2id_bytes_min","_crypto_pwhash_argon2id_memlimit_interactive","_crypto_pwhash_argon2id_memlimit_max","_crypto_pwhash_argon2id_memlimit_min","_crypto_pwhash_argon2id_memlimit_moderate","_crypto_pwhash_argon2id_memlimit_sensitive","_crypto_pwhash_argon2id_opslimit_interactive","_crypto_pwhash_argon2id_opslimit_max","_crypto_pwhash_argon2id_opslimit_min","_crypto_pwhash_argon2id_opslimit_moderate","_crypto_pwhash_argon2id_opslimit_sensitive","_crypto_pwhash_argon2id_passwd_max","_crypto_pwhash_argon2id_passwd_min","_crypto_pwhash_argon2id_saltbytes","_crypto_pwhash_argon2id_str","_crypto_pwhash_argon2id_str_verify","_crypto_pwhash_argon2id_strbytes","_crypto_pwhash_argon2id_strprefix","_crypto_pwhash_bytes_max","_crypto_pwhash_bytes_min","_crypto_pwhash_memlimit_interactive","_crypto_pwhash_memlimit_max","_crypto_pwhash_memlimit_min","_crypto_pwhash_memlimit_moderate","_crypto_pwhash_memlimit_sensitive","_crypto_pwhash_opslimit_interactive","_crypto_pwhash_opslimit_max","_crypto_pwhash_opslimit_min","_crypto_pwhash_opslimit_moderate","_crypto_pwhash_opslimit_sensitive","_crypto_pwhash_passwd_max","_crypto_pwhash_passwd_min","_crypto_pwhash_primitive","_crypto_pwhash_saltbytes","_crypto_pwhash_scryptsalsa208sha256","_crypto_pwhash_scryptsalsa208sha256_bytes_max","_crypto_pwhash_scryptsalsa208sha256_bytes_min","_crypto_pwhash_scryptsalsa208sha256_ll","_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive","_crypto_pwhash_scryptsalsa208sha256_memlimit_max","_crypto_pwhash_scryptsalsa208sha256_memlimit_min","_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive","_crypto_pwhash_scryptsalsa208sha256_opslimit_max","_crypto_pwhash_scryptsalsa208sha256_opslimit_min","_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_passwd_max","_crypto_pwhash_scryptsalsa208sha256_passwd_min","_crypto_pwhash_scryptsalsa208sha256_saltbytes","_crypto_pwhash_scryptsalsa208sha256_str","_crypto_pwhash_scryptsalsa208sha256_str_verify","_crypto_pwhash_scryptsalsa208sha256_strbytes","_crypto_pwhash_scryptsalsa208sha256_strprefix","_crypto_pwhash_str","_crypto_pwhash_str_verify","_crypto_pwhash_strbytes","_crypto_pwhash_strprefix","_crypto_scalarmult","_crypto_scalarmult_base","_crypto_scalarmult_bytes","_crypto_scalarmult_curve25519","_crypto_scalarmult_curve25519_base","_crypto_scalarmult_curve25519_bytes","_crypto_scalarmult_curve25519_scalarbytes","_crypto_scalarmult_primitive","_crypto_scalarmult_scalarbytes","_crypto_secretbox","_crypto_secretbox_boxzerobytes","_crypto_secretbox_detached","_crypto_secretbox_easy","_crypto_secretbox_keybytes","_crypto_secretbox_keygen","_crypto_secretbox_macbytes","_crypto_secretbox_noncebytes","_crypto_secretbox_open","_crypto_secretbox_open_detached","_crypto_secretbox_open_easy","_crypto_secretbox_primitive","_crypto_secretbox_xchacha20poly1305_detached","_crypto_secretbox_xchacha20poly1305_easy","_crypto_secretbox_xchacha20poly1305_keybytes","_crypto_secretbox_xchacha20poly1305_macbytes","_crypto_secretbox_xchacha20poly1305_noncebytes","_crypto_secretbox_xchacha20poly1305_open_detached","_crypto_secretbox_xchacha20poly1305_open_easy","_crypto_secretbox_xsalsa20poly1305","_crypto_secretbox_xsalsa20poly1305_boxzerobytes","_crypto_secretbox_xsalsa20poly1305_keybytes","_crypto_secretbox_xsalsa20poly1305_keygen","_crypto_secretbox_xsalsa20poly1305_macbytes","_crypto_secretbox_xsalsa20poly1305_noncebytes","_crypto_secretbox_xsalsa20poly1305_open","_crypto_secretbox_xsalsa20poly1305_zerobytes","_crypto_secretbox_zerobytes","_crypto_shorthash","_crypto_shorthash_bytes","_crypto_shorthash_keybytes","_crypto_shorthash_keygen","_crypto_shorthash_primitive","_crypto_shorthash_siphash24","_crypto_shorthash_siphash24_bytes","_crypto_shorthash_siphash24_keybytes","_crypto_shorthash_siphashx24","_crypto_shorthash_siphashx24_bytes","_crypto_shorthash_siphashx24_keybytes","_crypto_sign","_crypto_sign_bytes","_crypto_sign_detached","_crypto_sign_ed25519","_crypto_sign_ed25519_bytes","_crypto_sign_ed25519_detached","_crypto_sign_ed25519_keypair","_crypto_sign_ed25519_open","_crypto_sign_ed25519_pk_to_curve25519","_crypto_sign_ed25519_publickeybytes","_crypto_sign_ed25519_secretkeybytes","_crypto_sign_ed25519_seed_keypair","_crypto_sign_ed25519_seedbytes","_crypto_sign_ed25519_sk_to_curve25519","_crypto_sign_ed25519_sk_to_pk","_crypto_sign_ed25519_sk_to_seed","_crypto_sign_ed25519_verify_detached","_crypto_sign_ed25519ph_final_create","_crypto_sign_ed25519ph_final_verify","_crypto_sign_ed25519ph_init","_crypto_sign_ed25519ph_statebytes","_crypto_sign_ed25519ph_update","_crypto_sign_final_create","_crypto_sign_final_verify","_crypto_sign_init","_crypto_sign_keypair","_crypto_sign_open","_crypto_sign_primitive","_crypto_sign_publickeybytes","_crypto_sign_secretkeybytes","_crypto_sign_seed_keypair","_crypto_sign_seedbytes","_crypto_sign_statebytes","_crypto_sign_update","_crypto_sign_verify_detached","_crypto_stream","_crypto_stream_aes128ctr","_crypto_stream_aes128ctr_afternm","_crypto_stream_aes128ctr_beforenm","_crypto_stream_aes128ctr_beforenmbytes","_crypto_stream_aes128ctr_keybytes","_crypto_stream_aes128ctr_noncebytes","_crypto_stream_aes128ctr_xor","_crypto_stream_aes128ctr_xor_afternm","_crypto_stream_chacha20","_crypto_stream_chacha20_ietf","_crypto_stream_chacha20_ietf_keybytes","_crypto_stream_chacha20_ietf_keygen","_crypto_stream_chacha20_ietf_noncebytes","_crypto_stream_chacha20_ietf_xor","_crypto_stream_chacha20_ietf_xor_ic","_crypto_stream_chacha20_keybytes","_crypto_stream_chacha20_keygen","_crypto_stream_chacha20_noncebytes","_crypto_stream_chacha20_xor","_crypto_stream_chacha20_xor_ic","_crypto_stream_keybytes","_crypto_stream_keygen","_crypto_stream_noncebytes","_crypto_stream_primitive","_crypto_stream_salsa20","_crypto_stream_salsa2012","_crypto_stream_salsa2012_keybytes","_crypto_stream_salsa2012_keygen","_crypto_stream_salsa2012_noncebytes","_crypto_stream_salsa2012_xor","_crypto_stream_salsa208","_crypto_stream_salsa208_keybytes","_crypto_stream_salsa208_keygen","_crypto_stream_salsa208_noncebytes","_crypto_stream_salsa208_xor","_crypto_stream_salsa20_keybytes","_crypto_stream_salsa20_keygen","_crypto_stream_salsa20_noncebytes","_crypto_stream_salsa20_xor","_crypto_stream_salsa20_xor_ic","_crypto_stream_xchacha20","_crypto_stream_xchacha20_keybytes","_crypto_stream_xchacha20_keygen","_crypto_stream_xchacha20_noncebytes","_crypto_stream_xchacha20_xor","_crypto_stream_xchacha20_xor_ic","_crypto_stream_xor","_crypto_stream_xsalsa20","_crypto_stream_xsalsa20_keybytes","_crypto_stream_xsalsa20_keygen","_crypto_stream_xsalsa20_noncebytes","_crypto_stream_xsalsa20_xor","_crypto_stream_xsalsa20_xor_ic","_crypto_verify_16","_crypto_verify_16_bytes","_crypto_verify_32","_crypto_verify_32_bytes","_crypto_verify_64","_crypto_verify_64_bytes","_randombytes","_randombytes_buf","_randombytes_buf_deterministic","_randombytes_close","_randombytes_implementation_name","_randombytes_random","_randombytes_seedbytes","_randombytes_stir","_randombytes_uniform","_sodium_bin2hex","_sodium_hex2bin","_sodium_init","_sodium_library_minimal","_sodium_library_version_major","_sodium_library_version_minor","_sodium_version_string"]' -export TOTAL_MEMORY=16777216 -export TOTAL_MEMORY_SUMO=67108864 export LDFLAGS="-s RESERVED_FUNCTION_POINTERS=8" export LDFLAGS="${LDFLAGS} -s WASM=1" export LDFLAGS="${LDFLAGS} -s NO_DYNAMIC_EXECUTION=1 -s RUNNING_JS_OPTS=1 -s ASSERTIONS=0" @@ -18,7 +16,6 @@ echo if [ "x$1" = "x--standard" ]; then echo "Building a standard distribution in ${PREFIX}" export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_STANDARD" - export LDFLAGS="${LDFLAGS} ${LDFLAGS_DIST} -s TOTAL_MEMORY=${TOTAL_MEMORY}" export PREFIX="$(pwd)/libsodium-js" export DONE_FILE="$(pwd)/js.done" export CONFIG_EXTRA="--enable-minimal" @@ -26,14 +23,12 @@ if [ "x$1" = "x--standard" ]; then elif [ "x$1" = "x--sumo" ]; then echo "Building a sumo distribution in ${PREFIX}" export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" - export LDFLAGS="${LDFLAGS} ${LDFLAGS_DIST} -s TOTAL_MEMORY=${TOTAL_MEMORY_SUMO}" export PREFIX="$(pwd)/libsodium-js-sumo" export DONE_FILE="$(pwd)/js-sumo.done" export DIST='yes' elif [ "x$1" = "x--browser-tests" ]; then echo "Building tests for web browsers" export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" - export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_SUMO}" export PREFIX="$(pwd)/libsodium-js-tests" export DONE_FILE="$(pwd)/js-tests-browser.done" export BROWSER_TESTS='yes' @@ -41,7 +36,6 @@ elif [ "x$1" = "x--browser-tests" ]; then elif [ "x$1" = "x--tests" ]; then echo "Building for testing" export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" - export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_SUMO}" export PREFIX="$(pwd)/libsodium-js-tests" export DONE_FILE="$(pwd)/js-tests.done" export DIST='no' @@ -64,7 +58,7 @@ emmake make clean if [ "$DIST" = yes ]; then emmake make $MAKE_FLAGS install && \ emcc "$CFLAGS" --llvm-lto 1 --memory-init-file 0 $CPPFLAGS $LDFLAGS $JS_EXPORTS_FLAGS \ - "${PREFIX}/lib/libsodium.a" -o "${PREFIX}/lib/libsodium.html" || exit 1 + "${PREFIX}/lib/libsodium.a" -o "${PREFIX}/lib/libsodium.js" || exit 1 touch -r "${PREFIX}/lib/libsodium.js" "$DONE_FILE" ls -l "${PREFIX}/lib/libsodium.js" exit 0 @@ -88,7 +82,6 @@ else echo 'node.js not found - test suite skipped' >&2 exit 1 fi - export NODE="${NODE} --expose-wasm" echo "Using [${NODE}] as a Javascript runtime" echo 'Compiling the test suite...' && \ emmake make $MAKE_FLAGS check > /dev/null 2>&1 @@ -102,7 +95,9 @@ if [ "x$BROWSER_TESTS" != "x" ]; then rm -f browser-wasm/tests.txt && \ for file in *.js; do tname=$(echo "$file" | sed 's/.js$//') - echo "$tname" | egrep -q '[.]asm$' && continue + if echo "$tname" | egrep -q '[.]asm$'; then + continue + fi echo "[${tname}]" fgrep -v "#! /usr/bin/env ${NODE}" "$file" > "browser-wasm/${file}" cp -f "${tname}.exp" "browser-wasm/${tname}.exp" 2> /dev/null diff --git a/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c b/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c index 3b3003a5..fbfa208a 100644 --- a/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +++ b/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c @@ -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]) { diff --git a/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c b/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c index e0fa3948..c79407a1 100644 --- a/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +++ b/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c @@ -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]) { diff --git a/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c b/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c index 95960503..c18cdf94 100644 --- a/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c +++ b/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c @@ -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]) { diff --git a/src/libsodium/crypto_box/crypto_box.c b/src/libsodium/crypto_box/crypto_box.c index 7ae4297c..7e4f00bd 100644 --- a/src/libsodium/crypto_box/crypto_box.c +++ b/src/libsodium/crypto_box/crypto_box.c @@ -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) { diff --git a/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c b/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c index 920a01f2..5e2532ea 100644 --- a/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c @@ -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; +} diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c index 7d6d603a..4c1d62ed 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c @@ -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; +} diff --git a/src/libsodium/crypto_secretbox/crypto_secretbox.c b/src/libsodium/crypto_secretbox/crypto_secretbox.c index 669b5742..45f678ec 100644 --- a/src/libsodium/crypto_secretbox/crypto_secretbox.c +++ b/src/libsodium/crypto_secretbox/crypto_secretbox.c @@ -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) { diff --git a/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c b/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c index 61b7c26a..e76167d2 100644 --- a/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c +++ b/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c @@ -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; +} diff --git a/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c b/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c index 1094c1f2..7240050d 100644 --- a/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c +++ b/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c @@ -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]) { diff --git a/src/libsodium/crypto_sign/crypto_sign.c b/src/libsodium/crypto_sign/crypto_sign.c index b93fa0ef..127072f7 100644 --- a/src/libsodium/crypto_sign/crypto_sign.c +++ b/src/libsodium/crypto_sign/crypto_sign.c @@ -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) { diff --git a/src/libsodium/crypto_sign/ed25519/sign_ed25519.c b/src/libsodium/crypto_sign/ed25519/sign_ed25519.c index 9ec477a1..e2a5a4a6 100644 --- a/src/libsodium/crypto_sign/ed25519/sign_ed25519.c +++ b/src/libsodium/crypto_sign/ed25519/sign_ed25519.c @@ -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) { diff --git a/src/libsodium/crypto_stream/chacha20/stream_chacha20.c b/src/libsodium/crypto_stream/chacha20/stream_chacha20.c index 0f7520ec..19c6eae9 100644 --- a/src/libsodium/crypto_stream/chacha20/stream_chacha20.c +++ b/src/libsodium/crypto_stream/chacha20/stream_chacha20.c @@ -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) diff --git a/src/libsodium/crypto_stream/crypto_stream.c b/src/libsodium/crypto_stream/crypto_stream.c index 7d93243b..58d25381 100644 --- a/src/libsodium/crypto_stream/crypto_stream.c +++ b/src/libsodium/crypto_stream/crypto_stream.c @@ -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) { diff --git a/src/libsodium/crypto_stream/salsa20/stream_salsa20.c b/src/libsodium/crypto_stream/salsa20/stream_salsa20.c index 1a126dad..8714de11 100644 --- a/src/libsodium/crypto_stream/salsa20/stream_salsa20.c +++ b/src/libsodium/crypto_stream/salsa20/stream_salsa20.c @@ -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) diff --git a/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c b/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c index d6c01b82..d0cc0f68 100644 --- a/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c +++ b/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c @@ -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]) { diff --git a/src/libsodium/crypto_stream/salsa208/stream_salsa208.c b/src/libsodium/crypto_stream/salsa208/stream_salsa208.c index 1a7752af..9b525264 100644 --- a/src/libsodium/crypto_stream/salsa208/stream_salsa208.c +++ b/src/libsodium/crypto_stream/salsa208/stream_salsa208.c @@ -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]) { diff --git a/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c b/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c index ee2345c2..8b1bc09a 100644 --- a/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c +++ b/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c @@ -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) diff --git a/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c b/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c index 1405b699..dc831a94 100644 --- a/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c +++ b/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c @@ -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]) { diff --git a/src/libsodium/include/sodium/crypto_aead_aes256gcm.h b/src/libsodium/include/sodium/crypto_aead_aes256gcm.h index 31ca77b7..30bb7315 100644 --- a/src/libsodium/include/sodium/crypto_aead_aes256gcm.h +++ b/src/libsodium/include/sodium/crypto_aead_aes256gcm.h @@ -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]; diff --git a/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h b/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h index cceb1062..a575ec71 100644 --- a/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +++ b/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h @@ -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 } diff --git a/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h b/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h index b5b9d317..99692aae 100644 --- a/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h +++ b/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h @@ -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 } diff --git a/src/libsodium/include/sodium/crypto_box.h b/src/libsodium/include/sodium/crypto_box.h index eb0def73..99ee19a8 100644 --- a/src/libsodium/include/sodium/crypto_box.h +++ b/src/libsodium/include/sodium/crypto_box.h @@ -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 diff --git a/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h b/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h index 9b299a0b..c1cf7566 100644 --- a/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h +++ b/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h index 77c9e3af..c5b15f42 100644 --- a/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +++ b/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_secretbox.h b/src/libsodium/include/sodium/crypto_secretbox.h index 7a28a4e2..55e94a02 100644 --- a/src/libsodium/include/sodium/crypto_secretbox.h +++ b/src/libsodium/include/sodium/crypto_secretbox.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h b/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h index 0858ea3e..2919da16 100644 --- a/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h +++ b/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h index 471271fd..4b8c7c8e 100644 --- a/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +++ b/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_sign.h b/src/libsodium/include/sodium/crypto_sign.h index e1cc8a12..85aff0c9 100644 --- a/src/libsodium/include/sodium/crypto_sign.h +++ b/src/libsodium/include/sodium/crypto_sign.h @@ -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 diff --git a/src/libsodium/include/sodium/crypto_sign_ed25519.h b/src/libsodium/include/sodium/crypto_sign_ed25519.h index 95f0cbc4..38d2b9dd 100644 --- a/src/libsodium/include/sodium/crypto_sign_ed25519.h +++ b/src/libsodium/include/sodium/crypto_sign_ed25519.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_stream.h b/src/libsodium/include/sodium/crypto_stream.h index 52ab20a9..d288f0b6 100644 --- a/src/libsodium/include/sodium/crypto_stream.h +++ b/src/libsodium/include/sodium/crypto_stream.h @@ -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 diff --git a/src/libsodium/include/sodium/crypto_stream_chacha20.h b/src/libsodium/include/sodium/crypto_stream_chacha20.h index d4e76b79..d3e2b234 100644 --- a/src/libsodium/include/sodium/crypto_stream_chacha20.h +++ b/src/libsodium/include/sodium/crypto_stream_chacha20.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_stream_salsa20.h b/src/libsodium/include/sodium/crypto_stream_salsa20.h index 011b830a..0c7688c7 100644 --- a/src/libsodium/include/sodium/crypto_stream_salsa20.h +++ b/src/libsodium/include/sodium/crypto_stream_salsa20.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_stream_salsa2012.h b/src/libsodium/include/sodium/crypto_stream_salsa2012.h index cd34501a..c93d1c81 100644 --- a/src/libsodium/include/sodium/crypto_stream_salsa2012.h +++ b/src/libsodium/include/sodium/crypto_stream_salsa2012.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_stream_salsa208.h b/src/libsodium/include/sodium/crypto_stream_salsa208.h index ec3f1bee..b7bc0d96 100644 --- a/src/libsodium/include/sodium/crypto_stream_salsa208.h +++ b/src/libsodium/include/sodium/crypto_stream_salsa208.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_stream_xchacha20.h b/src/libsodium/include/sodium/crypto_stream_xchacha20.h index bcce05cd..cf0407ff 100644 --- a/src/libsodium/include/sodium/crypto_stream_xchacha20.h +++ b/src/libsodium/include/sodium/crypto_stream_xchacha20.h @@ -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, diff --git a/src/libsodium/include/sodium/crypto_stream_xsalsa20.h b/src/libsodium/include/sodium/crypto_stream_xsalsa20.h index 3912fe3d..cb4c44a8 100644 --- a/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +++ b/src/libsodium/include/sodium/crypto_stream_xsalsa20.h @@ -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, diff --git a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c index 85ec69c4..3b06d9c6 100644 --- a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c @@ -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 diff --git a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c index def65f2e..e78e52eb 100644 --- a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +++ b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c @@ -25,6 +25,7 @@ #endif #include "core.h" +#include "private/common.h" #include "randombytes.h" #include "randombytes_sysrandom.h" #include "utils.h" diff --git a/test/constcheck.sh b/test/constcheck.sh new file mode 100755 index 00000000..350753a1 --- /dev/null +++ b/test/constcheck.sh @@ -0,0 +1,18 @@ +#! /bin/sh + +CT='ct.c' + +echo '#include ' > "$CT" +echo '#include ' >> "$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" + diff --git a/test/default/aead_aes256gcm.c b/test/default/aead_aes256gcm.c index 94c9a3e1..abfed6ab 100644 --- a/test/default/aead_aes256gcm.c +++ b/test/default/aead_aes256gcm.c @@ -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; diff --git a/test/default/aead_chacha20poly1305.c b/test/default/aead_chacha20poly1305.c index 4f867579..85653e69 100644 --- a/test/default/aead_chacha20poly1305.c +++ b/test/default/aead_chacha20poly1305.c @@ -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; } diff --git a/test/default/aead_xchacha20poly1305.c b/test/default/aead_xchacha20poly1305.c index e20a8d70..7924038d 100644 --- a/test/default/aead_xchacha20poly1305.c +++ b/test/default/aead_xchacha20poly1305.c @@ -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; } diff --git a/test/default/box.c b/test/default/box.c index 917e4dc4..228aca7b 100644 --- a/test/default/box.c +++ b/test/default/box.c @@ -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; } diff --git a/test/default/chacha20.c b/test/default/chacha20.c index facd6e60..319403e3 100644 --- a/test/default/chacha20.c +++ b/test/default/chacha20.c @@ -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; } diff --git a/test/default/secretbox.c b/test/default/secretbox.c index cf5823e2..df1d62ff 100644 --- a/test/default/secretbox.c +++ b/test/default/secretbox.c @@ -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; } diff --git a/test/default/sign.c b/test/default/sign.c index 193270c8..a577df80 100644 --- a/test/default/sign.c +++ b/test/default/sign.c @@ -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() diff --git a/test/default/stream.c b/test/default/stream.c index ccc8d15e..150fe780 100644 --- a/test/default/stream.c +++ b/test/default/stream.c @@ -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; } diff --git a/test/default/stream2.c b/test/default/stream2.c index 63e0c0ee..8e5b3f67 100644 --- a/test/default/stream2.c +++ b/test/default/stream2.c @@ -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; } diff --git a/test/default/xchacha20.c b/test/default/xchacha20.c index dbe29f35..15e5b9a1 100644 --- a/test/default/xchacha20.c +++ b/test/default/xchacha20.c @@ -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"); }