Bug 230877 - random_fortuna_pre_read: explicit bzero of hash context can be removed
Summary: random_fortuna_pre_read: explicit bzero of hash context can be removed
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Conrad Meyer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-25 00:57 UTC by Conrad Meyer
Modified: 2021-08-06 05:14 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Conrad Meyer freebsd_committer freebsd_triage 2018-08-25 00:57:56 UTC
Trivial cleanup.

In every code flow in which it is used, the context is finish()ed, which invokes SHA256_Final which is obligated to explicit_bzero out the context already.
Comment 1 Mark Murray freebsd_committer freebsd_triage 2018-08-25 08:38:14 UTC
Thanks! Will fix.
Comment 2 Conrad Meyer freebsd_committer freebsd_triage 2018-09-01 19:22:37 UTC
Will cover in https://reviews.freebsd.org/D16986 .
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-10-26 21:01:05 UTC
A commit references this bug:

Author: cem
Date: Fri Oct 26 21:00:26 UTC 2018
New revision: 339789
URL: https://svnweb.freebsd.org/changeset/base/339789

Log:
  fortuna: Drop global lock to zero stack variables

  Also drop explicit zeroing of hash context -- hash finish() operation is
  expected to do this.

  PR:		230877
  Suggested by:	delphij@
  Reviewed by:	delphij, markm
  Approved by:	secteam (delphij)
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D16986

Changes:
  head/sys/dev/random/fortuna.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-08-06 05:14:14 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1ae8bd9a7d5ac1247db21d8f302d3d0513e08702

commit 1ae8bd9a7d5ac1247db21d8f302d3d0513e08702
Author:     Conrad Meyer <cem@FreeBSD.org>
AuthorDate: 2018-10-26 21:00:26 +0000
Commit:     David E. O'Brien <obrien@FreeBSD.org>
CommitDate: 2021-08-06 05:12:10 +0000

    fortuna: Drop global lock to zero stack variables

    Also drop explicit zeroing of hash context -- hash finish() operation is
    expected to do this.

    PR:             230877
    Suggested by:   delphij@
    Reviewed by:    delphij, markm
    Approved by:    secteam (delphij)
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D16986
    (cherry picked from commit 7be4093a844e80a591221e93d03f3daf6a972be3)

 sys/dev/random/fortuna.c | 65 +++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 31 deletions(-)