1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-25 13:05:08 -07:00
Commit Graph

301 Commits

Author SHA1 Message Date
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
Frank Denis
bfeec26358 Use explicit_bzero if available 2014-05-09 13:06:39 -07:00
Frank Denis
d12b563520 Bump library version major 2014-05-08 21:13:12 -07:00
Frank Denis
394e654c40 Unbreak cpuid check in autoconf 2014-05-06 12:31:08 -07:00
Frank Denis
20088ca5e2 Remove HAVE_CPUID conditional 2014-05-06 12:26:53 -07:00
Frank Denis
dc5dbae12f Sync autoconf cpuid detection code 2014-05-02 21:24:31 -07:00
Frank Denis
ced8034901 Test only for cpu features we actually use for now, add MMX. 2014-05-02 15:39:49 -07:00
Frank Denis
cb4f3e4f06 Use SSE2 or portable scrypt implementation according to what the CPU supports. 2014-05-02 15:20:34 -07:00
Frank Denis
cb8544715b Check for SSE2/SSE3/NEON support at runtime. 2014-05-02 14:40:39 -07:00
Frank Denis
3cefff9e52 Goodbye poly1305-53 and its genius fp wizardry. 2014-05-01 21:51:02 -07:00
Frank Denis
5df1a09f9a Do not try to directly include <avxintrin.h> 2014-05-01 13:51:05 -07:00
Frank Denis
488cb28953 Do not use functions that aren't fully supported by Emscripten yet. 2014-04-22 18:12:49 -07:00
Frank Denis
53f3784a18 Also check for VirtualLock() 2014-04-16 18:04:45 -07:00
Frank Denis
7533cca9c7 Check for mlock() 2014-04-16 18:04:09 -07:00
Frank Denis
a06b00ecf4 Initial import of scrypt 2014-04-10 18:25:16 -07:00
Frank Denis
9f2e0ba803 Use memset_s() if available 2014-03-02 19:05:14 -08:00
Simon Levermann
cd2fabb8f5 Repair broken sonames 2014-02-23 02:07:52 +01:00
Simon Levermann
d889492173 Add ./configure option to disable toggle versions
I consider this way cleaner than setting some environment
variable in the build script. Per default, sonames are generated.
If ./configure is run with "--disable-soname-versions", no soname
versions will be generated. This is mainly useful for android, but
it might find some use for other environments without soname versioning
2014-02-20 17:54:05 +01:00
Frank Denis
0e6723c83c Append to LIBTOOL_EXTRA_FLAGS in case it is not empty 2014-02-17 01:23:23 -08:00
Frank Denis
b70aa80cc6 Check for posix_memalign() presence 2014-01-01 12:57:25 +01:00
Frank Denis
3aa856474a Distribute the dist-build directory 2013-12-31 16:16:29 +01:00
Frank Denis
bf72ee931e Make crypto_scalarmult_curve25519.h architecture-independent 2013-12-11 20:17:09 -08:00
Frank Denis
5133638024 Make crypto_stream_salsa20.h architecture-independent.
Move implementation-specific functions to compat.c
2013-12-11 19:45:11 -08:00
Frank Denis
2c4f936715 Compile separately and use lipo(1) to build universal binaries. 2013-10-24 12:27:50 -07:00
Frank Denis
5ae0dbc579 Drop support for universal binaries. 2013-10-24 11:51:09 -07:00
Jose Pedro Oliveira
7101eb6a3f Downgrade the minimal pkg-config version from 0.25 to 0.23 (which is
the pkg-config version shipped in Red Hat Enterprise Linux 6).
2013-10-23 17:19:08 +01:00
Frank Denis
abb7f74e5d 0.4.5 2013-10-22 02:56:36 -07:00
Frank Denis
afb89c7e16 Some systems have arc4random() but not arc4random_buf() 2013-10-22 02:54:45 -07:00
Frank Denis
08e37807ae Bump version to 0.4.4 2013-10-21 20:43:44 -07:00
Frank Denis
875f4210ef Check for arc4random() 2013-10-06 15:40:03 -07:00
Frank Denis
008808742b Bump library minor 2013-10-05 14:14:18 -07:00
Frank Denis
b9b293c0ab Add msvc scripts to the tarballs 2013-09-30 13:36:31 -07:00
Frank Denis
30026fbbfe Check for inline vs __inline for MSVC 2013-09-24 13:23:48 -07:00
Frank Denis
656d8d6495 Disable donna_c64 on big endian architectures for now 2013-09-21 20:07:50 -07:00
Frank Denis
48f46304ce Crank library minor 2013-09-09 22:21:53 -07:00
Frank Denis
38d0a4d1ca Disable asm on x86_64-*-cygwin*, thanks to neheb@ 2013-09-09 00:01:55 -07:00
Frank Denis
43f370671c Actually disable PIE on mingw* 2013-09-08 23:45:15 -07:00
Frank Denis
e12b5bd8fb Bump package version 2013-09-08 22:20:42 -07:00
Frank Denis
4b08902232 Disable asm on mingw64 2013-09-08 22:06:27 -07:00
Frank Denis
9ee3bd5d56 Use AS_CASE 2013-09-08 10:44:07 -07:00
Frank Denis
493f71a98a Use autoconf to possibly define CPU_ALIGNED_ACCESS_REQUIRED 2013-09-08 10:39:27 -07:00
Frank Denis
5cfce7ef82 Reduce the 128-bit arithmetic compiler bug test case even further 2013-09-08 02:25:48 -07:00
Frank Denis
7544cba1fa Test a minimum case that crashes gcc when compiling smult_curve25519_donna_c64
Delta and C-Reduce are amazing debugging tools.
2013-09-08 02:15:12 -07:00
Frank Denis
84f634a8f2 Requires at least autoconf 2.65 2013-08-26 23:37:08 -07:00
Frank Denis
74031ee550 Make --disable-blocking-random and --disable-debug no-ops 2013-08-18 14:06:00 -06:00
Christian Wiese
2f64b991b6 build: changed to only generate/install .pc file if pkg-config is found
This change improves the pkg-config support to only generate/install a .pc
file if pkg-config is found, assuming it is part of the build toolchain.

