]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
random(4): deduplicate explicit_bzero() in harvest
authorcem <cem@FreeBSD.org>
Thu, 23 May 2019 21:02:27 +0000 (21:02 +0000)
committercem <cem@FreeBSD.org>
Thu, 23 May 2019 21:02:27 +0000 (21:02 +0000)
commitdb6f8db5cc74f8193876a2c16d64f5796590e109
tree0205ddae6ade31d6d35c1278842e5b027a477fef
parent6d224500617e9de00858b65b6bf7acd6d72ef6ab
random(4): deduplicate explicit_bzero() in harvest

Pull the responsibility for zeroing events, which is general to any
conceivable implementation of a random device algorithm, out of the
algorithm-specific Fortuna code and into the callers.  Most callers
indirect through random_fortuna_process_event(), so add the logic there.
Most callers already explicitly bzeroed the events they provided, so the
logic in Fortuna was mostly redundant.

Add one missing bzero in randomdev_accumulate().  Also, remove a redundant
bzero in the same function -- randomdev_hash_finish() is obliged to bzero
the hash state.

Reviewed by: delphij
Approved by: secteam(delphij)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20318
sys/dev/random/fortuna.c
sys/dev/random/random_harvestq.c
sys/dev/random/randomdev.c