RNG Quality (Dieharder Test Results Failing)
Posted: Tue Oct 08, 2019 3:09 am
I am using and my ESP32's radios are on (ESP32 uses the radio subsystems for entropy). I collected 16GB of RNG data (streamed over UART at 230400baud) over a period of 8 days and ran the dieharder RNG test-suite on the resulting file using the command
The output of the tests are as follows:
Clearly some of these tests failed due to the file being rewound due to not having enough RNG, however the majority of these tests should be passing for an RNG source thats used for cryptographic operations. Has Espressif ran these tests in-house? Thanks!
Update: The source of these failing results is probably because I was outputing a raw binary stream over UART, and (by default) esp-idf replaces "\n" with "\r\n".
Code: Select all
esp_random()
Code: Select all
dieharder -a -g 201 -f rng.raw
Code: Select all
#=============================================================================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#=============================================================================#
rng_name | filename |rands/second|
file_input_raw| rng.raw| 4.37e+07 |
#=============================================================================#
test_name |ntup| tsamples |psamples| p-value |Assessment
#=============================================================================#
diehard_birthdays| 0| 100| 100|0.82477712| PASSED
diehard_operm5| 0| 1000000| 100|0.16845445| PASSED
diehard_rank_32x32| 0| 40000| 100|0.11779202| PASSED
diehard_rank_6x8| 0| 100000| 100|0.18180463| PASSED
diehard_bitstream| 0| 2097152| 100|0.00000000| FAILED
diehard_opso| 0| 2097152| 100|0.00000000| FAILED
diehard_oqso| 0| 2097152| 100|0.11056558| PASSED
diehard_dna| 0| 2097152| 100|0.78492893| PASSED
diehard_count_1s_str| 0| 256000| 100|0.00000000| FAILED
diehard_count_1s_byt| 0| 256000| 100|0.68858185| PASSED
diehard_parking_lot| 0| 12000| 100|0.99650356| WEAK
diehard_2dsphere| 2| 8000| 100|0.07461599| PASSED
diehard_3dsphere| 3| 4000| 100|0.55283492| PASSED
diehard_squeeze| 0| 100000| 100|0.00000000| FAILED
diehard_sums| 0| 100| 100|0.76714923| PASSED
diehard_runs| 0| 100000| 100|0.00793089| PASSED
diehard_runs| 0| 100000| 100|0.22090600| PASSED
diehard_craps| 0| 200000| 100|0.00000000| FAILED
diehard_craps| 0| 200000| 100|0.00748931| PASSED
marsaglia_tsang_gcd| 0| 10000000| 100|0.00000000| FAILED
marsaglia_tsang_gcd| 0| 10000000| 100|0.00000000| FAILED
sts_monobit| 1| 100000| 100|0.00000000| FAILED
sts_runs| 2| 100000| 100|0.00000000| FAILED
sts_serial| 1| 100000| 100|0.00000000| FAILED
sts_serial| 2| 100000| 100|0.00000000| FAILED
sts_serial| 3| 100000| 100|0.00000000| FAILED
sts_serial| 3| 100000| 100|0.00000000| FAILED
sts_serial| 4| 100000| 100|0.00000000| FAILED
sts_serial| 4| 100000| 100|0.00000000| FAILED
sts_serial| 5| 100000| 100|0.00000000| FAILED
sts_serial| 5| 100000| 100|0.00000000| FAILED
sts_serial| 6| 100000| 100|0.00000000| FAILED
sts_serial| 6| 100000| 100|0.00000000| FAILED
sts_serial| 7| 100000| 100|0.00000000| FAILED
sts_serial| 7| 100000| 100|0.00000000| FAILED
sts_serial| 8| 100000| 100|0.00000000| FAILED
sts_serial| 8| 100000| 100|0.00000000| FAILED
sts_serial| 9| 100000| 100|0.00000000| FAILED
sts_serial| 9| 100000| 100|0.00000000| FAILED
sts_serial| 10| 100000| 100|0.00000000| FAILED
sts_serial| 10| 100000| 100|0.00000000| FAILED
sts_serial| 11| 100000| 100|0.00000000| FAILED
sts_serial| 11| 100000| 100|0.00000000| FAILED
sts_serial| 12| 100000| 100|0.00000000| FAILED
sts_serial| 12| 100000| 100|0.00000000| FAILED
sts_serial| 13| 100000| 100|0.00000000| FAILED
sts_serial| 13| 100000| 100|0.00000000| FAILED
sts_serial| 14| 100000| 100|0.00000000| FAILED
sts_serial| 14| 100000| 100|0.00000000| FAILED
sts_serial| 15| 100000| 100|0.00000000| FAILED
sts_serial| 15| 100000| 100|0.00000000| FAILED
sts_serial| 16| 100000| 100|0.00000000| FAILED
sts_serial| 16| 100000| 100|0.00000000| FAILED
rgb_bitdist| 1| 100000| 100|0.00000000| FAILED
rgb_bitdist| 2| 100000| 100|0.00000000| FAILED
rgb_bitdist| 3| 100000| 100|0.00001552| WEAK
rgb_bitdist| 4| 100000| 100|0.00000000| FAILED
rgb_bitdist| 5| 100000| 100|0.00000000| FAILED
rgb_bitdist| 6| 100000| 100|0.00000806| WEAK
rgb_bitdist| 7| 100000| 100|0.07378409| PASSED
rgb_bitdist| 8| 100000| 100|0.23721258| PASSED
rgb_bitdist| 9| 100000| 100|0.01635462| PASSED
# The file file_input_raw was rewound 1 times
rgb_bitdist| 10| 100000| 100|0.41476870| PASSED
# The file file_input_raw was rewound 1 times
rgb_bitdist| 11| 100000| 100|0.20763795| PASSED
# The file file_input_raw was rewound 1 times
rgb_bitdist| 12| 100000| 100|0.03961637| PASSED
# The file file_input_raw was rewound 1 times
rgb_minimum_distance| 2| 10000| 1000|0.00000000| FAILED
# The file file_input_raw was rewound 1 times
rgb_minimum_distance| 3| 10000| 1000|0.84189770| PASSED
# The file file_input_raw was rewound 1 times
rgb_minimum_distance| 4| 10000| 1000|0.07201586| PASSED
# The file file_input_raw was rewound 1 times
rgb_minimum_distance| 5| 10000| 1000|0.04425926| PASSED
# The file file_input_raw was rewound 1 times
rgb_permutations| 2| 100000| 100|0.91069440| PASSED
# The file file_input_raw was rewound 1 times
rgb_permutations| 3| 100000| 100|0.44047246| PASSED
# The file file_input_raw was rewound 1 times
rgb_permutations| 4| 100000| 100|0.72389934| PASSED
# The file file_input_raw was rewound 1 times
rgb_permutations| 5| 100000| 100|0.21941374| PASSED
# The file file_input_raw was rewound 1 times
rgb_lagged_sum| 0| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 1 times
rgb_lagged_sum| 1| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 1 times
rgb_lagged_sum| 2| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 1 times
rgb_lagged_sum| 3| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 1 times
rgb_lagged_sum| 4| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 1 times
rgb_lagged_sum| 5| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 1 times
rgb_lagged_sum| 6| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 2 times
rgb_lagged_sum| 7| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 2 times
rgb_lagged_sum| 8| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 2 times
rgb_lagged_sum| 9| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 2 times
rgb_lagged_sum| 10| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 3 times
rgb_lagged_sum| 11| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 3 times
rgb_lagged_sum| 12| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 3 times
rgb_lagged_sum| 13| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 3 times
rgb_lagged_sum| 14| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 4 times
rgb_lagged_sum| 15| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 4 times
rgb_lagged_sum| 16| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 5 times
rgb_lagged_sum| 17| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 5 times
rgb_lagged_sum| 18| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 6 times
rgb_lagged_sum| 19| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 6 times
rgb_lagged_sum| 20| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 7 times
rgb_lagged_sum| 21| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 7 times
rgb_lagged_sum| 22| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 8 times
rgb_lagged_sum| 23| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 8 times
rgb_lagged_sum| 24| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 9 times
rgb_lagged_sum| 25| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 9 times
rgb_lagged_sum| 26| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 10 times
rgb_lagged_sum| 27| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 11 times
rgb_lagged_sum| 28| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 12 times
rgb_lagged_sum| 29| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 12 times
rgb_lagged_sum| 30| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 13 times
rgb_lagged_sum| 31| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 14 times
rgb_lagged_sum| 32| 1000000| 100|0.00000000| FAILED
# The file file_input_raw was rewound 14 times
rgb_kstest_test| 0| 10000| 1000|0.00000000| FAILED
# The file file_input_raw was rewound 14 times
dab_bytedistrib| 0| 51200000| 1|0.00000000| FAILED
# The file file_input_raw was rewound 14 times
dab_dct| 256| 50000| 1|0.59573224| PASSED
# The file file_input_raw was rewound 14 times
Preparing to run test 207. ntuple = 0
dab_filltree| 32| 15000000| 1|0.60303646| PASSED
dab_filltree| 32| 15000000| 1|0.54889797| PASSED
# The file file_input_raw was rewound 14 times
Preparing to run test 208. ntuple = 0
dab_filltree2| 0| 5000000| 1|0.74919512| PASSED
dab_filltree2| 1| 5000000| 1|0.00000000| FAILED
# The file file_input_raw was rewound 14 times
Preparing to run test 209. ntuple = 0
dab_monobit2| 12| 65000000| 1|1.00000000| FAILED
Clearly some of these tests failed due to the file being rewound due to not having enough RNG, however the majority of these tests should be passing for an RNG source thats used for cryptographic operations. Has Espressif ran these tests in-house? Thanks!
Update: The source of these failing results is probably because I was outputing a raw binary stream over UART, and (by default) esp-idf replaces "\n" with "\r\n".