Note:

The minimal version set for pkg-config is 0.25, because this is the oldest
version I am able to test at the moment.
2013-08-12 15:16:23 -07:00
Christian Wiese
24510eb3e9 build: create and install a pkgconfig file
This adds trivial changes to the autotools infrastructur and a
template to generate and install a pkgconfig file libsodium.pc.
2013-08-11 23:18:14 +02:00
Frank Denis
675541b6f2 Rename ChangeLog to NEWS, change autoconf strictness to foreign,
rename COPYING to LICENSE.
2013-08-05 11:19:13 -07:00
Frank Denis
c6ad966868 Reorder automake options 2013-07-29 09:35:09 -07:00
Frank Denis
898cadc3e6 Set subdir-objects 2013-07-20 18:04:34 -07:00
Frank Denis
de78d541d6 Crank library minor 2013-07-12 09:49:44 -07:00
Frank Denis
a6490db658 Don't -> Do not 2013-07-07 22:38:51 -07:00
Frank Denis
09a4848fc9 Document --disable-pie instead of --enable-pie 2013-07-07 22:35:34 -07:00
Frank Denis
617eb6d26f Move --enable-pie switch 2013-07-07 22:29:58 -07:00
Frank Denis
51d91d1115 autoconf: move the last switch, --enable-debug 2013-07-07 22:25:20 -07:00
Frank Denis
1d921e45da autoconf: keep moving switches to the top of the file 2013-07-07 22:20:27 -07:00
Frank Denis
c06e228867 autoconf: start moving AC_ARG_ENABLE macros to the top of the script. 2013-07-07 21:46:44 -07:00
Frank Denis
c8a44ba02e Disable asm implementations when compiling to javascript with emscripten. 2013-07-07 21:33:41 -07:00
Frank Denis
f66ab14d7f Remove -I/usr/local/include and -L/usr/local/lib
libsodium doesn't have any dependency on 3rd party libs.
2013-07-07 19:18:03 -07:00
Frank Denis
c828d169c6 Prepare for a version bump. 2013-07-07 14:10:02 -07:00
Frank Denis
1a0a89df33 No need to define CROSS_COMPILING 2013-05-13 12:45:58 -07:00
Frank Denis
210de1570a Add --disable-asm option to disable assembly implementations.
Check that fesetenv() and fegetenv() are available. If they aren't, still
compile the floating-point implementation of poly1305, but never pick it
in sodium_init().

