From 4c6f70408460ea8b341a905d7bc08557972a86a5 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 16 Dec 2016 16:20:30 +0100 Subject: [PATCH 1/2] Remove a whitespace following trailing backslash in a Makefile --- src/libsodium/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 7cec3ab0..f2f53430 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -3,7 +3,7 @@ lib_LTLIBRARIES = \ libsodium_la_SOURCES = \ crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \ - crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \ + crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \ crypto_auth/crypto_auth.c \ crypto_auth/hmacsha256/auth_hmacsha256_api.c \ crypto_auth/hmacsha256/cp/hmac_hmacsha256.c \ From db97a3550207486261d6b44d0e9771be36800d65 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 16 Dec 2016 16:37:12 +0100 Subject: [PATCH 2/2] Check if atomic operations are supported --- configure.ac | 11 +++++++++++ src/libsodium/sodium/core.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b36a0877..90ff5413 100644 --- a/configure.ac +++ b/configure.ac @@ -660,6 +660,17 @@ AS_IF([test "x$aligned_access_required" = "xyes"], [AC_MSG_RESULT(no) AC_DEFINE([CPU_UNALIGNED_ACCESS], [1], [unaligned memory access is supported])]) +AC_MSG_CHECKING(if atomic operations are supported) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[ +static volatile int _sodium_lock; +__sync_lock_test_and_set(&_sodium_lock, 1); +__sync_lock_release(&_sodium_lock); +]] +)], +[AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_ATOMIC_OPS], [1], [atomic operations are supported])], +[AC_MSG_RESULT(no)]) + dnl Checks for functions and headers AS_IF([test "x$EMSCRIPTEN" = "x"],[ diff --git a/src/libsodium/sodium/core.c b/src/libsodium/sodium/core.c index aa23726e..1ac12cab 100644 --- a/src/libsodium/sodium/core.c +++ b/src/libsodium/sodium/core.c @@ -123,7 +123,7 @@ sodium_crit_leave(void) return 0; } -#elif defined(__GNUC__) && !defined(__EMSCRIPTEN__) && !defined(__native_client__) +#elif defined(HAVE_ATOMIC_OPS) && !defined(__EMSCRIPTEN__) && !defined(__native_client__) static volatile int _sodium_lock;