- (djm) [openbsd-compat/bsd-arc4random.c] Fix math bug that caused bias
in arc4random_uniform with upper_bound in (2^30,2*31). Note that OpenSSH did not make requests with upper bounds in this range.
This commit is contained in:
parent
a7058ec7c0
commit
58ea61ba2a
|
@ -1,3 +1,8 @@
|
||||||
|
20080604
|
||||||
|
- (djm) [openbsd-compat/bsd-arc4random.c] Fix math bug that caused bias
|
||||||
|
in arc4random_uniform with upper_bound in (2^30,2*31). Note that
|
||||||
|
OpenSSH did not make requests with upper bounds in this range.
|
||||||
|
|
||||||
20080519
|
20080519
|
||||||
- (djm) [configure.ac mux.c sftp.c openbsd-compat/Makefile.in]
|
- (djm) [configure.ac mux.c sftp.c openbsd-compat/Makefile.in]
|
||||||
[openbsd-compat/fmt_scaled.c openbsd-compat/openbsd-compat.h]
|
[openbsd-compat/fmt_scaled.c openbsd-compat/openbsd-compat.h]
|
||||||
|
@ -4023,4 +4028,4 @@
|
||||||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4935 2008/05/19 22:57:06 djm Exp $
|
$Id: ChangeLog,v 1.4936 2008/06/04 00:54:00 djm Exp $
|
||||||
|
|
|
@ -129,7 +129,7 @@ arc4random_uniform(u_int32_t upper_bound)
|
||||||
min = 1 + ~upper_bound; /* 2**32 - upper_bound */
|
min = 1 + ~upper_bound; /* 2**32 - upper_bound */
|
||||||
else {
|
else {
|
||||||
/* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */
|
/* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */
|
||||||
min = ((0xffffffff - (upper_bound << 2)) + 1) % upper_bound;
|
min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue