diff options
author | Bodo Möller <bodo@openssl.org> | 2000-03-02 14:34:58 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2000-03-02 14:34:58 +0000 |
commit | 5eb8ca4d9251e0f9183f7c03161ea998c303949b (patch) | |
tree | 9420cdc5d04cca662ebf85381c8d470e7c4a7f8f | |
parent | 2d092edf5edef95072fbb63cd8d09d30a7dd7973 (diff) |
Use RAND_METHOD for implementing RAND_status.
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | crypto/rand/md_rand.c | 4 | ||||
-rw-r--r-- | crypto/rand/rand.h | 1 | ||||
-rw-r--r-- | crypto/rand/rand_lib.c | 7 |
4 files changed, 16 insertions, 1 deletions
@@ -4,6 +4,11 @@ Changes between 0.9.5 and 0.9.6 [XX XXX 2000] + *) Include RAND_status() into RAND_METHOD instead of implementing + it only for md_rand.c Otherwise replacing the PRNG by calling + RAND_set_rand_method would be impossible. + [Bodo Moeller] + *) Don't let DSA_generate_key() enter an infinite loop if the random number generation fails. [Bodo Moeller] diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index 583fc137d8..1a366ae5c8 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -156,6 +156,7 @@ static void ssleay_rand_seed(const void *buf, int num); static void ssleay_rand_add(const void *buf, int num, double add_entropy); static int ssleay_rand_bytes(unsigned char *buf, int num); static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num); +static int ssleay_rand_status(void); RAND_METHOD rand_ssleay_meth={ ssleay_rand_seed, @@ -163,6 +164,7 @@ RAND_METHOD rand_ssleay_meth={ ssleay_rand_cleanup, ssleay_rand_add, ssleay_rand_pseudo_bytes, + ssleay_rand_status }; RAND_METHOD *RAND_SSLeay(void) @@ -502,7 +504,7 @@ static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) return (ret); } -int RAND_status(void) +static int ssleay_rand_status(void) { if (!initialized) ssleay_rand_initialize(); diff --git a/crypto/rand/rand.h b/crypto/rand/rand.h index f14a115225..79cb9047a2 100644 --- a/crypto/rand/rand.h +++ b/crypto/rand/rand.h @@ -70,6 +70,7 @@ typedef struct rand_meth_st void (*cleanup)(void); void (*add)(const void *buf, int num, double entropy); int (*pseudorand)(unsigned char *buf, int num); + int (*status)(void); } RAND_METHOD; #ifdef BN_DEBUG diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index b09a300c46..7da74aab0e 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -108,3 +108,10 @@ int RAND_pseudo_bytes(unsigned char *buf, int num) return rand_meth->pseudorand(buf,num); return(-1); } + +int RAND_status(void) + { + if (rand_meth != NULL) + return rand_meth->status(); + return 0; + } |