4

I was running the Dieharder test suite on my raspberry pis hardware random number generator, and it came back with this:

    root@raspberrypi:/home/pi# dieharder -a -g 201 -f /dev/hwrng
    #=============================================================================#
    #            dieharder version 3.31.1 Copyright 2003 Robert G. Brown                  #
    #=============================================================================#
       rng_name    |           filename             |rands/second|
     file_input_raw|                      /dev/hwrng|  2.16e+04  |
    #=============================================================================#
      test_name   |ntup| tsamples |psamples|  p-value |Assessment
    #=============================================================================#
  diehard_birthdays|   0|       100|     100|0.49065727|  PASSED
     diehard_operm5|   0|   1000000|     100|0.34874952|  PASSED
 diehard_rank_32x32|   0|     40000|     100|0.24428667|  PASSED
   diehard_rank_6x8|   0|    100000|     100|0.93857787|  PASSED
  diehard_bitstream|   0|   2097152|     100|0.90466841|  PASSED
       diehard_opso|   0|   2097152|     100|0.44750734|  PASSED
       diehard_oqso|   0|   2097152|     100|0.38554225|  PASSED
        diehard_dna|   0|   2097152|     100|0.31369028|  PASSED
diehard_count_1s_str|   0|    256000|     100|0.35662453|  PASSED
diehard_count_1s_byt|   0|    256000|     100|0.91583365|  PASSED
diehard_parking_lot|   0|     12000|     100|0.25422977|  PASSED
   diehard_2dsphere|   2|      8000|     100|0.18118688|  PASSED
   diehard_3dsphere|   3|      4000|     100|0.36585333|  PASSED
    diehard_squeeze|   0|    100000|     100|0.81644760|  PASSED
       diehard_sums|   0|       100|     100|0.00745524|  PASSED
       diehard_runs|   0|    100000|     100|0.00269182|   WEAK
       diehard_runs|   0|    100000|     100|0.00044751|   WEAK
      diehard_craps|   0|    200000|     100|0.38740472|  PASSED
      diehard_craps|   0|    200000|     100|0.19167038|  PASSED

The manual for Dieharder does say that a weak result would happen approximately every one in 100 tests anyway, but I'm not sure what to make of failing two tests of the same type in a row. How significant is this?

3

diehard_run is known to fail on secure RNGs. I wouldn't worry about it.

0

Do not use Dieharder or any randomness tests on a hardware random number generator unless you know that you can set it to provide raw samples. I would bet that the Pi's generator uses a whitening scheme like almost every other one out there, which would make it such that even predictable, low-entropy data would seem to pass the majority of tests. Very few hardware random number generators give you the option to disable whitening, unfortunately, so you should not assume that it is completely unpredictable. If you want to utilize it to improve the Linux kernel's entropy pool, you can simply write data from /dev/hwrng to /dev/urandom, which will XOR it safely with the pool. This way, even if the randomness is poor, it will not actually reduce the quality of your entropy pool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.