From 942c371d3c337407fd700e25aee190f50d83aa16 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 28 Apr 2013 01:02:52 -0700 Subject: [PATCH] Use rand() instead of random() in regression tests. --- test/default/auth5.c | 4 ++-- test/default/box8.c | 2 +- test/default/onetimeauth7.c | 4 ++-- test/default/secretbox8.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/default/auth5.c b/test/default/auth5.c index 7cdc819a..ded9489c 100644 --- a/test/default/auth5.c +++ b/test/default/auth5.c @@ -21,12 +21,12 @@ int main(void) return 100; } if (clen > 0) { - c[random() % clen] += 1 + (random() % 255); + c[rand() % clen] += 1 + (rand() % 255); if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) { printf("forgery %d\n",clen); return 100; } - a[random() % sizeof a] += 1 + (random() % 255); + a[rand() % sizeof a] += 1 + (rand() % 255); if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) { printf("forgery %d\n",clen); return 100; diff --git a/test/default/box8.c b/test/default/box8.c index 5567c8e4..cc85057a 100644 --- a/test/default/box8.c +++ b/test/default/box8.c @@ -28,7 +28,7 @@ int main(void) crypto_box(c,m,mlen + crypto_box_ZEROBYTES,n,bobpk,alicesk); caught = 0; while (caught < 10) { - c[random() % (mlen + crypto_box_ZEROBYTES)] = random(); + c[rand() % (mlen + crypto_box_ZEROBYTES)] = rand(); if (crypto_box_open(m2,c,mlen + crypto_box_ZEROBYTES,n,alicepk,bobsk) == 0) { for (i = 0;i < mlen + crypto_box_ZEROBYTES;++i) if (m2[i] != m[i]) { diff --git a/test/default/onetimeauth7.c b/test/default/onetimeauth7.c index a12a40ab..6d99134c 100644 --- a/test/default/onetimeauth7.c +++ b/test/default/onetimeauth7.c @@ -21,12 +21,12 @@ int main(void) return 100; } if (clen > 0) { - c[random() % clen] += 1 + (random() % 255); + c[rand() % clen] += 1 + (rand() % 255); if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) == 0) { printf("forgery %d\n",clen); return 100; } - a[random() % sizeof a] += 1 + (random() % 255); + a[rand() % sizeof a] += 1 + (rand() % 255); if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) == 0) { printf("forgery %d\n",clen); return 100; diff --git a/test/default/secretbox8.c b/test/default/secretbox8.c index 6159b6af..94808dc9 100644 --- a/test/default/secretbox8.c +++ b/test/default/secretbox8.c @@ -24,7 +24,7 @@ int main(void) crypto_secretbox(c,m,mlen + crypto_secretbox_ZEROBYTES,n,k); caught = 0; while (caught < 10) { - c[random() % (mlen + crypto_secretbox_ZEROBYTES)] = random(); + c[rand() % (mlen + crypto_secretbox_ZEROBYTES)] = rand(); if (crypto_secretbox_open(m2,c,mlen + crypto_secretbox_ZEROBYTES,n,k) == 0) { for (i = 0;i < mlen + crypto_secretbox_ZEROBYTES;++i) if (m2[i] != m[i]) {