Page MenuHomeFreeBSD

random: x86 driver: Prefer RDSEED over RDRAND when available
ClosedPublic

Authored by cem on May 8 2019, 12:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 27, 8:51 PM
Unknown Object (File)
Fri, Sep 27, 8:49 PM
Unknown Object (File)
Tue, Sep 24, 8:48 PM
Unknown Object (File)
Tue, Sep 24, 8:48 PM
Unknown Object (File)
Tue, Sep 24, 8:15 PM
Unknown Object (File)
Tue, Sep 24, 4:13 PM
Unknown Object (File)
Wed, Sep 18, 5:52 PM
Unknown Object (File)
Wed, Sep 18, 1:16 AM
Subscribers
None

Details

Summary

Per
https://software.intel.com/en-us/blogs/2012/11/17/the-difference-between-rdrand-and-rdseed
, RDRAND is a PRNG seeded from the same source as RDSEED. The source is
more suitable as PRNG seed material, so prefer it when the RDSEED intrinsic
is available (indicated in CPU feature bits).

Test Plan

Bhyve blocks RDSEED feature bit, unfortunately. So I have not tested RDSEED
functionality of this patch yet.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.May 8 2019, 12:17 AM
sys/dev/random/ivy.c
88 ↗(On Diff #57153)

Maybe "unsupported compiler" or something. I'd honestly just remove the #ifdef and force compile failure though.

108 ↗(On Diff #57153)

I don't think you need the '!!' since these variables are 'bool'.

sys/dev/random/ivy.c
88 ↗(On Diff #57153)

Will fix. :)

108 ↗(On Diff #57153)

Ah, you're totally right. I'll drop that bit.

cem marked 2 inline comments as done.
  • Drop ifndef wat
  • Drop bangbang "operator" -- bool implicitly coerces on assignment already
This revision now requires review to proceed.May 8 2019, 12:35 AM
This revision is now accepted and ready to land.May 8 2019, 12:35 AM
This revision was automatically updated to reflect the committed changes.