From d9863128b9ebd012b18104fdf77227b6b1e052ba Mon Sep 17 00:00:00 2001 From: despair Date: Tue, 13 Nov 2018 10:02:54 -0600 Subject: [PATCH] the intrinsic variant is 32-bit clean the ASM variant is not found it fix something is wrong with the external build hmm why is this critical section doing nothing fix multiple init debug init ok fixed --- CMakeLists.txt | 9 +++++---- crypto/libsodium/init.c | 3 ++- crypto/salsa20/xmm6int/salsa20_xmm6int-avx2.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bae23e2a..43c5494f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,23 +36,24 @@ add_compile_options(-Wvla) add_compile_options($<$:-fpermissive>) add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas) -# gah, can't recall which -Wno flag is exclusive to clang -# -Wno-cast-function-type is GNU exclusive..i think if (WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE) # dynamic linking does this all the time -add_compile_options(-Wno-cast-function-type) if (USING_CLANG) add_compile_options(-Wno-unused-command-line-argument -Wno-c++11-narrowing) add_compile_options($<$:-Wno-bad-function-cast>) # because clang is insane enough to inline whole sections of the C++ library! # May have been fixed in llvm-7. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition --rtlib=libgcc") +else() +# found it. this is GNU only +add_compile_options(-Wno-cast-function-type) endif(USING_CLANG) +else() +add_compile_options(-Wno-cast-function-type) endif() if(WIN32) add_compile_options($<$:-Wno-bad-function-cast>) -add_compile_options(-Wno-cast-function-type) set(FS_LIB stdc++fs) endif(WIN32) diff --git a/crypto/libsodium/init.c b/crypto/libsodium/init.c index 4dbd73e20..f5232c79d 100644 --- a/crypto/libsodium/init.c +++ b/crypto/libsodium/init.c @@ -35,7 +35,8 @@ sodium_init(void) { return -1; /* LCOV_EXCL_LINE */ } - return 1; + /* if we're here, we already started properly */ + return initialized ? 0: -1; } _sodium_runtime_get_cpu_features(); _crypto_generichash_blake2b_pick_best_implementation(); diff --git a/crypto/salsa20/xmm6int/salsa20_xmm6int-avx2.c b/crypto/salsa20/xmm6int/salsa20_xmm6int-avx2.c index 0c7ac8e7f..2e8a0e202 100644 --- a/crypto/salsa20/xmm6int/salsa20_xmm6int-avx2.c +++ b/crypto/salsa20/xmm6int/salsa20_xmm6int-avx2.c @@ -8,7 +8,7 @@ #include #include -#if __AVX2__ && __amd64__ +#if __AVX2__ #ifdef __GNUC__ #pragma GCC target("sse2")