From e6aa7e1da4a89ac9fbddf0899f9dd4507579a8b0 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 14 Feb 2019 14:41:09 +0100 Subject: [PATCH] The time has come to remove support for (p)nacl --- .../msvc/vs2010/libsodium/libsodium.vcxproj | 2 - .../libsodium/libsodium.vcxproj.filters | 9 - .../msvc/vs2012/libsodium/libsodium.vcxproj | 2 - .../libsodium/libsodium.vcxproj.filters | 9 - .../msvc/vs2013/libsodium/libsodium.vcxproj | 2 - .../libsodium/libsodium.vcxproj.filters | 9 - .../msvc/vs2015/libsodium/libsodium.vcxproj | 2 - .../libsodium/libsodium.vcxproj.filters | 9 - .../msvc/vs2017/libsodium/libsodium.vcxproj | 2 - .../libsodium/libsodium.vcxproj.filters | 9 - configure.ac | 34 +--- dist-build/Makefile.am | 3 - dist-build/nativeclient-pnacl.sh | 37 ---- dist-build/nativeclient-x86.sh | 29 ---- dist-build/nativeclient-x86_64.sh | 29 ---- libsodium.vcxproj | 2 - libsodium.vcxproj.filters | 6 - src/libsodium/Makefile.am | 6 - src/libsodium/include/Makefile.am | 5 - src/libsodium/include/sodium.h | 3 - .../include/sodium/randombytes_nativeclient.h | 23 --- .../nativeclient/randombytes_nativeclient.c | 61 ------- src/libsodium/randombytes/randombytes.c | 12 +- src/libsodium/sodium/core.c | 2 +- test/default/Makefile.am | 158 ------------------ test/default/nacl-test-wrapper.sh | 35 ---- test/default/randombytes.c | 6 - test/quirks/quirks.h | 17 -- 28 files changed, 7 insertions(+), 516 deletions(-) delete mode 100755 dist-build/nativeclient-pnacl.sh delete mode 100755 dist-build/nativeclient-x86.sh delete mode 100755 dist-build/nativeclient-x86_64.sh delete mode 100644 src/libsodium/include/sodium/randombytes_nativeclient.h delete mode 100644 src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c delete mode 100755 test/default/nacl-test-wrapper.sh diff --git a/builds/msvc/vs2010/libsodium/libsodium.vcxproj b/builds/msvc/vs2010/libsodium/libsodium.vcxproj index ec340a17..62fa4f36 100644 --- a/builds/msvc/vs2010/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2010/libsodium/libsodium.vcxproj @@ -139,7 +139,6 @@ - @@ -227,7 +226,6 @@ - diff --git a/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters index 079094b9..d4d97413 100644 --- a/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters @@ -210,9 +210,6 @@ randombytes\salsa20 - - randombytes\nativeclient - crypto_box @@ -470,9 +467,6 @@ include\sodium - - include\sodium - include\sodium @@ -973,9 +967,6 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - {7450ec6e-c197-3798-9434-1b46c8c4d9af} diff --git a/builds/msvc/vs2012/libsodium/libsodium.vcxproj b/builds/msvc/vs2012/libsodium/libsodium.vcxproj index f140d161..482284ec 100644 --- a/builds/msvc/vs2012/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2012/libsodium/libsodium.vcxproj @@ -139,7 +139,6 @@ - @@ -227,7 +226,6 @@ - diff --git a/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters index 079094b9..d4d97413 100644 --- a/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters @@ -210,9 +210,6 @@ randombytes\salsa20 - - randombytes\nativeclient - crypto_box @@ -470,9 +467,6 @@ include\sodium - - include\sodium - include\sodium @@ -973,9 +967,6 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - {7450ec6e-c197-3798-9434-1b46c8c4d9af} diff --git a/builds/msvc/vs2013/libsodium/libsodium.vcxproj b/builds/msvc/vs2013/libsodium/libsodium.vcxproj index cddd4ad6..f41661f0 100644 --- a/builds/msvc/vs2013/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2013/libsodium/libsodium.vcxproj @@ -139,7 +139,6 @@ - @@ -227,7 +226,6 @@ - diff --git a/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters index 079094b9..d4d97413 100644 --- a/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters @@ -210,9 +210,6 @@ randombytes\salsa20 - - randombytes\nativeclient - crypto_box @@ -470,9 +467,6 @@ include\sodium - - include\sodium - include\sodium @@ -973,9 +967,6 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - {7450ec6e-c197-3798-9434-1b46c8c4d9af} diff --git a/builds/msvc/vs2015/libsodium/libsodium.vcxproj b/builds/msvc/vs2015/libsodium/libsodium.vcxproj index 230086a9..13e08b85 100644 --- a/builds/msvc/vs2015/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2015/libsodium/libsodium.vcxproj @@ -139,7 +139,6 @@ - @@ -227,7 +226,6 @@ - diff --git a/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters index 079094b9..d4d97413 100644 --- a/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters @@ -210,9 +210,6 @@ randombytes\salsa20 - - randombytes\nativeclient - crypto_box @@ -470,9 +467,6 @@ include\sodium - - include\sodium - include\sodium @@ -973,9 +967,6 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - {7450ec6e-c197-3798-9434-1b46c8c4d9af} diff --git a/builds/msvc/vs2017/libsodium/libsodium.vcxproj b/builds/msvc/vs2017/libsodium/libsodium.vcxproj index 8a175e0b..1c7b4a95 100644 --- a/builds/msvc/vs2017/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2017/libsodium/libsodium.vcxproj @@ -139,7 +139,6 @@ - @@ -227,7 +226,6 @@ - diff --git a/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters b/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters index 079094b9..d4d97413 100644 --- a/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters +++ b/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters @@ -210,9 +210,6 @@ randombytes\salsa20 - - randombytes\nativeclient - crypto_box @@ -470,9 +467,6 @@ include\sodium - - include\sodium - include\sodium @@ -973,9 +967,6 @@ {ef090484-4db4-3dc2-aca7-c59bab1db23b} - - {fd98b90f-ba7b-3aa0-a505-935c82ca8023} - {7450ec6e-c197-3798-9434-1b46c8c4d9af} diff --git a/configure.ac b/configure.ac index 02619d4a..aad686eb 100644 --- a/configure.ac +++ b/configure.ac @@ -60,7 +60,7 @@ AC_ARG_ENABLE(ssp, ]) AC_ARG_ENABLE(asm, -[AS_HELP_STRING(--disable-asm,[Do not compile assembly code -- As a side effect, this disables CPU-specific implementations on non-Windows platforms. Only for use with targets such as WebAssembly and NativeClient.])], +[AS_HELP_STRING(--disable-asm,[Do not compile assembly code -- As a side effect, this disables CPU-specific implementations on non-Windows platforms. Only for use with targets such as WebAssembly.])], [ AS_IF([test "x$enableval" = "xno"], [ enable_asm="no" @@ -82,10 +82,6 @@ AS_IF([test "x$EMSCRIPTEN" != "x"], [ unset EMSCRIPTEN ]) ]) -AS_IF([test "$host_os" = "nacl" -o "$host_os" = "pnacl"], [ - enable_asm="no" - AC_MSG_WARN([compiling to Native Client - asm implementations disabled]) -]) AC_ARG_ENABLE(pie, [AS_HELP_STRING(--disable-pie,Do not produce position independent executables)], @@ -206,8 +202,6 @@ AM_PROG_AS AC_USE_SYSTEM_EXTENSIONS AC_C_VARARRAYS -AC_CHECK_DEFINE([__native_client__], [NATIVECLIENT="yes"], []) - AC_CHECK_DEFINE([_FORTIFY_SOURCE], [], [ AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"]) @@ -355,7 +349,7 @@ AC_CHECK_TOOL([AR], [ar], [ar]) dnl Checks for headers -AS_IF([test "x$EMSCRIPTEN" = "x" -a "$host_os" != "pnacl"], [ +AS_IF([test "x$EMSCRIPTEN" = "x"], [ oldcflags="$CFLAGS" AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS="$CFLAGS -mmmx"]) @@ -431,9 +425,6 @@ AS_IF([test "x$EMSCRIPTEN" = "x" -a "$host_os" != "pnacl"], [ AX_CHECK_COMPILE_FLAG([-mavx], [CFLAGS="$CFLAGS -mavx"]) AC_MSG_CHECKING(for AVX instructions set) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX opcodes -#endif #pragma GCC target("avx") #include ]], [[ _mm256_zeroall(); ]])], @@ -447,9 +438,6 @@ AS_IF([test "x$EMSCRIPTEN" = "x" -a "$host_os" != "pnacl"], [ AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS="$CFLAGS -mavx2"]) AC_MSG_CHECKING(for AVX2 instructions set) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX2 opcodes -#endif #pragma GCC target("avx2") #include ]], [[ @@ -462,9 +450,6 @@ return _mm256_movemask_ps(_mm256_cmp_ps(x, y, _CMP_NEQ_OQ)); AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS_AVX2="-mavx2"]) AC_MSG_CHECKING(if _mm256_broadcastsi128_si256 is correctly defined) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX2 opcodes -#endif #pragma GCC target("avx2") #include ]], [[ __m256i y = _mm256_broadcastsi128_si256(_mm_setzero_si128()); ]])], @@ -480,9 +465,6 @@ return _mm256_movemask_ps(_mm256_cmp_ps(x, y, _CMP_NEQ_OQ)); AX_CHECK_COMPILE_FLAG([-mavx512f], [CFLAGS="$CFLAGS -mavx512f"]) AC_MSG_CHECKING(for AVX512F instructions set) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AVX512F opcodes -#endif #pragma GCC target("avx512f") #include ]], [[ @@ -516,9 +498,6 @@ __m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS="$CFLAGS -mpclmul"]) AC_MSG_CHECKING(for AESNI instructions set and PCLMULQDQ) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding AESNI opcodes -#endif #pragma GCC target("aes") #pragma GCC target("pclmul") #include @@ -536,9 +515,6 @@ __m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), AX_CHECK_COMPILE_FLAG([-mrdrnd], [CFLAGS="$CFLAGS -mrdrnd"]) AC_MSG_CHECKING(for RDRAND) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifdef __native_client__ -# error NativeClient detected - Avoiding RDRAND opcodes -#endif #pragma GCC target("rdrnd") #include ]], [[ unsigned long long x; _rdrand64_step(&x); ]])], @@ -701,7 +677,7 @@ AM_CONDITIONAL([HAVE_TI_MODE], [test $HAVE_TI_MODE_V = 1]) AC_SUBST(HAVE_TI_MODE_V) HAVE_CPUID_V=0 -AS_IF([test "$enable_asm" != "no" -o "$host_alias" = "x86_64-nacl"],[ +AS_IF([test "$enable_asm" != "no"],[ AC_MSG_CHECKING(for cpuid instruction) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ unsigned int cpu_info[4]; @@ -718,7 +694,7 @@ __asm__ __volatile__ ("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1" : AC_SUBST(HAVE_CPUID_V) asm_hide_symbol="unsupported" -AS_IF([test "$enable_asm" != "no" -o "$host_os" = "nacl"],[ +AS_IF([test "$enable_asm" != "no"],[ AC_MSG_CHECKING(if the .private_extern asm directive is supported) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[ __asm__ __volatile__ (".private_extern dummy_symbol \n" @@ -818,8 +794,6 @@ AS_IF([test "x$EMSCRIPTEN" != "x"],[ AC_SUBST(TEST_LDFLAGS) AM_CONDITIONAL([EMSCRIPTEN], [test "x$EMSCRIPTEN" != "x"]) -AM_CONDITIONAL([NATIVECLIENT], [test "x$NATIVECLIENT" != "x"]) - AC_DEFINE([CONFIGURED], [1], [the build system was properly configured]) dnl Libtool. diff --git a/dist-build/Makefile.am b/dist-build/Makefile.am index 63a8298f..01d35ce7 100644 --- a/dist-build/Makefile.am +++ b/dist-build/Makefile.am @@ -12,7 +12,4 @@ EXTRA_DIST = \ ios.sh \ msys2-win32.sh \ msys2-win64.sh \ - nativeclient-pnacl.sh \ - nativeclient-x86.sh \ - nativeclient-x86_64.sh \ watchos.sh diff --git a/dist-build/nativeclient-pnacl.sh b/dist-build/nativeclient-pnacl.sh deleted file mode 100755 index 020bb52c..00000000 --- a/dist-build/nativeclient-pnacl.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh - -export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} -export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_pnacl"} -export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} -export PREFIX="$(pwd)/libsodium-nativeclient" -export PATH="${NACL_BIN}:$PATH" -export AR=${AR-"pnacl-ar"} -export AS=${AS-"pnacl-as"} -export CC=${CC-"pnacl-clang"} -export LD=${LD-"pnacl-ld"} -export NM=${NM-"pnacl-nm"} -export RANLIB=${RANLIB-"pnacl-ranlib"} -export PNACL_FINALIZE=${PNACL_FINALIZE-"pnacl-finalize"} -export PNACL_TRANSLATE=${PNACL_TRANSLATE-"pnacl-translate"} -export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" - -mkdir -p $PREFIX || exit 1 - -make distclean > /dev/null - -if [ -z "$LIBSODIUM_FULL_BUILD" ]; then - export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" -else - export LIBSODIUM_ENABLE_MINIMAL_FLAG="" -fi - -./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ - --host=nacl \ - --disable-ssp --without-pthreads \ - --prefix="$PREFIX" || exit 1 - - -NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) -PROCESSORS=${NPROCESSORS:-3} - -make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1 diff --git a/dist-build/nativeclient-x86.sh b/dist-build/nativeclient-x86.sh deleted file mode 100755 index 975add58..00000000 --- a/dist-build/nativeclient-x86.sh +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/sh - -export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} -export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_x86_glibc"} -export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} -export PREFIX="$(pwd)/libsodium-nativeclient-x86" -export PATH="${NACL_BIN}:$PATH" -export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" - -mkdir -p $PREFIX || exit 1 - -make distclean > /dev/null - -if [ -z "$LIBSODIUM_FULL_BUILD" ]; then - export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" -else - export LIBSODIUM_ENABLE_MINIMAL_FLAG="" -fi - - -./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ - --host=i686-nacl \ - --disable-ssp --without-pthreads \ - --prefix="$PREFIX" || exit 1 - -NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) -PROCESSORS=${NPROCESSORS:-3} - -make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1 diff --git a/dist-build/nativeclient-x86_64.sh b/dist-build/nativeclient-x86_64.sh deleted file mode 100755 index 43a44c8e..00000000 --- a/dist-build/nativeclient-x86_64.sh +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/sh - -export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} -export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_x86_glibc"} -export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} -export PREFIX="$(pwd)/libsodium-nativeclient-x86_64" -export PATH="${NACL_BIN}:$PATH" -export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" - -mkdir -p $PREFIX || exit 1 - -make distclean > /dev/null - -if [ -z "$LIBSODIUM_FULL_BUILD" ]; then - export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" -else - export LIBSODIUM_ENABLE_MINIMAL_FLAG="" -fi - -./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ - --host=x86_64-nacl \ - --disable-ssp --without-pthreads \ - --prefix="$PREFIX" || exit 1 - - -NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) -PROCESSORS=${NPROCESSORS:-3} - -make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1 diff --git a/libsodium.vcxproj b/libsodium.vcxproj index 63d5f956..0828adaf 100644 --- a/libsodium.vcxproj +++ b/libsodium.vcxproj @@ -377,7 +377,6 @@ - @@ -465,7 +464,6 @@ - diff --git a/libsodium.vcxproj.filters b/libsodium.vcxproj.filters index b4a4ea96..ecd8d01c 100644 --- a/libsodium.vcxproj.filters +++ b/libsodium.vcxproj.filters @@ -201,9 +201,6 @@ Source Files - - Source Files - Source Files @@ -461,9 +458,6 @@ Header Files - - Header Files - Header Files diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 2c3d210f..7649f27d 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -208,16 +208,10 @@ if !EMSCRIPTEN libsodium_la_LIBADD += librdrand.la noinst_LTLIBRARIES += librdrand.la -if NATIVECLIENT -libsodium_la_SOURCES += \ - randombytes/nativeclient/randombytes_nativeclient.c -else libsodium_la_SOURCES += \ randombytes/sysrandom/randombytes_sysrandom.c endif -endif - libaesni_la_LDFLAGS = $(libsodium_la_LDFLAGS) libaesni_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \ @CFLAGS_SSE2@ @CFLAGS_SSSE3@ @CFLAGS_AESNI@ @CFLAGS_PCLMUL@ diff --git a/src/libsodium/include/Makefile.am b/src/libsodium/include/Makefile.am index b70c22b3..c7d5121f 100644 --- a/src/libsodium/include/Makefile.am +++ b/src/libsodium/include/Makefile.am @@ -61,11 +61,6 @@ SODIUM_EXPORT = \ sodium/runtime.h \ sodium/utils.h -if NATIVECLIENT -SODIUM_EXPORT += \ - sodium/randombytes_nativeclient.h -endif - EXTRA_SRC = $(SODIUM_EXPORT) \ sodium/version.h.in diff --git a/src/libsodium/include/sodium.h b/src/libsodium/include/sodium.h index e7b1af46..ecc8f689 100644 --- a/src/libsodium/include/sodium.h +++ b/src/libsodium/include/sodium.h @@ -48,9 +48,6 @@ #include "sodium/crypto_verify_32.h" #include "sodium/crypto_verify_64.h" #include "sodium/randombytes.h" -#ifdef __native_client__ -# include "sodium/randombytes_nativeclient.h" -#endif #include "sodium/randombytes_salsa20_random.h" #include "sodium/randombytes_sysrandom.h" #include "sodium/runtime.h" diff --git a/src/libsodium/include/sodium/randombytes_nativeclient.h b/src/libsodium/include/sodium/randombytes_nativeclient.h deleted file mode 100644 index 5158d8c3..00000000 --- a/src/libsodium/include/sodium/randombytes_nativeclient.h +++ /dev/null @@ -1,23 +0,0 @@ - -#ifndef randombytes_nativeclient_H -#define randombytes_nativeclient_H - -#ifdef __native_client__ - -# include "export.h" -# include "randombytes.h" - -# ifdef __cplusplus -extern "C" { -# endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_nativeclient_implementation; - -# ifdef __cplusplus -} -# endif - -#endif - -#endif diff --git a/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c b/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c deleted file mode 100644 index 85ffa9b2..00000000 --- a/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c +++ /dev/null @@ -1,61 +0,0 @@ - -#include -#include -#include - -#ifdef __native_client__ -# include - -# include "core.h" -# include "utils.h" -# include "randombytes.h" -# include "randombytes_nativeclient.h" - -static void -randombytes_nativeclient_buf(void * const buf, const size_t size) -{ - unsigned char *buf_ = (unsigned char *) buf; - struct nacl_irt_random rand_intf; - size_t readnb = (size_t) 0U; - size_t toread = size; - - if (nacl_interface_query(NACL_IRT_RANDOM_v0_1, &rand_intf, - sizeof rand_intf) != sizeof rand_intf) { - sodium_misuse(); - } - while (toread > (size_t) 0U) { - if (rand_intf.get_random_bytes(buf_, size, &readnb) != 0 || - readnb > size) { - sodium_misuse(); - } - toread -= readnb; - buf_ += readnb; - } -} - -static uint32_t -randombytes_nativeclient_random(void) -{ - uint32_t r; - - randombytes_nativeclient_buf(&r, sizeof r); - - return r; -} - -static const char * -randombytes_nativeclient_implementation_name(void) -{ - return "nativeclient"; -} - -struct randombytes_implementation randombytes_nativeclient_implementation = { - SODIUM_C99(.implementation_name =) randombytes_nativeclient_implementation_name, - SODIUM_C99(.random =) randombytes_nativeclient_random, - SODIUM_C99(.stir =) NULL, - SODIUM_C99(.uniform =) NULL, - SODIUM_C99(.buf =) randombytes_nativeclient_buf, - SODIUM_C99(.close =) NULL -}; - -#endif diff --git a/src/libsodium/randombytes/randombytes.c b/src/libsodium/randombytes/randombytes.c index 4c1a536e..0be338ef 100644 --- a/src/libsodium/randombytes/randombytes.c +++ b/src/libsodium/randombytes/randombytes.c @@ -16,11 +16,7 @@ #ifdef RANDOMBYTES_DEFAULT_IMPLEMENTATION # include "randombytes_default.h" #else -# ifdef __native_client__ -# include "randombytes_nativeclient.h" -# else -# include "randombytes_sysrandom.h" -# endif +# include "randombytes_sysrandom.h" #endif #include "private/common.h" @@ -33,11 +29,7 @@ static const randombytes_implementation *implementation; # ifdef __EMSCRIPTEN__ # define RANDOMBYTES_DEFAULT_IMPLEMENTATION NULL # else -# ifdef __native_client__ -# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_nativeclient_implementation; -# else -# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_sysrandom_implementation; -# endif +# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_sysrandom_implementation; # endif #endif diff --git a/src/libsodium/sodium/core.c b/src/libsodium/sodium/core.c index f2456fe1..7a6943d1 100644 --- a/src/libsodium/sodium/core.c +++ b/src/libsodium/sodium/core.c @@ -136,7 +136,7 @@ sodium_crit_leave(void) return pthread_mutex_unlock(&_sodium_lock); } -#elif defined(HAVE_ATOMIC_OPS) && !defined(__EMSCRIPTEN__) && !defined(__native_client__) +#elif defined(HAVE_ATOMIC_OPS) && !defined(__EMSCRIPTEN__) static volatile int _sodium_lock; diff --git a/test/default/Makefile.am b/test/default/Makefile.am index 12869590..5a95c123 100644 --- a/test/default/Makefile.am +++ b/test/default/Makefile.am @@ -158,158 +158,6 @@ DISTCLEANFILES = \ verify1.res \ xchacha20.res -if NATIVECLIENT -CLEANFILES = \ - aead_aes256gcm.final \ - aead_aes256gcm2.final \ - aead_chacha20poly1305.final \ - aead_chacha20poly13052.final \ - aead_xchacha20poly1305.final \ - auth.final \ - auth2.final \ - auth3.final \ - auth5.final \ - auth6.final \ - auth7.final \ - box.final \ - box2.final \ - box7.final \ - box8.final \ - box_easy.final \ - box_easy2.final \ - box_seal.final \ - box_seed.final \ - chacha20.final \ - codecs.final \ - core_ed25519.final \ - core1.final \ - core2.final \ - core3.final \ - core4.final \ - core5.final \ - core6.final \ - ed25519_convert.final \ - generichash.final \ - generichash2.final \ - generichash3.final \ - hash.final \ - hash2.final \ - hash3.final \ - kdf.final \ - keygen.final \ - kx.final \ - metamorphic.final \ - misuse.final \ - onetimeauth.final \ - onetimeauth2.final \ - onetimeauth7.final \ - pwhash_argon2i.final \ - pwhash_argon2id.final \ - pwhash_scrypt.final \ - pwhash_scrypt_ll.final \ - randombytes.final \ - scalarmult.final \ - scalarmult_ed25519.final \ - scalarmult2.final \ - scalarmult5.final \ - scalarmult6.final \ - scalarmult7.final \ - scalarmult8.final \ - secretbox.final \ - secretbox2.final \ - secretbox7.final \ - secretbox8.final \ - secretbox_easy.final \ - secretbox_easy2.final \ - secretstream.final \ - shorthash.final \ - sign.final \ - siphashx24.final \ - sodium_core.final \ - sodium_utils.final \ - sodium_version.final \ - stream.final \ - stream2.final \ - stream3.final \ - stream4.final \ - verify1.final \ - xchacha20.final \ - aead_aes256gcm.nexe \ - aead_aes256gcm2.nexe \ - aead_chacha20poly1305.nexe \ - aead_chacha20poly13052.nexe \ - aead_xchacha20poly1305.nexe \ - auth.nexe \ - auth2.nexe \ - auth3.nexe \ - auth5.nexe \ - auth6.nexe \ - auth7.nexe \ - box.nexe \ - box2.nexe \ - box7.nexe \ - box8.nexe \ - box_easy.nexe \ - box_easy2.nexe \ - box_seal.nexe \ - box_seed.nexe \ - chacha20.nexe \ - codecs.nexe \ - core_ed25519.nexe \ - core1.nexe \ - core2.nexe \ - core3.nexe \ - core4.nexe \ - core5.nexe \ - core6.nexe \ - ed25519_convert.nexe \ - generichash.nexe \ - generichash2.nexe \ - generichash3.nexe \ - hash.nexe \ - hash2.nexe \ - hash3.nexe \ - kdf.nexe \ - keygen.nexe \ - kx.nexe \ - metamorphic.nexe \ - misuse.nexe \ - onetimeauth.nexe \ - onetimeauth2.nexe \ - onetimeauth7.nexe \ - pwhash_argon2i.nexe \ - pwhash_argon2id.nexe \ - pwhash_scrypt.nexe \ - pwhash_scrypt_ll.nexe \ - randombytes.nexe \ - scalarmult.nexe \ - scalarmult_ed25519.nexe \ - scalarmult2.nexe \ - scalarmult5.nexe \ - scalarmult6.nexe \ - scalarmult7.nexe \ - scalarmult8.nexe \ - secretbox.nexe \ - secretbox2.nexe \ - secretbox7.nexe \ - secretbox8.nexe \ - secretbox_easy.nexe \ - secretbox_easy2.nexe \ - secretstream.nexe \ - shorthash.nexe \ - sign.nexe \ - siphashx24.nexe \ - sodium_core.nexe \ - sodium_utils.nexe \ - sodium_version.nexe \ - stream.nexe \ - stream2.nexe \ - stream3.nexe \ - stream4.nexe \ - verify1.nexe \ - xchacha20.nexe -endif - AM_CPPFLAGS = \ -DTEST_SRCDIR=\"@srcdir@\" \ -I$(top_srcdir)/src/libsodium/include \ @@ -390,12 +238,10 @@ TESTS_TARGETS = \ verify1 if !EMSCRIPTEN -if !NATIVECLIENT TESTS_TARGETS += \ sodium_utils2 \ sodium_utils3 endif -endif check_PROGRAMS = $(TESTS_TARGETS) @@ -639,10 +485,6 @@ TESTS_TARGETS += \ xchacha20 endif -if NATIVECLIENT -LOG_COMPILER = ./nacl-test-wrapper.sh -endif - verify: check @VALGRIND_CHECK_RULES@ diff --git a/test/default/nacl-test-wrapper.sh b/test/default/nacl-test-wrapper.sh deleted file mode 100755 index 0e4cffa9..00000000 --- a/test/default/nacl-test-wrapper.sh +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh - -if [ -z "$NACL_SDK_ROOT" ]; then - echo "The following variable needs to be set: - \$NACL_SDK_ROOT=$NACL_SDK_ROOT" >&2 - exit 1 -fi - -if [ -z "$PNACL_FINALIZE" -o -z "$PNACL_TRANSLATE" ]; then - exe="$1" -else - exe="$1.nexe" - if [ ! -f "$exe" ]; then - $PNACL_FINALIZE "$1" -o "$1.final" - $PNACL_TRANSLATE -arch $(uname -m) "$1.final" -o "$exe" - fi -fi - -command -v command >/dev/null 2>&1 || { - echo "command is required, but wasn't found on this system" >&2 - exit 1 -} - -command -v python >/dev/null 2>&1 || { - echo "Python not found. Aborting." >&2 - exit 1 -} - -SEL_LDR=$(find "$NACL_SDK_ROOT" -name sel_ldr.py | head -n 1) -if [ -z "$SEL_LDR" ]; then - echo "Couldn't find sel_ldr.py under $NACL_SDK_ROOT" >&2 - exit 1 -fi - -exec python "$SEL_LDR" "$exe" diff --git a/test/default/randombytes.c b/test/default/randombytes.c index bdc5cca4..4b7438e8 100644 --- a/test/default/randombytes.c +++ b/test/default/randombytes.c @@ -42,8 +42,6 @@ randombytes_tests(void) #ifndef BENCHMARKS # ifdef __EMSCRIPTEN__ assert(strcmp(randombytes_implementation_name(), "js") == 0); -# elif defined(__native_client__) - assert(strcmp(randombytes_implementation_name(), "nativeclient") == 0); # else assert(strcmp(randombytes_implementation_name(), "sysrandom") == 0); # endif @@ -129,11 +127,7 @@ randombytes_uniform_impl(const uint32_t upper_bound) static int impl_tests(void) { -#ifndef __native_client__ randombytes_implementation impl = randombytes_sysrandom_implementation; -#else - randombytes_implementation impl = randombytes_nativeclient_implementation; -#endif uint32_t v = randombytes_random(); impl.uniform = randombytes_uniform_impl; diff --git a/test/quirks/quirks.h b/test/quirks/quirks.h index 65935a47..69fe3693 100644 --- a/test/quirks/quirks.h +++ b/test/quirks/quirks.h @@ -4,23 +4,6 @@ /* C++Builder defines a "random" macro */ #undef random -#ifdef __native_client__ -# define memset(dst, c, n) xmemset(dst, c, n) - -static void * -xmemset(void *dst, int c, size_t n) -{ - unsigned char * dst_ = (unsigned char *) dst; - const unsigned char c_ = (unsigned char) c; - size_t i; - - for (i = 0; i < n; i++) { - dst_[i] = c_; - } - return dst; -} -#endif - #ifdef __EMSCRIPTEN__ # define strcmp(s1, s2) xstrcmp(s1, s2)