matthew
16792c29e6
arc4random: hard fail with raise(SIGKILL) if getentropy() returns -1
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
10 years ago
matthew
5374ff9a6b
Move rs_chacha and rs_buf into the same memory page and don't mark it
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
10 years ago
kettenis
32ba0b02ca
Always call atexit handlers as if they were registered with __cxa_atexit.
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@
10 years ago
matthew
932467241e
Use MAP_INHERIT_ZERO in arc4random(3)
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
10 years ago
deraadt
dbf34e5830
oops, typo. James Hartley is fast at trying -current
10 years ago
deraadt
6343e8d14f
In srandomdev(), use arc4random_buf() instead of from the kernel.
discussion with matthew
10 years ago
deraadt
45b700d2c0
For now... assume success of getentropy() just like we assumed success
of sysctl(). Mark it with XXX while we consider.
10 years ago
deraadt
42da378a93
use getgentropy() call. If it fails, things are pretty bad --
call abort().
this direction discussed at length with miod beck tedu matthew etc
10 years ago
deraadt
4bc984f92a
use getentropy; from matthew
10 years ago
matthew
f82197f5b3
Add timingsafe_memcmp().
ok deraadt, jmc, tedu
10 years ago
millert
3c0d2bba38
Disable the "switch to insertion sort" optimization to avoid quadratic
behavior for certain inputs. From NetBSD. OK tedu@
10 years ago
deraadt
f909f7742d
mop up ifndef KERNEL goo; ok miod
10 years ago
otto
7626939dd1
move random bytes buffer to be part of mmaped pages; ok tedu@
10 years ago
jca
43205a26de
Delete the extraneous "return" statement at the end of a void function.
From Fritjof Bornebusch.
10 years ago
otto
547175abed
move all stats collecting under MALLOC_STATS; ok krw@
10 years ago
otto
17d6cb272d
fix MALLOC_STATS (not compiled in by default); ok tedu@
10 years ago
tedu
118f2caf23
factor out a bit of the chunk index code and use it to make sure that a
freed chunk is actually freeable immediately. catch more errors.
hints/ok otto
10 years ago
chl
3acff291fd
Add missing header needed by isdigit().
While there, sort headers.
ok tedu@
10 years ago
tedu
1653fb274d
refactor some of the des crypt code to use fewer globals.
ok miod
10 years ago
jmc
e2130d28c0
update NAME and MLINKS for previous;
10 years ago
tedu
f5ab287545
document crypt_checkpass
10 years ago
sthen
b1478de08d
use $2b in the bcrypt example, ok tedu
10 years ago
tedu
4514bdd79a
stop flushing streams in abort(). it's hackish and unsafe, and no longer
required. try to document this fact and some of the history.
with feedback from deraadt guenther millert
10 years ago
tedu
5d44aecec4
remove md5crypt.
while changing things, add a crypt_checkpass wrapper that handles most of
the edge cases. (not quite ready for production, though.)
ok deraadt
10 years ago
tedu
508b771a99
change to having four freelists per size, to reduce another source of
deterministic behavior. four selected because it's more than three, less
than five. i.e., no particular reason.
10 years ago
otto
d7088c5a04
fix MALLOC_STATS code that was broken in rev 1.159, not compiled in by default
10 years ago
deraadt
a14ce349c7
move reallocarray() to a seperate file so that -portable applications
can avoid reinventing the wheel
ok guenther schwarze
10 years ago
halex
3a717658e6
comment style fix
ok crickets@
10 years ago
tedu
a894866510
missing NULL checks to see if init is needed. found hard way by deraadt.
10 years ago
tedu
7100c7debd
fix stupid commit
10 years ago
tedu
54db51a88a
use explicit_bzero
10 years ago
tedu
54fc405fe7
clear a stack buffer with explicit_bzero
10 years ago
tedu
df773f2da3
move chacha context and buffer out of bss and allow mmap to place them
wherever it decides it would like them. first step. ok deraadt dlg djm
10 years ago
deraadt
11e026e9b2
delete useless test code
10 years ago
tedu
b213b4d39d
now that 5.5 has been released with compatibility for 2b hashes,
switch to generating them by default. prodded by deraadt and sthen
10 years ago
tedu
378adff9c2
1. Drop support for no minor. This variant doesn't exist anymore.
2. Pull up the actual minor processing code into the switch that
parses it.
3. atoi is actually simpler than strtonum in this case, but check the
input beforehand so we don't get unexpected results.
4. Slightly more consistent style between various parse and check and
increment operations on salt.
ok deraadt
10 years ago
jmc
55b1910ad3
tweak previous; ok sthen
10 years ago
tedu
74c23bc915
nibbles aren't enough random, use bytes. does a better job of picking
a free chunk at random and may allow to increase delayed chunk array.
ok otto
10 years ago
sthen
a82252ad47
first cut at documenting the change to malloc doing a partial 'junk' by
default and the new 'j' option to disable this; ok jmc@
10 years ago
tedu
c0d30f0eb0
remove Z option and default to something halfway to J.
we always junk small chunks now, and the first part of pages,
but only after free. J still does the old thing. j disables everything.
Consider experimental as we evaluate performance in the real world.
ok otto
10 years ago
espie
41f1e88953
explain a bit more what's going on for stupid me.
okay otto@
10 years ago
otto
8a0e8854ef
Better, cleaner hash function that computes the same on be and le archs.
Should improve sparc64 and other be archs. ok matthew@ miod@
10 years ago
jmc
c1238dcae0
- one more mallocarray -> reallocarray
- use <>
10 years ago
tedu
07d1cf3ec2
change mallocarray to reallocarray. useful in a few more situations.
malloc can, as always, be emulated via realloc(NULL).
ok deraadt
10 years ago
deraadt
58a64bf376
correct man page section
10 years ago
deraadt
00d28c4faf
Introducing: void *mallocarray(size_t nmemb, size_t size);
Like calloc(), except without the cleared-memory gaurantee
ok beck guenther, discussed for more than a year...
10 years ago
guenther
e004b9b14e
Correctly document the return value of getenv(3)
From Ben Cornett (ben (at) lantern.is)
10 years ago
jmc
b07eaf1c5d
tweak previous;
10 years ago
tedu
fdb6f71674
one small tweak to avoid ever going off the end of a string.
10 years ago
tedu
50bce974c2
improved checking for invalid hashes. from solar designer
10 years ago