Some more tweaks from ENGINE code.
Previously RAND_get_rand_method was returning a non-const pointer, but it should be const. As with all other such cases, METHOD pointers are stored and returned as "const". The only methods one should be able to alter are methods "local" to the relevant code, in which case a non-const handle to the methods should already exist. This change has been forced by the constifying of the ENGINE code (before which RAND_METHOD was the only method pointer in an ENGINE structure that was not constant).
This commit is contained in:
parent
404f952aa3
commit
a4a9d97a3e
@ -82,7 +82,7 @@ extern int rand_predictable;
|
|||||||
struct engine_st;
|
struct engine_st;
|
||||||
|
|
||||||
int RAND_set_rand_method(struct engine_st *meth);
|
int RAND_set_rand_method(struct engine_st *meth);
|
||||||
RAND_METHOD *RAND_get_rand_method(void );
|
const RAND_METHOD *RAND_get_rand_method(void );
|
||||||
RAND_METHOD *RAND_SSLeay(void);
|
RAND_METHOD *RAND_SSLeay(void);
|
||||||
void RAND_cleanup(void );
|
void RAND_cleanup(void );
|
||||||
int RAND_bytes(unsigned char *buf,int num);
|
int RAND_bytes(unsigned char *buf,int num);
|
||||||
|
@ -82,7 +82,7 @@ int RAND_set_rand_method(ENGINE *engine)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RAND_METHOD *RAND_get_rand_method(void)
|
const RAND_METHOD *RAND_get_rand_method(void)
|
||||||
{
|
{
|
||||||
if (rand_engine == NULL
|
if (rand_engine == NULL
|
||||||
&& (rand_engine = ENGINE_get_default_RAND()) == NULL)
|
&& (rand_engine = ENGINE_get_default_RAND()) == NULL)
|
||||||
@ -92,28 +92,28 @@ RAND_METHOD *RAND_get_rand_method(void)
|
|||||||
|
|
||||||
void RAND_cleanup(void)
|
void RAND_cleanup(void)
|
||||||
{
|
{
|
||||||
RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
if (meth && meth->cleanup)
|
if (meth && meth->cleanup)
|
||||||
meth->cleanup();
|
meth->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RAND_seed(const void *buf, int num)
|
void RAND_seed(const void *buf, int num)
|
||||||
{
|
{
|
||||||
RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
if (meth && meth->seed)
|
if (meth && meth->seed)
|
||||||
meth->seed(buf,num);
|
meth->seed(buf,num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RAND_add(const void *buf, int num, double entropy)
|
void RAND_add(const void *buf, int num, double entropy)
|
||||||
{
|
{
|
||||||
RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
if (meth && meth->add)
|
if (meth && meth->add)
|
||||||
meth->add(buf,num,entropy);
|
meth->add(buf,num,entropy);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RAND_bytes(unsigned char *buf, int num)
|
int RAND_bytes(unsigned char *buf, int num)
|
||||||
{
|
{
|
||||||
RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
if (meth && meth->bytes)
|
if (meth && meth->bytes)
|
||||||
return meth->bytes(buf,num);
|
return meth->bytes(buf,num);
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -121,7 +121,7 @@ int RAND_bytes(unsigned char *buf, int num)
|
|||||||
|
|
||||||
int RAND_pseudo_bytes(unsigned char *buf, int num)
|
int RAND_pseudo_bytes(unsigned char *buf, int num)
|
||||||
{
|
{
|
||||||
RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
if (meth && meth->pseudorand)
|
if (meth && meth->pseudorand)
|
||||||
return meth->pseudorand(buf,num);
|
return meth->pseudorand(buf,num);
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -129,7 +129,7 @@ int RAND_pseudo_bytes(unsigned char *buf, int num)
|
|||||||
|
|
||||||
int RAND_status(void)
|
int RAND_status(void)
|
||||||
{
|
{
|
||||||
RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
if (meth && meth->status)
|
if (meth && meth->status)
|
||||||
return meth->status();
|
return meth->status();
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user