看板 FB_security 關於我們 聯絡資訊
Bruce Evans <brde@optusnet.com.au> writes: > "Dag-Erling Sm=C3=B8rgrav" <des@des.no> writes: > > RW <rwmaillists@googlemail.com> writes: > > > binuptime(&bt); > > > return (bt.frac ^ bt.sec); > > Why the heck does it xor the integer and fractional parts together? > Because most of the entropy is in the fractional part, This is not about entropy, it's about implementing get_cyclecount() on a platform that doesn't have a TSC. It's supposed to be monotonic, and this implementation clearly isn't. Even when bt.sec is small enough that it doesn't affect significant digits of bt.frac (which should be most of the time, unless the resolution of the underlying timecounter exceeds ~2^32 Hz), get_cyclecount() will go backward every time a new second ticks over. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no _______________________________________________ freebsd-security@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-security To unsubscribe, send any mail to "freebsd-security-unsubscribe@freebsd.org"