mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
Use rand() instead of random() in regression tests.
This commit is contained in:
parent
825cd5f7fe
commit
942c371d3c
@ -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;
|
||||
|
@ -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]) {
|
||||
|
@ -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;
|
||||
|
@ -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]) {
|
||||
|
Loading…
Reference in New Issue
Block a user