Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 2.8 KB

rdrand.md

File metadata and controls

64 lines (50 loc) · 2.8 KB
category description
Gamedev
🎲 Get random numbers 🎲

rdrand

Audit

version thoroughness understanding rating notes
0.6.0 medium medium neutral Diff review
0.5.2 medium medium neutral Diff review
0.4.0 medium medium negative Full review

0.6.0 / 0.5.2

Sound, although buggy AMD hardware makes implementing CryptoRng for RdRand/RdSeed a little unnerving to me ( nagisa/rust_rdrand#12 )

Reviewed

  • benches\rdrand.rs: +1
  • benches\rdseed.rs: +1
  • benches\std.rs: +1
  • src\changelog.rs: +1
  • src\lib.rs: 0
    • All of $gen::try_fill_bytes::imp being unsafe is still concerning... but I believe it's sound now.
    • RdRand/RdSeed implement CrytoRng, which makes buggy AMD hardware concerning: nagisa/rust_rdrand#12

Concerns reduced since 0.4.0:

Concerns fixed since 0.4.0:

0.4.0

$gen::try_fill_bytes invokes undefined behavior (overlapping &mut u32 and &mut [u8]): nagisa/rust_rdrand#13. 0.5.x removed some use of uninitialized.

Reviewed

  • benches\rdrand.rs: +1
  • benches\rdseed.rs: +1
  • benches\std.rs: +1
  • src\changelog.rs: +1
  • src\lib.rs: Concerns:
    • mem::uninitialized() u32s
    • is_x86_feature_detected: I have not verified this is correct.
    • loop_rand! uses mem::uninitialized() for $el:ty, easy to misuse! Requires unsafe{} so technically sound. Not exported.
    • $gen::try_fill_bytes: UNSOUND! word and buffer reference the same data. As both are &mut Ts, this is 100% undefined behavior.
    • unsafe blocks appear much larger than they need to be.
    • ptr::copy_nonoverlapping: This should really use a slice copy which should be just as safe...? But maybe missing from core?