1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00
Commit Graph

378 Commits

Author SHA1 Message Date
Frank Denis
c3045e2cb0 Check that SIGSEGV handlers work
Tools such as ASAN may trap violations instead of our handlers,
making the sodium_utils{2,3} test fail.

This has been documented for a long time, but it's probably better
to detect this and ignore tests depending on working signal handlers.
2017-06-23 11:11:16 +02:00
Frank Denis
00777f7f10 Clarify what --disable-asm does 2017-06-15 18:32:03 +02:00
Frank Denis
dfc226fed6 Try linking _xgetbv() for obsolete mingw versions 2017-04-14 19:01:04 +02:00
Frank Denis
7fa678bdca April 1st is over
This reverts commit 1668847409.
2017-04-01 20:50:58 +02:00
Frank Denis
1668847409 Add support for random.org as a CSPRNG 2017-04-01 10:01:26 +02:00
Frank Denis
aa7ded10e7 Bump package (not library) version 2017-03-28 12:57:19 +02:00
Frank Denis
5a49069ae0 Bump revision 2017-03-28 11:52:29 +02:00
Frank Denis
b434f5ac5b Add -Wshorten-64-to-32 if supported 2017-03-21 23:25:55 +01:00
Frank Denis
40511c47d4 Compilation with -march=native fails on Raspbian/Raspberry Pi 3 2017-03-10 20:49:36 +01:00
Frank Denis
8679e717db + sodium_library_minimal() and SODIUM_LIBRARY_MINIMAL 2017-03-06 09:47:09 +01:00
Frank Denis
e8182741b5 Less confusing autoconf checking messages 2017-03-05 22:44:01 +01:00
Frank Denis
1c2ce89326 _xgetbv() can be defined as a macro, so try an actual compilation 2017-02-28 18:20:24 +01:00
Frank Denis
e5a196a8ee Always include intrin.h if available 2017-02-28 17:58:50 +01:00
Frank Denis
9eea164007 Check for _xgetbv() presence 2017-02-28 17:51:18 +01:00
Frank Denis
9294e2e699 Revamp the salsa20 implmentations and structure
- Factorize core_salsa20{20,12,8}
- Add support for multiple salsa20 implementations
- Replace the assembly SSE2 implementation with its equivalent using intrisics
2017-02-26 16:49:15 +01:00
Frank Denis
40b4462239 Version bump [not released yet] 2017-02-20 11:35:14 +01:00
Frank Denis
3965574d3b Merge branch 'master' of https://github.com/jedisct1/libsodium 2017-01-19 21:27:28 +01:00
Frank Denis
9f489f0794 Compile with -Wno-type-limits 2017-01-19 21:26:46 +01:00
Frank Denis
f31a4b759d Tweak AX_CHECK_COMPILE_FLAG to also try to link the test program 2016-12-29 07:51:50 +01:00
Frank Denis
db97a35502 Check if atomic operations are supported 2016-12-16 16:37:12 +01:00
Frank Denis
b1f56de00b Import contrib/FindSodium.cmake 2016-10-05 15:37:03 +02:00
Frank Denis
68564326e1 A compiler *can* still optimize this out 2016-08-04 20:59:43 +02:00
Ilya Maykov
a3b68738db Better AVX2 detection, try 2 (only using intrinsic functions) (#420)
* Better AVX2 detection, try 2 (only using intrinsic functions)

* Slight change to AVX2 detection per jedisct1's feedback
2016-08-04 20:58:48 +02:00
Frank Denis
e08feb04d9 Pasto: CFLAGS_AVX -> CFLAGS_AVX2
Spotted by @ivmaykov
2016-08-04 02:26:24 +02:00
Frank Denis
fa18ba7505 Revert "Better AVX2 detection for GCC compilers"
This reverts commit 534e0774e3.
2016-08-04 02:25:24 +02:00
Ilya Maykov
534e0774e3 Better AVX2 detection for GCC compilers 2016-08-03 17:00:03 -07:00
Frank Denis
351ae49e53 cpuid is not available on i686-nacl 2016-07-06 16:23:50 +02:00
Frank Denis
29492143ab Warn if the library is being compiled in a custom way 2016-07-02 10:07:38 +02:00
Frank Denis
a7a3235a39 Version bump (not released yet) 2016-06-30 18:48:16 +02:00
Frank Denis
ba9c296108 Correct whitespace in path detection, and turn it into a fatal error 2016-06-15 09:50:45 +02:00
Frank Denis
474952d3f1 Try using cpuid on NativeClient 2016-04-30 16:23:02 +02:00
Frank Denis
a87d30f3af Try MMX/SSE/SSE2/SSE3/SSSE4/SSE4.1 instructions on NativeClient 2016-04-30 16:08:52 +02:00
Frank Denis
00e156198a Disable SIMD instructions on NativeClient 2016-04-30 13:03:31 +02:00
Frank Denis
d463dadc51 Disable ssp and aesni on nativeclient, nativeclient.sh->nativeclient-pnacl.sh 2016-04-29 22:29:34 +02:00
Frank Denis
fbad64f6ef Disable asm on native client 2016-04-28 21:31:18 +02:00
Frank Denis
f8ff8ebf66 Add locks around sodium_init() 2016-04-25 18:33:11 +02:00
Frank Denis
e816ffb56c Quotes 2016-04-19 00:24:46 +02:00
Frank Denis
bdf5c8246b Compile with pthreads 2016-04-18 20:54:46 +02:00
Frank Denis
daeaf63f9c Not an ELF system, not an Apple system, weak symbols may not work 2016-04-13 09:22:51 +02:00
Frank Denis
703120c1a2 Version bump [only the package] 2016-04-04 12:53:35 +02:00
Frank Denis
abdc839367 Workaround for old gcc versions missing _mm256_broadcastsi128_si256()
Some old gcc versions define vbroadcasti128 as
_mm_broadcastsi128_si256() not _mm256_broadcastsi128_si256().

Detect this, and use _mm_broadcastsi128_si256() in that case.
2016-04-03 10:41:28 +02:00
Frank Denis
c2b8ffb53d NO_BROWSER is not required any more, even for tests 2016-04-02 12:18:52 +02:00
Frank Denis
2b1d7cb750 Revisit the default set of compiler warnings 2016-03-27 11:10:36 +02:00
Frank Denis
55c3eed151 Have the SSE2 test trigger a conversion with old gcc versions 2016-03-24 19:18:15 +01:00
Frank Denis
3f765f1737 Old gcc versions need -flax-vector-conversions to compile some intrinsics 2016-03-24 19:11:21 +01:00
Frank Denis
b31f59d835 -save-temps is messing with the detection of supported directives
Remove it from --enable-opt, and don't use any directives to restrict
symbol visibility if detection appears to be unreliable
2016-03-24 10:55:47 +01:00
Frank Denis
f4cc8aeb48 Force LITTLE_ENDIAN detection on x86 and x86_64
This is a sad workaround for CompCert 2.6
2016-03-24 09:24:35 +01:00
Frank Denis
7bb9b7fc70 Endianness 2016-03-24 09:05:09 +01:00
Frank Denis
3295752821 Of course, GNU ld doesn't know about .private_extern 2016-03-22 21:26:39 +01:00
Frank Denis
bafc9c70e1 Only use .private_extern if this is supported 2016-03-22 20:42:07 +01:00
Frank Denis
0131a72082 BLAKE2b AVX2 implementation
By the marvellous Samuel Neves - https://github.com/sneves/blake2-avx2
2016-03-17 16:24:04 +01:00
Frank Denis
7611ea6018 Add AVX2 detection 2016-03-17 11:15:18 +01:00
Frank Denis
f92cfae9d8 Have --enable-opt use -O3, not -Ofast 2016-03-08 12:53:34 +01:00
Frank Denis
aafff07689 Add support for running the test suite with Valgrind 2016-03-06 01:35:06 +01:00
Frank Denis
846a84b721 Version bump (not released yet) 2016-01-13 09:49:20 +01:00
Frank Denis
a78161981c Check for _mm_set_epi64x() usability in the SSE2 test 2015-12-29 23:18:28 +01:00
Frank Denis
d740901df0 Have --enable-opt imply -Ofast 2015-12-29 15:46:23 +01:00
Frank Denis
953e959fba Try --high-entropy-va on MinGW 2015-12-27 20:53:08 +01:00
Frank Denis
c08c21887e Version bump 2015-12-23 21:15:12 +01:00
Frank Denis
90c49184fa --enable-opt now enables -save-temps; remove -flto 2015-12-18 01:11:41 +01:00
Frank Denis
3796145631 autoconf: check that named registers work 2015-12-06 18:30:00 +01:00
Frank Denis
5b62287f98 Add a --enable-opt compile-time switch 2015-12-05 17:56:42 +01:00
Frank Denis
1e71f849b5 1.0.7 (not released yet) 2015-11-25 16:12:42 +01:00
Frank Denis
b74f644d3f Replace CPU_ALIGNED_ACCESS_REQUIRED with CPU_UNALIGNED_ACCESS
Instead of defining a macro when aligned memory access is required,
define one when unaligned memory access is supported.

Safer when cross-compiling or not using autoconf
2015-11-16 22:01:19 +01:00
Frank Denis
eb8119d65c Enable 128-bit arithmetic if __int128 is available 2015-11-15 18:16:15 +01:00
Frank Denis
dd238f518d Bump major 2015-11-14 15:33:15 +01:00
Frank Denis
fb28119a38 Check inline assembly code using __asm__ __volatile__ 2015-11-14 01:21:55 +01:00
Frank Denis
18906a078c Unfortunately, some assemblers still don't know about AVX opcodes 2015-11-04 23:29:27 +01:00
Frank Denis
3f3969ffae EMSCRIPTEN -> __EMSCRIPTEN__ 2015-11-04 22:43:25 +01:00
Frank Denis
049fd8fd6a Add sodium_runtime_has_avx() 2015-11-03 14:19:22 +01:00
Frank Denis
2a77b18ad8 Version bump (not released yet) 2015-11-01 15:45:36 +01:00
Frank Denis
19308c5d5b Bump the library major version, since some functions have been removed
Even though these functions were exported, the number of applications
using them directly is very likely to be zero.

Still, bump the major library version to be safe and compliant.
2015-11-01 12:23:21 +01:00
Frank Denis
920c459ac3 Link optimized compression functions for Blake2b 2015-11-01 06:09:04 +01:00
Frank Denis
26fdfec99b Add sodium_runtime_has_ssse3() and sodium_runtime_has_sse41() 2015-10-31 23:42:44 +01:00
Frank Denis
f11da70ce2 Package version bump. No ABI version changes required. 2015-10-24 19:12:49 +02:00
Frank Denis
e2124999cc doesn't -> does not 2015-10-19 00:24:39 +02:00
Frank Denis
ec7b8e5605 Version bump [but still not released] 2015-10-14 14:43:22 +02:00
Frank Denis
84d92fc1bf Try to enable specific cflags before testing each intructions set 2015-10-10 20:10:26 +02:00
Frank Denis
f267352eec Use SIMD-specific compiler flags only for files needing them 2015-10-10 19:24:30 +02:00
Frank Denis
d4ff80e7a0 Define __SSSE3__ if required 2015-10-10 18:32:10 +02:00
Frank Denis
6ca06314fc Do not try to compile aesni code if this is not going to compile 2015-10-10 18:22:03 +02:00
Frank Denis
e83e9b2d8e Check for AESNI & PCLMUL presence/usability 2015-10-10 17:57:47 +02:00
Frank Denis
ab2e86748e Replace the aes256gcm implementation with Romain Dolbeau's implementation
which is slightly faster than mine.
Reimplement features from the previous implementation: add batch mode and
use two passes in the decryption function in order to check the tag before
decrypting.
2015-10-10 16:21:08 +02:00
Frank Denis
571bfc99c8 Check for ssse3 presence 2015-10-07 23:26:13 +02:00
Frank Denis
e8e5d2fc18 Add crypto_aead_aes256gcm_aesni_*
Requires a CPU with aesni and pclmulqdq
This is a private branch for a reason. It is not going to be merged as-is.
2015-10-07 23:09:19 +02:00
Frank Denis
46f71fba9e Check for getpid(2) presence instead of checking for Visual Studio 2015-09-13 15:04:26 +02:00
Frank Denis
c1f749e68a Keep shell variables names consistent with their related C macros. 2015-09-04 15:37:31 +02:00
Matthijs van Duin
cfa9e95b6c improve test for unaligned access
check target attribute on ARM
2015-09-04 02:29:34 +02:00
Frank Denis
7fca230be8 Nits after pnacl merge 2015-08-02 13:53:22 +02:00
Frank Denis
f610f781f2 Merge remote-tracking branch 'arbinger/pnacl' into nacl
* arbinger/pnacl:
  removed comment
  Added .final and .nexe output files to CLEANFILES
  revert original hack
  Initial patch for Chrome NaCl implementation
  Added patch to obtain random bytes for Chrome NaCl via IRT -- allows build with NaCl SDK toolchain
2015-08-02 12:54:05 +02:00
Syrone Wong
4074470a31 Fix _FORTIFY_SOURCE redefined issue 2015-08-02 09:36:52 +08:00
James Robson
34a4931d9a Initial patch for Chrome NaCl implementation 2015-06-22 13:02:21 -05:00
Frank Denis
b5fff1fcf5 Version bump 2015-04-26 17:09:00 +02:00
Frank Denis
33357dc52e Running the JS tests requires the filesystem. 2015-01-18 00:46:48 +01:00
Frank Denis
98c96f4c99 No browser, no filesystem support required 2015-01-18 00:42:34 +01:00
Frank Denis
e7f410de10 Emscripten: don't use a memory init file any more.
It doesn't take that long to load the module, and it's going to make
users' life way easier.
2015-01-17 22:11:10 +01:00
Frank Denis
201821065d Reserve slots for function pointers 2015-01-17 18:33:25 +01:00
Frank Denis
2c15c81ba5 Revert 17932c782e
It broke compilation on OpenBSD.
2015-01-15 16:21:09 +01:00
Frank Denis
f20ecbed94 Skip sodium_utils{2,3} tests when the target is Javascript 2015-01-15 11:12:58 +01:00
Frank Denis
5b8c2de267 Version bump 2015-01-12 09:41:46 +01:00
Frank Denis
aaf5fbf2e5 + precomputed interface for crypto_box() 2015-01-06 17:52:42 +01:00
Jack Wink
f87ef76ee8 remove extra pie check 2014-12-28 13:19:07 -05:00
Jack Wink
1ce56adbef a second stab at detecting valid linker flags 2014-12-28 13:17:09 -05:00
Jack Wink
9c9d1edf74 check to see if '-Wl,-pie' is supported before using it 2014-12-28 12:59:53 -05:00
Jack Wink
6ebf4030f8 change '-pie' to '-Wl,-pie' to squash clang errors 2014-12-28 12:27:35 -05:00
Frank Denis
4c4d04bb2a Merge pull request #222 from stellar/master
Add libsodium-uninstalled.pc.in
2014-12-25 10:56:17 +01:00
Frank Denis
3a9c4f2c78 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Warn that libtool might fail if the build directory contains whitespaces
2014-12-23 20:26:29 +01:00
Frank Denis
c6e93b9f79 Discourage use of --enable-blocking-random 2014-12-23 20:24:23 +01:00
Graydon Hoare
9ae403b489 Add libsodium-uninstalled.pc.in 2014-12-22 16:14:22 -08:00
Frank Denis
0b58f87fef Warn that libtool might fail if the build directory contains whitespaces 2014-12-21 09:51:32 +01:00
Frank Denis
9d71e18a22 Always generate libsodium.pc 2014-11-29 13:53:20 -08:00
Frank Denis
11ccb20512 If -fno-strict-overflow is available, don't add -fwrapv 2014-11-25 12:19:08 -08:00
Frank Denis
61620d7e42 Make 'make check' actually run the tests on Emscripten. 2014-11-25 09:51:39 -08:00
Frank Denis
69e3674c29 Include the test pre.js script only for tests. 2014-11-24 17:19:55 -08:00
Frank Denis
b421610110 AC_FUNC_MMAP assumes that mmap(2) is not available when cross-compiling
except on GNU systems. Just check for function presence instead.
2014-11-24 10:34:42 -08:00
Frank Denis
da2c9952db Check if mmap(2) works, not just the presence of MAP_ANON
In particular, mmap(2) doesn't return an aligner pointer on Emscripten.
2014-11-24 10:22:50 -08:00
Frank Denis
5aeebd880e Change EXEEXT to .js for Emscripten 2014-11-22 14:31:43 -08:00
Frank Denis
d0eab9323f Don't assume that madvise() is available even if related macros are defined. 2014-11-22 13:32:54 -08:00
Frank Denis
133118ca4d Skip mlock/mprotect/explicit_bzero when using Emscripten 2014-11-22 12:32:11 -08:00
Frank Denis
68b3191c90 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Prevent first-run ./autogen.sh error due to ltmain.sh absence.
2014-11-02 19:24:29 -08:00
Frank Denis
25e467bdea Check that -D_FORTIFY_SOURCE=2 doesn't trigger a compiler bug 2014-11-02 19:24:08 -08:00
Phillip Mienk
2f5a4bd019 Prevent first-run ./autogen.sh error due to ltmain.sh absence. 2014-11-02 16:49:17 -08:00
Frank Denis
84972cbf9c Version bump 2014-10-08 22:01:12 -07:00
Frank Denis
2c61530133 1.0.0 2014-09-24 00:18:44 -07:00
Frank Denis
05f46af70e Version bump 2014-09-18 22:47:11 -07:00
Frank Denis
82c806ec07 Capitalize Android 2014-09-14 13:56:02 -07:00
Frank Denis
41ed891d56 Use -fstack-protector for all.
Might be replaced by -fstack-protector-strong later on.
2014-09-14 13:25:29 -07:00
Frank Denis
61449686ee Version bump 2014-08-15 16:52:01 -07:00
Frank Denis
473e1718cc Add sodium_{malloc,allocarray,free}() and sodium_mprotect_*()
ptr = sodium_malloc(size) returns a pointer from which exactly "size" bytes
can be accessed.

ptr = sodium_allocarray(count, size) allocates enough storage space for
"count" pointers or scalars of unit size "size".

In both cases, the region is immediately followed by a guard page.
As a result, any attempt to access a memory location after ptr[size - 1] will
immediately trigger a segmentation fault.

The allocated region is mlock()ed and filled with 0xd0 bytes.

A read-only page with the size, a guard page, as well as a canary are
placed before the returned pointer.

The canary is checked by sodium_free(); as a result, altering data right
before ptr is likely to cause sodium_free() to kill the process.

sodium_free() munlock()s the region and fills it with zeros before
actually calling free().

sodium_mprotect_noaccess(), sodium_mprotect_readonly() and
sodium_mprotect_readwrite() can be used to change the protection on the set
of allocated pages.

Reverting the protection to read+write is not required before calling
sodium_free().
2014-08-14 21:41:05 -07:00
Frank Denis
55bb50b855 Bump major 2014-08-06 10:09:21 -07:00
Frank Denis
ed76b41369 Rephrase 2014-08-04 16:29:13 -07:00
Frank Denis
2b0c8e40aa Keep IA-32 asm on MingW/Cygwin, check for Windows during the x86-64 test. 2014-08-04 16:24:11 -07:00
Frank Denis
b9be5fbd45 Do not pass -fPIC on Windows. Add msys as a host_os value to detect Windows as well. 2014-08-04 14:30:07 -07:00
Frank Denis
857c772853 Rephrase 2014-07-31 22:13:45 -07:00
Frank Denis
aae1ae5005 MSVC: Define NATIVE_LITTLE_ENDIAN / inline as __inline / UNICODE & _UNICODE 2014-07-29 08:57:17 -07:00
Frank Denis
990fad3060 librt and libm are not needed any more.
Thanks to Raúl Sánchez Siles for the heads up.
2014-07-21 16:00:47 -07:00
Frank Denis
1dca7edfab --enable-minimal should compile only what is required for the high-level API
This doesn't include aes128ctr.
2014-07-14 18:43:46 -07:00
Frank Denis
412f3edf8c Get ready for 0.6.1 2014-07-12 21:15:46 -07:00
Frank Denis
f6519378b4 + --enable-minimal to build a smaller library without less-used functions. 2014-07-09 20:24:04 -07:00
Frank Denis
c7059e88ec Always install the .pc file even if pkg-config is not available.
And make sure that "make uninstall" gets rid of it, too.
2014-07-05 15:10:36 -07:00
Frank Denis
28d6eeaad7 Next package version will be 0.6.0
The library itself doesn't need a major version bump.
2014-06-26 16:13:46 -07:00
Frank Denis
957315035a Use weak symbols to prevent LTO if this is an option.
Idea from Matthew Dempsky.
2014-06-20 21:11:53 -07:00
Frank Denis
098bad385b Disable memset_s test for now.
Targeting OSX < 10.9 with -macosx-version-min doesn't work as expected:
memset_s is detected as present even though it won't actually work on
OSX <= 10.8
2014-06-18 17:49:28 -07:00
GraxRabble
ccf915dc14 prevented 128 bit integers from compiling with emscripten 2014-05-20 13:53:31 -04:00
xantares
041f920341 Link memset_s presence test 2014-05-19 19:14:49 +02:00
Frank Denis
35467bc0b7 Bump minor 2014-05-15 01:20:10 -07:00
Frank Denis
4653471cad Check for SSSE3 instructions set 2014-05-14 22:34:27 -07:00
Frank Denis
f3034d38fc Align library version ASCII art 2014-05-12 14:07:48 -07:00
Frank Denis
4ea26f0b8c Stricter autoconf checks for MMX/SSE2/SSE3 2014-05-09 22:01:15 -07:00
Frank Denis
90d270f7c5 Check for memset_s availability the hard way. 2014-05-09 13:23:15 -07:00