diff options
author | Bodo Möller <bodo@openssl.org> | 2000-01-14 17:55:37 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2000-01-14 17:55:37 +0000 |
commit | 0c50e02b30de26a9a5027a1065db7e07fd91469a (patch) | |
tree | b8db8b6be9a99887365ad7dda250b9c7640c1042 | |
parent | a8eeb155b5323809113e57e62de887b31f9fba7b (diff) | |
download | openssl-0c50e02b30de26a9a5027a1065db7e07fd91469a.tar.gz |
- Pseudo-seed the PRNG in programs used for "make test"
because otherwise BN_rand will fail unless DEVRANDOM works,
which causes the programs to dump core because they
don't check the return value of BN_rand (and if they
did, we still couldn't test anything).
- add comment to some files that appear not to be used at all.
-rw-r--r-- | crypto/bn/bn_opts.c | 4 | ||||
-rw-r--r-- | crypto/bn/bnspeed.c | 2 | ||||
-rw-r--r-- | crypto/bn/bntest.c | 6 | ||||
-rw-r--r-- | crypto/bn/d.c | 2 | ||||
-rw-r--r-- | crypto/bn/exp.c | 2 | ||||
-rw-r--r-- | crypto/bn/expspeed.c | 2 | ||||
-rw-r--r-- | crypto/bn/exptest.c | 6 | ||||
-rw-r--r-- | crypto/bn/test.c | 2 |
8 files changed, 25 insertions, 1 deletions
diff --git a/crypto/bn/bn_opts.c b/crypto/bn/bn_opts.c index 381be529b2..d09cd6ccf5 100644 --- a/crypto/bn/bn_opts.c +++ b/crypto/bn/bn_opts.c @@ -1,4 +1,6 @@ -/* crypto/bn/expspeed.c */ +/* unused */ + +/* crypto/bn/bn_opts.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/crypto/bn/bnspeed.c b/crypto/bn/bnspeed.c index 0922aa3e16..20fc7e08ff 100644 --- a/crypto/bn/bnspeed.c +++ b/crypto/bn/bnspeed.c @@ -1,3 +1,5 @@ +/* unused */ + /* crypto/bn/bnspeed.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c index 652f6794f0..012d387bf5 100644 --- a/crypto/bn/bntest.c +++ b/crypto/bn/bntest.c @@ -98,6 +98,8 @@ static int results=0; static unsigned char lst1[]="\xC6\x4F\x43\x04\x2A\xEA\xCA\x6E\x58\x36\x80\x5B\xE8\xC9" "\x9B\x04\x5D\x48\x36\xC2\xFD\x16\xC9\x64\xF0"; +static const char rnd_seed[] = "string to make the random number generator think it has entropy"; + int main(int argc, char *argv[]) { BN_CTX *ctx; @@ -106,6 +108,10 @@ int main(int argc, char *argv[]) results = 0; + RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't + * even check its return value + * (which we should) */ + argc--; argv++; while (argc >= 1) diff --git a/crypto/bn/d.c b/crypto/bn/d.c index ced2291b25..f1be583849 100644 --- a/crypto/bn/d.c +++ b/crypto/bn/d.c @@ -1,3 +1,5 @@ +/* unused */ + #include <stdio.h> #include <openssl/bio.h> #include "bn_lcl.h" diff --git a/crypto/bn/exp.c b/crypto/bn/exp.c index ec443459d8..4865b0ef74 100644 --- a/crypto/bn/exp.c +++ b/crypto/bn/exp.c @@ -1,3 +1,5 @@ +/* unused */ + #include <stdio.h> #include <openssl/tmdiff.h> #include "bn_lcl.h" diff --git a/crypto/bn/expspeed.c b/crypto/bn/expspeed.c index 3656d5bb4c..2044ab9bff 100644 --- a/crypto/bn/expspeed.c +++ b/crypto/bn/expspeed.c @@ -1,3 +1,5 @@ +/* unused */ + /* crypto/bn/expspeed.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. diff --git a/crypto/bn/exptest.c b/crypto/bn/exptest.c index d64905df1b..b6c7b18a3a 100644 --- a/crypto/bn/exptest.c +++ b/crypto/bn/exptest.c @@ -69,6 +69,8 @@ #define NUM_BITS (BN_BITS*2) +static const char rnd_seed[] = "string to make the random number generator think it has entropy"; + int main(int argc, char *argv[]) { BN_CTX *ctx; @@ -77,6 +79,10 @@ int main(int argc, char *argv[]) unsigned char c; BIGNUM *r_mont,*r_recp,*r_simple,*a,*b,*m; + RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't + * even check its return value + * (which we should) */ + ERR_load_BN_strings(); ctx=BN_CTX_new(); diff --git a/crypto/bn/test.c b/crypto/bn/test.c index a048b9f878..b12fde3551 100644 --- a/crypto/bn/test.c +++ b/crypto/bn/test.c @@ -1,3 +1,5 @@ +/* unused */ + #include <stdio.h> #include "cryptlib.h" #include "bn_lcl.h" |