Go to file
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
builds Add sodium_{malloc,allocarray,free}() and sodium_mprotect_*() 2014-08-14 21:41:05 -07:00
dist-build Use --enable-minimal in the Android and iOS builds 2014-08-13 23:32:26 -07:00
m4 Include pkg.m4, don't assume that the system has it. 2013-09-08 23:01:50 -07:00
msvc-scripts MSVC: Define NATIVE_LITTLE_ENDIAN / inline as __inline / UNICODE & _UNICODE 2014-07-29 08:57:17 -07:00
packaging/nuget Update windows dll version resource to 0.6.0 2014-07-04 05:46:18 -06:00
src Add sodium_{malloc,allocarray,free}() and sodium_mprotect_*() 2014-08-14 21:41:05 -07:00
test Add sodium_{malloc,allocarray,free}() and sodium_mprotect_*() 2014-08-14 21:41:05 -07:00
.gitignore Add sodium_{malloc,allocarray,free}() and sodium_mprotect_*() 2014-08-14 21:41:05 -07:00
.travis.yml Ask Travis to compile on OSX in addition to Linux 2014-05-13 16:23:24 -07:00
AUTHORS Remove aes256estream. 2014-08-05 00:57:10 -07:00
autogen.sh We don't need libltdl 2013-04-25 22:51:19 -07:00
ChangeLog Typo: not -> now 2014-07-15 14:19:37 -07:00
configure.ac Add sodium_{malloc,allocarray,free}() and sodium_mprotect_*() 2014-08-14 21:41:05 -07:00
libsodium.pc.in Properly fill exec_prefix in libsodium.pc, spotted by Jonas Termansen 2014-07-17 22:07:57 -07:00
libsodium.sln Add version number to the libsodium.sln file 2013-10-14 16:36:29 -07:00
libsodium.vcxproj Remove compat.c 2014-08-13 17:40:06 -07:00
libsodium.vcxproj.filters Remove compat.c 2014-08-13 17:40:06 -07:00
LICENSE 2014 2013-12-31 15:22:48 +01:00
logo.png zopflipng + defluff 2013-06-06 13:11:30 -07:00
Makefile.am Always install the .pc file even if pkg-config is not available. 2014-07-05 15:10:36 -07:00
README Import libnacl from dnscrypt-proxy 2013-01-19 16:02:02 -08:00
README.markdown Add backquotes 2014-06-28 22:51:39 -07:00
THANKS Thanks Jason McCampbell for the Go bindings 2014-07-24 20:58:43 -07:00

See README.markdown