diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/dh/dhtest.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c index 770331971f..d66c28455e 100644 --- a/src/lib/libcrypto/dh/dhtest.c +++ b/src/lib/libcrypto/dh/dhtest.c | |||
| @@ -65,6 +65,7 @@ | |||
| 65 | #include <openssl/crypto.h> | 65 | #include <openssl/crypto.h> |
| 66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 67 | #include <openssl/bn.h> | 67 | #include <openssl/bn.h> |
| 68 | #include <openssl/rand.h> | ||
| 68 | 69 | ||
| 69 | #ifdef NO_DH | 70 | #ifdef NO_DH |
| 70 | int main(int argc, char *argv[]) | 71 | int main(int argc, char *argv[]) |
| @@ -87,19 +88,23 @@ static void MS_CALLBACK cb(int p, int n, void *arg); | |||
| 87 | #include "bss_file.c" | 88 | #include "bss_file.c" |
| 88 | #endif | 89 | #endif |
| 89 | 90 | ||
| 90 | BIO *out=NULL; | 91 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; |
| 91 | 92 | ||
| 92 | int main(int argc, char *argv[]) | 93 | int main(int argc, char *argv[]) |
| 93 | { | 94 | { |
| 94 | DH *a,*b; | 95 | DH *a; |
| 96 | DH *b=NULL; | ||
| 95 | char buf[12]; | 97 | char buf[12]; |
| 96 | unsigned char *abuf=NULL,*bbuf=NULL; | 98 | unsigned char *abuf=NULL,*bbuf=NULL; |
| 97 | int i,alen,blen,aout,bout,ret=1; | 99 | int i,alen,blen,aout,bout,ret=1; |
| 100 | BIO *out; | ||
| 98 | 101 | ||
| 99 | #ifdef WIN32 | 102 | #ifdef WIN32 |
| 100 | CRYPTO_malloc_init(); | 103 | CRYPTO_malloc_init(); |
| 101 | #endif | 104 | #endif |
| 102 | 105 | ||
| 106 | RAND_seed(rnd_seed, sizeof rnd_seed); | ||
| 107 | |||
| 103 | out=BIO_new(BIO_s_file()); | 108 | out=BIO_new(BIO_s_file()); |
| 104 | if (out == NULL) exit(1); | 109 | if (out == NULL) exit(1); |
| 105 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | 110 | BIO_set_fp(out,stdout,BIO_NOCLOSE); |
| @@ -167,6 +172,9 @@ int main(int argc, char *argv[]) | |||
| 167 | err: | 172 | err: |
| 168 | if (abuf != NULL) Free(abuf); | 173 | if (abuf != NULL) Free(abuf); |
| 169 | if (bbuf != NULL) Free(bbuf); | 174 | if (bbuf != NULL) Free(bbuf); |
| 175 | if(b != NULL) DH_free(b); | ||
| 176 | if(a != NULL) DH_free(a); | ||
| 177 | BIO_free(out); | ||
| 170 | exit(ret); | 178 | exit(ret); |
| 171 | return(ret); | 179 | return(ret); |
| 172 | } | 180 | } |
