summaryrefslogtreecommitdiff
path: root/src/lib/libc (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* XPG requires insque() and remque() to work with linear lists and not justguenther2014-08-153-21/+26
| | | | | | | | | circular lists. Amazingly, they managed to extend the requirements to no longer match the behavior of the VAX instructions they were modeled after, so the trivial VAX ASM versions have to go. Nice job breaking it, X/Open! Based on a diff from enh (at) google.com ok miod@
* Only need <stdint.h> and not all of <inttypes.h> hereguenther2014-08-101-2/+2
|
* missing newlinederaadt2014-07-211-1/+2
|
* Switch from <sys/endian.h> or <machine/endian.h> to the new,guenther2014-07-214-8/+8
| | | | | | being-standardized <endian.h> ok deraadt@ millert@ beck@
* Move more OS-specific functionality to arc4random.h headers.bcook2014-07-202-6/+14
| | | | | | | | Move <sys/mman.h> and raise(SIGKILL) calls to OS-specific headers. On OpenBSD, move thread_private.h as well to arc4random.h. On Windows, use TerminateProcess on getentropy failure. ok deraadt@
* From ISO/IEC 9899:1999 and 9899:201x,guenther2014-07-202-5/+5
| | | | | | | | | 6.11.5 - Storage-class specifiers: The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature. Diff from Jean-Philippe Ouellet (jean-philippe (at) ouellet.biz)
* arc4random re-seeds with getentropy() now; ok deraadt@ jmc@naddy2014-07-191-3/+3
|
* Change _rs_allocate so it can combine the two regions (rs and rsx)deraadt2014-07-192-28/+25
| | | | | | | | | | into one if a system has an awesome getentropy(). In that case it is valid to totally throw away the rsx state in the child. If the getentropy() is not very good and has a lazy reseed operation, this combining is a bad idea, and the reseed should probably continue to use the "something old, something new" mix. _rs_allocate() can accomodate either method, but not on the fly. ok matthew
* Remove "const" from the lsearch(3) manual's synopsis too.matthew2014-07-181-3/+3
| | | | Reminded by Rafael Neves
* zap trailing whitespace;jmc2014-07-181-3/+3
|
* Change lsearch()'s "base" argument to require a non-const pointer tomatthew2014-07-181-2/+2
| | | | | | | align with POSIX and other systems. Pointed out by Elliott Hughes on tech ok deraadt
* Seperate arc4random's os-dependent parts into static inline functions,deraadt2014-07-182-36/+57
| | | | | making it much easier for libressl -portable to fill in the gaps. ok bcook beck
* it is 2014, and we still need to encourage people away from srand()deraadt2014-07-172-5/+14
| | | | and random(). Sigh.
* "Race-free because we're running single-threaded in a newderaadt2014-07-171-1/+5
| | | | | address space, and once allocated rs is never deallocated." document the forkhandler to save reviewers time, with matthew
* #ifdef wrap the _rs_forkhandlerderaadt2014-07-161-1/+3
|
* added handler for an atfork hook from kettenis@bcook2014-07-161-1/+10
| | | | ok deraadt@ beck@ kettenis@
* tweak previous;jmc2014-07-131-2/+2
|
* missing bracket in previous;jmc2014-07-131-2/+2
|
* Update BUGS section.miod2014-07-131-4/+6
|
* oops, i deleted the wrong wordtedu2014-07-131-2/+2
|
* remove a lie spotted by guenthertedu2014-07-131-5/+4
|
* once srandomdev() is called, switch to using arc4random() but mask off thetedu2014-07-131-12/+10
| | | | | high bit as required by posix. wouldn't want to break any standards. idea and ok deraadt
* Split out ntoh[ls] and hton[ls] into their own manpage.guenther2014-07-133-136/+199
| | | | | | Update byteorder(3) to cover the new functions in <endian.h> ok deraadt@ millert@
* While we thought this would make portable life easier it actuallybeck2014-07-131-3/+1
| | | | | makes it much harder. ok bcook@ kettenis@
* Wrap "thread_private.h" with #ifdef __OpenBSD__ so that other systemsderaadt2014-07-121-1/+3
| | | | | | can copy this file (plus chacha_private.h) directly and reuse it trivially. Well, as long as they have a getentropy() as well.. ok beck
* Split arc4random_uniform into it's own file, to assist other projectsderaadt2014-07-123-39/+60
| | | | | | now using this as upstream code. The particular problem is systems that contain older arc4random derivations lacking arc4random_uniform(). ok tedu miod
* Add locking for __cxa_finalize() as it modifies the page permissions of thekettenis2014-07-111-1/+5
| | | | | | | __atexit tables and touches global variables. From Srinavasa Nagaraju through Android/Elliott Hughes. ok tedu@, guenther@
* better document perils of setuid getenv and xr with issetugidtedu2014-07-111-2/+10
| | | | ok deraadt
* as noted by google/android via kettenis, atexit handlers can install newtedu2014-07-101-1/+8
| | | | | handlers. if this happens, restart the loop. ok kettenis matthew millert miod
* reduce obvious dependency on global g_pool by moving to local aliasestedu2014-07-091-42/+48
| | | | ok otto
* rephrase the stpcpy() warningnaddy2014-07-091-2/+2
| | | | new wording agreed by at least kettenis@ millert@ otto@
* Clean up after arc4random u_int32_t uint32_t changebeck2014-07-091-5/+5
| | | | ok jsing@
* changes to improve portabilitybcook2014-07-091-10/+11
| | | | ok beck@ deraadt@ jsing@ guenther@
* re-init and init code paths are now more shared, so the getpid()-basedderaadt2014-06-271-2/+3
| | | | portable code path must handle that; with brent cook
* extra evil spaces snuck in over the last whilederaadt2014-06-271-20/+20
|
* Move to a smaller rbytes buffer and skip a random part. Not tootto2014-06-271-3/+4
| | | | | | improve the random stream itself (it doesn't), but to introduce noise in the arc4random calling pattern. Thanks to matthew@ who pointed out bias in a previous diff, ok deraadt@ matthew@
* Add back an #ifndef MAP_INHERIT_ZERO chunk to support the old getpid()deraadt2014-06-261-1/+13
| | | | | mechanism, to aid in portability to other systems as requested. ok matthew
* document why we explicit_bzeroderaadt2014-06-251-2/+2
|
* loosen the spec for timingsafe functions slightly, so as to nottedu2014-06-211-10/+5
| | | | artificially constrain alternative implementations. ok deraadt
* Protect explicit_bzero() from link-time optimizationmatthew2014-06-211-7/+10
| | | | | | | | | | | | | | | | | | | | Modern compiler toolchains are capable of optimizing even across translation unit boundaries, so simply moving the memory clearing into a separate function is not guaranteed to clear memory. To avoid this, we take advantage of ELF weak symbol semantics, and insert a call to an empty, weakly named function. The semantics of calling this function aren't determinable until load time, so the compiler and linker need to keep the memset() call. There are still ways a toolchain might defeat this trick (e.g., optimistically expecting the weak symbol to not be overloaded, and only calling memset() if it is; promoting weak symbols to strong symbols at link-time when emitting a static binary because they won't be interposed; implementing load-time optimizations). But at least for the foreseeable future, these seem unlikely. ok deraadt
* arc4random: hard fail with raise(SIGKILL) if getentropy() returns -1matthew2014-06-201-3/+4
| | | | | | | Allow other non-zero return values in case we change our mind to return an ssize_t byte count instead of simple success/fail. ok deraadt, djm
* Move rs_chacha and rs_buf into the same memory page and don't mark itmatthew2014-06-191-22/+31
| | | | | | | | | MAP_INHERIT_ZERO anymore. This restores arc4random's previous behavior where fork children would mix in some randomness from the parent process. New behavior noticed by deraadt ok deraadt, tedu
* Always call atexit handlers as if they were registered with __cxa_atexit.kettenis2014-06-182-14/+8
| | | | | | | | | | | The extra argument doesn't hurt genuine atexit handlers and this fixes a bug where we didn't provide the argument (effectively passing garbage) for functions registered with __cxa_atexit in the main executable. Pointed out by Dmitriy Ivanov <dimitry@google.com> and Elliott Hughes <enh@google.com>. ok matthew@
* Use MAP_INHERIT_ZERO in arc4random(3)matthew2014-06-171-37/+44
| | | | | | | | Now instead of calling getpid() each time a user invokes arc4random(), we're able to rely on the kernel zero'ing out the RNG state if the process forks. ok deraadt, djm
* oops, typo. James Hartley is fast at trying -currentderaadt2014-06-151-2/+2
|
* In srandomdev(), use arc4random_buf() instead of from the kernel.deraadt2014-06-151-4/+3
| | | | discussion with matthew
* For now... assume success of getentropy() just like we assumed successderaadt2014-06-131-3/+3
| | | | of sysctl(). Mark it with XXX while we consider.
* Remove deprecated RFC2292 ancillary data convenience functions.chrisz2014-06-132-488/+2
| | | | | | They are obsoleted by the RFC3542 api. ok mpi@
* use getgentropy() call. If it fails, things are pretty bad --deraadt2014-06-131-8/+3
| | | | | call abort(). this direction discussed at length with miod beck tedu matthew etc
* use getentropy; from matthewderaadt2014-06-131-5/+2
|