X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Frand%2Frand_lib.c;h=7da74aab0ef3364b58c31a4593818225ccdc1e41;hp=4503215e1d7976e6ba884b917dbdf4941c74a9a0;hb=5eb8ca4d9251e0f9183f7c03161ea998c303949b;hpb=651d0aff98d28e2db146afa1790e9e22f3ef22db diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 4503215e1d..7da74aab0e 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -57,10 +57,8 @@ */ #include -#include "cryptlib.h" -#include #include -#include "rand.h" +#include #ifdef NO_RAND static RAND_METHOD *rand_meth=NULL; @@ -69,36 +67,51 @@ extern RAND_METHOD rand_ssleay_meth; static RAND_METHOD *rand_meth= &rand_ssleay_meth; #endif -void RAND_set_rand_method(meth) -RAND_METHOD *meth; +void RAND_set_rand_method(RAND_METHOD *meth) { rand_meth=meth; } -RAND_METHOD *RAND_get_rand_method() +RAND_METHOD *RAND_get_rand_method(void) { return(rand_meth); } -void RAND_cleanup() +void RAND_cleanup(void) { if (rand_meth != NULL) rand_meth->cleanup(); } -void RAND_seed(buf,num) -unsigned char *buf; -int num; +void RAND_seed(const void *buf, int num) { if (rand_meth != NULL) rand_meth->seed(buf,num); } -void RAND_bytes(buf,num) -unsigned char *buf; -int num; +void RAND_add(const void *buf, int num, double entropy) { if (rand_meth != NULL) - rand_meth->bytes(buf,num); + rand_meth->add(buf,num,entropy); } +int RAND_bytes(unsigned char *buf, int num) + { + if (rand_meth != NULL) + return rand_meth->bytes(buf,num); + return(-1); + } + +int RAND_pseudo_bytes(unsigned char *buf, int num) + { + if (rand_meth != NULL) + return rand_meth->pseudorand(buf,num); + return(-1); + } + +int RAND_status(void) + { + if (rand_meth != NULL) + return rand_meth->status(); + return 0; + }