projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
oops, make EVP ctr mode work again
[oweals/openssl.git]
/
crypto
/
rand
/
randtest.c
diff --git
a/crypto/rand/randtest.c
b/crypto/rand/randtest.c
index e0ba61e123d121dcc771f4babb635b52a8c562f9..9e92a70b033c032de9e23983f1a63b9fb59d11ce 100644
(file)
--- a/
crypto/rand/randtest.c
+++ b/
crypto/rand/randtest.c
@@
-58,12
+58,14
@@
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
-#include "rand.h"
+#include <openssl/rand.h>
+
+#include "../e_os.h"
/* some FIPS 140-1 random number test */
/* some simple tests */
/* some FIPS 140-1 random number test */
/* some simple tests */
-int main()
+int main(
int argc,char **argv
)
{
unsigned char buf[2500];
int i,j,k,s,sign,nsign,err=0;
{
unsigned char buf[2500];
int i,j,k,s,sign,nsign,err=0;
@@
-73,7
+75,13
@@
int main()
/*double d; */
long d;
/*double d; */
long d;
- RAND_bytes(buf,2500);
+ i = RAND_pseudo_bytes(buf,2500);
+ if (i < 0)
+ {
+ printf ("init failed, the rand method is not properly installed\n");
+ err++;
+ goto err;
+ }
n1=0;
for (i=0; i<16; i++) n2[i]=0;
n1=0;
for (i=0; i<16; i++) n2[i]=0;
@@
-117,7
+125,7
@@
int main()
/* test 1 */
if (!((9654 < n1) && (n1 < 10346)))
{
/* test 1 */
if (!((9654 < n1) && (n1 < 10346)))
{
- printf("test 1 failed, X=%l
d
\n",n1);
+ printf("test 1 failed, X=%l
u
\n",n1);
err++;
}
printf("test 1 done\n");
err++;
}
printf("test 1 done\n");
@@
-150,37
+158,37
@@
int main()
{
if (!((2267 < runs[i][0]) && (runs[i][0] < 2733)))
{
{
if (!((2267 < runs[i][0]) && (runs[i][0] < 2733)))
{
- printf("test 3 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 3 failed, bit=%d run=%d num=%l
u
\n",
i,1,runs[i][0]);
err++;
}
if (!((1079 < runs[i][1]) && (runs[i][1] < 1421)))
{
i,1,runs[i][0]);
err++;
}
if (!((1079 < runs[i][1]) && (runs[i][1] < 1421)))
{
- printf("test 3 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 3 failed, bit=%d run=%d num=%l
u
\n",
i,2,runs[i][1]);
err++;
}
if (!(( 502 < runs[i][2]) && (runs[i][2] < 748)))
{
i,2,runs[i][1]);
err++;
}
if (!(( 502 < runs[i][2]) && (runs[i][2] < 748)))
{
- printf("test 3 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 3 failed, bit=%d run=%d num=%l
u
\n",
i,3,runs[i][2]);
err++;
}
if (!(( 223 < runs[i][3]) && (runs[i][3] < 402)))
{
i,3,runs[i][2]);
err++;
}
if (!(( 223 < runs[i][3]) && (runs[i][3] < 402)))
{
- printf("test 3 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 3 failed, bit=%d run=%d num=%l
u
\n",
i,4,runs[i][3]);
err++;
}
if (!(( 90 < runs[i][4]) && (runs[i][4] < 223)))
{
i,4,runs[i][3]);
err++;
}
if (!(( 90 < runs[i][4]) && (runs[i][4] < 223)))
{
- printf("test 3 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 3 failed, bit=%d run=%d num=%l
u
\n",
i,5,runs[i][4]);
err++;
}
if (!(( 90 < runs[i][5]) && (runs[i][5] < 223)))
{
i,5,runs[i][4]);
err++;
}
if (!(( 90 < runs[i][5]) && (runs[i][5] < 223)))
{
- printf("test 3 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 3 failed, bit=%d run=%d num=%l
u
\n",
i,6,runs[i][5]);
err++;
}
i,6,runs[i][5]);
err++;
}
@@
-190,18
+198,22
@@
int main()
/* test 4 */
if (runs[0][33] != 0)
{
/* test 4 */
if (runs[0][33] != 0)
{
- printf("test 4 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 4 failed, bit=%d run=%d num=%l
u
\n",
0,34,runs[0][33]);
err++;
}
if (runs[1][33] != 0)
{
0,34,runs[0][33]);
err++;
}
if (runs[1][33] != 0)
{
- printf("test 4 failed, bit=%d run=%d num=%l
d
\n",
+ printf("test 4 failed, bit=%d run=%d num=%l
u
\n",
1,34,runs[1][33]);
err++;
}
printf("test 4 done\n");
1,34,runs[1][33]);
err++;
}
printf("test 4 done\n");
+ err:
err=((err)?1:0);
err=((err)?1:0);
- exit(err);
+#ifdef OPENSSL_SYS_NETWARE
+ if (err) printf("ERROR: %d\n", err);
+#endif
+ EXIT(err);
return(err);
}
return(err);
}