Use rand() instead of random() in regression tests.

This commit is contained in:
Frank Denis 2013-04-28 01:02:52 -07:00
parent 825cd5f7fe
commit 942c371d3c
4 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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]) {

View File

@ -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;

View File

@ -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]) {