Ver Fonte

libsodium: Update library to v1.0.18

Aditya Patwardhan há 4 anos atrás
pai
commit
dfd6c5cb0b

+ 30 - 32
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
@@ -174,6 +170,8 @@ set_source_files_properties(
     -DRANDOMBYTES_DEFAULT_IMPLEMENTATION
 )
 
+target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-function)
+
 if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
     # some libsodium variables are only used for asserts
     target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-but-set-variable)

+ 2 - 1
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

+ 1 - 1
components/libsodium/libsodium

@@ -1 +1 @@
-Subproject commit 70170c28c844a4786e75efc626e1aeebc93caebc
+Subproject commit 4f5e89fa84ce1d178a6765b8b46f2b6f91216677

+ 1 - 1
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_esp32xx_implementation_name(void)

+ 0 - 0
components/libsodium/port/randombytes_default.h → components/libsodium/port/randombytes_internal.h