This helps libsodium compile and work on Emscripten and on environments with
an incomplete libc.
2013-04-28 09:44:23 -07:00
Frank Denis
a68f217a80 Fix AC_INIT() 2013-04-27 16:39:23 -07:00
Frank Denis
02f98ce727 Only trust clang support for mode(TI) on amd64 2013-04-27 14:28:18 -07:00
Frank Denis
bb70f436d0 Just check cpuid itself, don't clobber %ebx 2013-04-27 14:07:39 -07:00
Frank Denis
46f5ec89a6 Fix __STDC_LIMIT_MACROS autoconf check 2013-04-27 13:42:55 -07:00
Frank Denis
318d54e990 Check whether __STDC_LIMIT_MACROS is required 2013-04-27 13:40:22 -07:00
Frank Denis
e5e7c7cc07 Add package URL 2013-04-27 11:42:27 -07:00
Frank Denis
808d1807dc Add optimized salsa20 amd64 assembly implementation 2013-04-27 10:21:32 -07:00
Frank Denis
ffb1e24ef1 Make the crypto_stream_salsa20 implementation switchable at compile-time 2013-04-27 09:12:26 -07:00
Frank Denis
a669e9353d Fix ssse3 detection 2013-04-26 22:53:07 -07:00
Frank Denis
2055e38bc6 Just reformat some confusing construction in configure.ac 2013-04-26 22:00:00 -07:00
Frank Denis
ce38abed70 Include <stdlib.h> for NULL in the cpuid autoconf test. 2013-04-26 13:26:10 -07:00
Frank Denis
ba104b2706 -Wbounded is nice, but clang reports the same thing nowadays. 2013-04-25 23:27:47 -07:00
Frank Denis
9131967397 We don't need libltdl 2013-04-25 22:51:19 -07:00
Frank Denis
8574a58488 Bump package version minor 2013-04-25 22:42:35 -07:00
Frank Denis
87a6d01115 Bump library version minor 2013-04-25 21:52:27 -07:00
Frank Denis
4fff338810 Switch targets before trying to compile SIMD headers 2013-04-25 19:47:21 -07:00
Frank Denis
5f226a23a1 Check for cpuid instruction 2013-04-25 18:59:55 -07:00
Frank Denis
88c42e7daa Check SIMD headers 2013-04-25 09:37:04 -07:00
Frank Denis
91e75fc973 Use -fPIC even on Win32, since libtool reintroduces it no matter what. 2013-04-24 13:08:25 -07:00
Frank Denis
e34aeffd3c Don't export symbols by default. 2013-04-24 08:46:39 -07:00
Frank Denis
52565edee1 Remove LIBTOOL_EXTRA_FLAGS and -fPIC (implicit) on Win32 2013-04-23 21:55:48 -07:00
Frank Denis
e53b67924b Looks like AC_LIBTOOL_WIN32_DLL is still required these days. 2013-04-23 21:33:58 -07:00
Frank Denis
655a9589b8 Output .DEF file on Win32 2013-04-23 21:24:35 -07:00
Frank Denis
245bd75753 Remove ssp by default on cygwin 2013-04-22 13:16:03 -07:00
Frank Denis
019064e663 Use HAVE_TI_MODE for the macro and HAVE_TI_MODE_V for the substitution 2013-04-21 17:32:10 -07:00
Frank Denis
476730ae69 Define NATIVE_LITTLE_ENDIAN / NATIVE_BIG_ENDIAN if we can 2013-04-21 17:32:09 -07:00
Frank Denis
2b2b9846a6 Only compile curve25519_ref or curve25519_donna_c64 2013-04-21 17:32:07 -07:00
Frank Denis
2916224650 Use curve25519_donna_c64 instead of curve25519_ref if supported. 2013-04-21 17:32:07 -07:00
Frank Denis
8e7bb5d0ce Move sodium-specific files to a dedicated directory 2013-04-21 17:32:04 -07:00
Frank Denis
707dcb0c44 Check if we need -lm for fe[gs]etenv() 2013-04-21 17:32:03 -07:00
Frank Denis
e59ed29ee8 Export the shared library version, not just the package version. 2013-03-31 15:22:43 -07:00
Frank Denis
b88d92d69d Replace the ed25519 ref implementation with ref10 from supercop 2013-03-25 11:47:15 -07:00
Frank Denis
4395817042 Check for gcc TI mode availablity 2013-03-17 18:40:14 -07:00
Frank Denis
289a75113c Remove SODIUM_PATH 2013-03-16 20:08:13 -07:00
Frank Denis
039636e34c Add a new --enable-debug autoconf switch
Remove duplicate --enable-blocking-random by the way
2013-03-16 20:06:00 -07:00
Frank Denis
f5f72f0165 Remove CurveCP 2013-03-16 19:59:25 -07:00
Frank Denis
f559391557 Remove (soon to be) obsolete -fcatch-undefined-c99-behavior 2013-03-11 22:40:58 -07:00
Frank Denis
421b0cf34b Define USE_*, HAVE_* and CROSS_COMPILING macros to 1 instead of just
defining then, for consistency.
2013-03-08 09:13:48 -08:00
Frank Denis
c595edd85e Update library version number 2013-03-03 14:06:20 -08:00
Frank Denis
37a1358b81 glibc needs -lrt to get clock_gettime()
Reported by csosstudy
2013-02-28 19:13:07 -08:00
Frank Denis
f5af42f48d CurveCP is optional 2013-02-18 15:28:43 -08:00
Frank Denis
926803f996 Move curvecp, split libcurvecp to its own dir 2013-02-18 15:14:55 -08:00
Frank Denis
60d788a444 Compile curvecp. This will be optional and disabled by default as it is
not exactly portable.
2013-02-18 13:56:29 -08:00
Frank Denis
5c946f9c61 Move tests to test/default and windows to quirks/windows.
test/default contains only tests using the default primitives
for a given operation. We need to add other tests as well.
2013-02-09 04:21:32 +08:00
Frank Denis
48aa6934df Add missing quotes around LIBTOOL_EXTRA_FLAGS 2013-02-05 08:01:00 -08:00
Frank Denis
eb96dcb0f7 Skip library version info on Windows 2013-02-04 22:52:51 -08:00
Frank Denis
2abcfa283a BUmp version to 0.3 2013-02-04 22:28:17 -08:00
Frank Denis
6d3afb32de Build the library as a module on Windows 2013-02-04 17:16:46 -08:00
Frank Denis
9abef59142 Bump lib source version 2013-02-04 14:52:57 -08:00
Frank Denis
2556007a6f Bump library and package version. 2013-01-28 21:43:15 -08:00
Frank Denis
d541144327 Add -Wsometimes-uninitialized 2013-01-21 20:50:50 -08:00
Frank Denis
7ba8af5936 Check for SecureZeroMemory at compile time. 2013-01-21 19:18:15 -08:00
Frank Denis
119011976b 3-digits version numbers are not required. 2013-01-21 18:17:09 -08:00
Frank Denis
412c5f4d0c Use /dev/random instead of /dev/urandom if needed. 2013-01-21 14:16:06 -08:00
Frank Denis
dde2e8086c Use salsa20_random() for randombytes, install libsodium-randombytes DLL. 2013-01-21 12:23:57 -08:00
Frank Denis
d84ccf2ad2 Make compilation less verbose by default, because this is a mess. 2013-01-20 18:06:07 -08:00
Frank Denis
b4e28221e8 Add library version 2013-01-20 17:51:57 -08:00
Frank Denis
91e342fb52 No need for AM_PROG_CC_C_O 2013-01-20 17:01:15 -08:00
Frank Denis
79f24e04e3 One more test 2013-01-20 15:25:22 -08:00
Frank Denis
c04d4816fb Start adding tests 2013-01-20 14:03:05 -08:00
Douglas Campos
ee16bc6e6c rename libnacl-ref -> libsodium 2013-01-20 17:23:32 -02:00
Douglas Campos
54049c230d remove 'do' leftovers 2013-01-20 17:13:43 -02:00
Frank Denis
00e6464173 Update github link 2013-01-20 00:51:21 -08:00
Frank Denis
cf110d7be3 Don't use config.h - We're not including any common headers. 2013-01-20 00:50:51 -08:00
Frank Denis
33f97cbb3b Replace the build system 2013-01-19 23:51:05 -08:00
Frank Denis
e770e627dd libtoolize and get ready for a lot of autotools fun. Not. 2013-01-19 16:37:13 -08:00
Frank Denis
95b9c37cc5 Import libnacl from dnscrypt-proxy 2013-01-19 16:02:02 -08:00