summaryrefslogtreecommitdiff
path: root/tests/rng-fork.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-06-03 15:48:23 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-06-04 13:41:18 +0200
commit9837b9b8245b1ed55411a95cb41cd698667c746c (patch)
treee8711f88469601827b9127c67e7c1fb1fcbe48b2 /tests/rng-fork.c
parente93f699bfc56153818d792fd10c32c6f29a6ee4d (diff)
downloadgnutls-9837b9b8245b1ed55411a95cb41cd698667c746c.tar.gz
tests: check random generator for long outputs as well
Diffstat (limited to 'tests/rng-fork.c')
-rw-r--r--tests/rng-fork.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/rng-fork.c b/tests/rng-fork.c
index ba9178eaf1..45a18b4249 100644
--- a/tests/rng-fork.c
+++ b/tests/rng-fork.c
@@ -53,6 +53,7 @@ void doit(void)
unsigned char buf1[64];
unsigned char buf2[64];
pid_t pid;
+ unsigned char *tmp;
int ret;
FILE *fp;
unsigned i;
@@ -119,6 +120,20 @@ void doit(void)
exit(1);
}
}
+#define TMP_SIZE (65*1024)
+ tmp = malloc(TMP_SIZE);
+ if (tmp == NULL) {
+ fail("memory error\n");
+ exit(1);
+ }
+ for (i = 0; i <= 65539; i++) {
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, tmp, TMP_SIZE);
+ if (ret < 0) {
+ fail("Error iterating RNG-random more than %u times for %d data\n", i, TMP_SIZE);
+ exit(1);
+ }
+ }
+ free(tmp);
gnutls_global_deinit();
}