From 1cdf60c9143d23edea628006563f20d64bff7075 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 6 Apr 2021 09:36:58 +0530 Subject: [PATCH] libsodium: Update library to v1.0.18 --- components/libsodium/CMakeLists.txt | 62 +++++++++---------- components/libsodium/component.mk | 3 +- components/libsodium/libsodium | 2 +- components/libsodium/port/randombytes_esp32.c | 2 +- ...bytes_default.h => randombytes_internal.h} | 0 5 files changed, 34 insertions(+), 35 deletions(-) rename components/libsodium/port/{randombytes_default.h => randombytes_internal.h} (100%) diff --git a/components/libsodium/CMakeLists.txt b/components/libsodium/CMakeLists.txt index 48b5a39bd1..4377e683b1 100644 --- a/components/libsodium/CMakeLists.txt +++ b/components/libsodium/CMakeLists.txt @@ -12,49 +12,50 @@ set(srcs "${SRC}/crypto_box/crypto_box_easy.c" "${SRC}/crypto_box/crypto_box_seal.c" "${SRC}/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c" + "${SRC}/crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c" "${SRC}/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c" - "${SRC}/crypto_core/curve25519/ref10/curve25519_ref10.c" + "${SRC}/crypto_core/ed25519/core_ed25519.c" + "${SRC}/crypto_core/ed25519/core_ristretto255.c" + "${SRC}/crypto_core/ed25519/ref10/ed25519_ref10.c" "${SRC}/crypto_core/hchacha20/core_hchacha20.c" "${SRC}/crypto_core/hsalsa20/core_hsalsa20.c" "${SRC}/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c" "${SRC}/crypto_core/salsa/ref/core_salsa_ref.c" - "${SRC}/crypto_generichash/crypto_generichash.c" "${SRC}/crypto_generichash/blake2b/generichash_blake2.c" "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c" "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-ref.c" - "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c" "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c" "${SRC}/crypto_generichash/blake2b/ref/blake2b-ref.c" "${SRC}/crypto_generichash/blake2b/ref/generichash_blake2b.c" + "${SRC}/crypto_generichash/crypto_generichash.c" "${SRC}/crypto_hash/crypto_hash.c" - "${SRC}/crypto_hash/sha256/hash_sha256.c" "${SRC}/crypto_hash/sha256/cp/hash_sha256_cp.c" - "${SRC}/crypto_hash/sha512/hash_sha512.c" + "${SRC}/crypto_hash/sha256/hash_sha256.c" "${SRC}/crypto_hash/sha512/cp/hash_sha512_cp.c" - "${SRC}/crypto_kdf/crypto_kdf.c" + "${SRC}/crypto_hash/sha512/hash_sha512.c" "${SRC}/crypto_kdf/blake2b/kdf_blake2b.c" + "${SRC}/crypto_kdf/crypto_kdf.c" "${SRC}/crypto_kx/crypto_kx.c" "${SRC}/crypto_onetimeauth/crypto_onetimeauth.c" - "${SRC}/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c" "${SRC}/crypto_onetimeauth/poly1305/donna/poly1305_donna.c" - "${SRC}/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c" - "${SRC}/crypto_pwhash/crypto_pwhash.c" + "${SRC}/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c" "${SRC}/crypto_pwhash/argon2/argon2-core.c" "${SRC}/crypto_pwhash/argon2/argon2-encoding.c" + "${SRC}/crypto_pwhash/argon2/argon2-fill-block-avx2.c" + "${SRC}/crypto_pwhash/argon2/argon2-fill-block-avx512f.c" "${SRC}/crypto_pwhash/argon2/argon2-fill-block-ref.c" "${SRC}/crypto_pwhash/argon2/argon2-fill-block-ssse3.c" "${SRC}/crypto_pwhash/argon2/argon2.c" "${SRC}/crypto_pwhash/argon2/blake2b-long.c" "${SRC}/crypto_pwhash/argon2/pwhash_argon2i.c" + "${SRC}/crypto_pwhash/argon2/pwhash_argon2id.c" + "${SRC}/crypto_pwhash/crypto_pwhash.c" "${SRC}/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c" + "${SRC}/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c" "${SRC}/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c" "${SRC}/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c" "${SRC}/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c" - "${SRC}/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c" - "${SRC}/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c" "${SRC}/crypto_scalarmult/crypto_scalarmult.c" - "${SRC}/crypto_scalarmult/curve25519/scalarmult_curve25519.c" - "${SRC}/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c" "${SRC}/crypto_scalarmult/curve25519/ref10/x25519_ref10.c" "${SRC}/crypto_scalarmult/curve25519/sandy2x/consts.S" "${SRC}/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c" @@ -64,52 +65,46 @@ set(srcs "${SRC}/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S" "${SRC}/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c" "${SRC}/crypto_scalarmult/curve25519/sandy2x/ladder.S" - "${SRC}/crypto_scalarmult/curve25519/sandy2x/ladder_base.S" "${SRC}/crypto_scalarmult/curve25519/sandy2x/sandy2x.S" + "${SRC}/crypto_scalarmult/curve25519/scalarmult_curve25519.c" + "${SRC}/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c" + "${SRC}/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c" "${SRC}/crypto_secretbox/crypto_secretbox.c" "${SRC}/crypto_secretbox/crypto_secretbox_easy.c" "${SRC}/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c" "${SRC}/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c" + "${SRC}/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c" "${SRC}/crypto_shorthash/crypto_shorthash.c" - "${SRC}/crypto_shorthash/siphash24/shorthash_siphash24.c" - "${SRC}/crypto_shorthash/siphash24/shorthash_siphashx24.c" "${SRC}/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c" "${SRC}/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c" + "${SRC}/crypto_shorthash/siphash24/shorthash_siphash24.c" + "${SRC}/crypto_shorthash/siphash24/shorthash_siphashx24.c" "${SRC}/crypto_sign/crypto_sign.c" - "${SRC}/crypto_sign/ed25519/sign_ed25519.c" "${SRC}/crypto_sign/ed25519/ref10/keypair.c" "${SRC}/crypto_sign/ed25519/ref10/obsolete.c" "${SRC}/crypto_sign/ed25519/ref10/open.c" "${SRC}/crypto_sign/ed25519/ref10/sign.c" - "${SRC}/crypto_stream/crypto_stream.c" - "${SRC}/crypto_stream/aes128ctr/stream_aes128ctr.c" - "${SRC}/crypto_stream/aes128ctr/nacl/afternm_aes128ctr.c" - "${SRC}/crypto_stream/aes128ctr/nacl/beforenm_aes128ctr.c" - "${SRC}/crypto_stream/aes128ctr/nacl/consts_aes128ctr.c" - "${SRC}/crypto_stream/aes128ctr/nacl/int128_aes128ctr.c" - "${SRC}/crypto_stream/aes128ctr/nacl/stream_aes128ctr_nacl.c" - "${SRC}/crypto_stream/aes128ctr/nacl/xor_afternm_aes128ctr.c" - "${SRC}/crypto_stream/chacha20/stream_chacha20.c" + "${SRC}/crypto_sign/ed25519/sign_ed25519.c" "${SRC}/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c" "${SRC}/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c" "${SRC}/crypto_stream/chacha20/ref/chacha20_ref.c" - "${SRC}/crypto_stream/salsa20/stream_salsa20.c" + "${SRC}/crypto_stream/chacha20/stream_chacha20.c" + "${SRC}/crypto_stream/crypto_stream.c" "${SRC}/crypto_stream/salsa20/ref/salsa20_ref.c" + "${SRC}/crypto_stream/salsa20/stream_salsa20.c" "${SRC}/crypto_stream/salsa20/xmm6/salsa20_xmm6-asm.S" "${SRC}/crypto_stream/salsa20/xmm6/salsa20_xmm6.c" "${SRC}/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c" "${SRC}/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c" - "${SRC}/crypto_stream/salsa2012/stream_salsa2012.c" "${SRC}/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c" - "${SRC}/crypto_stream/salsa208/stream_salsa208.c" + "${SRC}/crypto_stream/salsa2012/stream_salsa2012.c" "${SRC}/crypto_stream/salsa208/ref/stream_salsa208_ref.c" + "${SRC}/crypto_stream/salsa208/stream_salsa208.c" "${SRC}/crypto_stream/xchacha20/stream_xchacha20.c" "${SRC}/crypto_stream/xsalsa20/stream_xsalsa20.c" "${SRC}/crypto_verify/sodium/verify.c" "${SRC}/randombytes/randombytes.c" - "${SRC}/randombytes/nativeclient/randombytes_nativeclient.c" - "${SRC}/randombytes/salsa20/randombytes_salsa20_random.c" - "${SRC}/randombytes/sysrandom/randombytes_sysrandom.c" + "${SRC}/sodium/codecs.c" "${SRC}/sodium/core.c" "${SRC}/sodium/runtime.c" "${SRC}/sodium/utils.c" @@ -144,6 +139,7 @@ target_compile_definitions(${COMPONENT_LIB} PRIVATE # patch around warnings in third-party files set_source_files_properties( ${SRC}/crypto_pwhash/argon2/pwhash_argon2i.c + ${SRC}/crypto_pwhash/argon2/pwhash_argon2id.c ${SRC}/crypto_pwhash/argon2/argon2-core.c ${SRC}/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c PROPERTIES COMPILE_FLAGS @@ -173,3 +169,5 @@ set_source_files_properties( PROPERTIES COMPILE_FLAGS -DRANDOMBYTES_DEFAULT_IMPLEMENTATION ) + +target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-function) diff --git a/components/libsodium/component.mk b/components/libsodium/component.mk index 12dcb571a5..610c83cd2b 100644 --- a/components/libsodium/component.mk +++ b/components/libsodium/component.mk @@ -70,6 +70,7 @@ endif # (not applied to whole component as we compile some of our own files, also.) $(LSRC)/crypto_pwhash/argon2/argon2-fill-block-ref.o: CFLAGS += -Wno-unknown-pragmas $(LSRC)/crypto_pwhash/argon2/pwhash_argon2i.o: CFLAGS += -Wno-type-limits +$(LSRC)/crypto_pwhash/argon2/pwhash_argon2id.o: CFLAGS += -Wno-type-limits $(LSRC)/crypto_pwhash/argon2/argon2-core.o: CFLAGS += -Wno-type-limits $(LSRC)/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.o: CFLAGS += -Wno-type-limits $(LSRC)/sodium/utils.o: CFLAGS += -Wno-unused-variable @@ -79,7 +80,7 @@ COMPONENT_PRIV_INCLUDEDIRS := $(LSRC)/include/sodium port_include/sodium port # Not using autoconf, but this needs to be set -CFLAGS += -DCONFIGURED +CFLAGS += -DCONFIGURED -Wno-unused-function # Add the options from configure.ac (this needs checking if new versions are added ) CFLAGS += -DNATIVE_LITTLE_ENDIAN -DHAVE_WEAK_SYMBOLS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/components/libsodium/libsodium b/components/libsodium/libsodium index 70170c28c8..4f5e89fa84 160000 --- a/components/libsodium/libsodium +++ b/components/libsodium/libsodium @@ -1 +1 @@ -Subproject commit 70170c28c844a4786e75efc626e1aeebc93caebc +Subproject commit 4f5e89fa84ce1d178a6765b8b46f2b6f91216677 diff --git a/components/libsodium/port/randombytes_esp32.c b/components/libsodium/port/randombytes_esp32.c index 73c77ec692..d88449fc44 100644 --- a/components/libsodium/port/randombytes_esp32.c +++ b/components/libsodium/port/randombytes_esp32.c @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "randombytes_default.h" +#include "randombytes_internal.h" #include "esp_system.h" static const char *randombytes_esp32_implementation_name(void) diff --git a/components/libsodium/port/randombytes_default.h b/components/libsodium/port/randombytes_internal.h similarity index 100% rename from components/libsodium/port/randombytes_default.h rename to components/libsodium/port/randombytes_internal.h