From 5eb8ca4d9251e0f9183f7c03161ea998c303949b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Thu, 2 Mar 2000 14:34:58 +0000 Subject: [PATCH] Use RAND_METHOD for implementing RAND_status. --- CHANGES | 5 +++++ crypto/rand/md_rand.c | 4 +++- crypto/rand/rand.h | 1 + crypto/rand/rand_lib.c | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index a674db246d..e3d8337f4b 100644 --- a/CHANGES +++ b/CHANGES @@ -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; + } -- 2.25.1