Page MenuHomeFreeBSD

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

Authored by cem on May 8 2019, 12:15 AM.

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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem created this revision.May 8 2019, 12:15 AM
imp accepted this revision.May 8 2019, 12:17 AM

seems sane to me...

This revision is now accepted and ready to land.May 8 2019, 12:17 AM
jhb added inline comments.May 8 2019, 12:22 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'.

jhb added a reviewer: kib.May 8 2019, 12:22 AM
cem added inline comments.May 8 2019, 12:33 AM
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.May 8 2019, 12:35 AM
cem updated this revision to Diff 57156.
  • 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
delphij accepted this revision.May 8 2019, 12:35 AM

LGTM in principle

This revision is now accepted and ready to land.May 8 2019, 12:35 AM
jhb accepted this revision.May 8 2019, 12:41 AM
This revision was automatically updated to reflect the committed changes.