diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-11-11 12:20:37 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-11 20:32:15 +0100 |
commit | a6a9c0f1bf5a9a5faa605773ea75e0b93c3ab108 (patch) | |
tree | aa0aee61cf99280eaa533956438c9daec3a2afc7 /arch/m32r/include | |
parent | random32: upgrade taus88 generator to taus113 from errata paper (diff) | |
download | linux-a6a9c0f1bf5a9a5faa605773ea75e0b93c3ab108.tar.xz linux-a6a9c0f1bf5a9a5faa605773ea75e0b93c3ab108.zip |
random32: add test cases for taus113 implementation
We generated a battery of 100 test cases from GSL taus113 implemention
and compare the results from a particular seed and a particular
iteration with our implementation in the kernel. We have verified on
32 and 64 bit machines that our taus113 kernel implementation gives
same results as GSL taus113 implementation:
[ 0.147370] prandom: seed boundary self test passed
[ 0.148078] prandom: 100 self tests passed
This is a Kconfig option that is disabled on default, just like the
crc32 init selftests in order to not unnecessary slow down boot process.
We also refactored out prandom_seed_very_weak() as it's now used in
multiple places in order to reduce redundant code.
GSL code we used for generating test cases:
int i, j;
srand(time(NULL));
for (i = 0; i < 100; ++i) {
int iteration = 500 + (rand() % 500);
gsl_rng_default_seed = rand() + 1;
gsl_rng *r = gsl_rng_alloc(gsl_rng_taus113);
printf("\t{ %lu, ", gsl_rng_default_seed);
for (j = 0; j < iteration - 1; ++j)
gsl_rng_get(r);
printf("%u, %lu },\n", iteration, gsl_rng_get(r));
gsl_rng_free(r);
}
Joint work with Hannes Frederic Sowa.
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/m32r/include')
0 files changed, 0 insertions, 0 deletions