RAND_F_RAND_POOL_BYTES_NEEDED:115:rand_pool_bytes_needed
RAND_F_RAND_POOL_GROW:125:rand_pool_grow
RAND_F_RAND_POOL_NEW:116:rand_pool_new
+RAND_F_RAND_PSEUDO_BYTES:126:RAND_pseudo_bytes
RAND_F_RAND_WRITE_FILE:112:RAND_write_file
RSA_F_CHECK_PADDING_MD:140:check_padding_md
RSA_F_ENCODE_PKCS1:146:encode_pkcs1
"rand_pool_bytes_needed"},
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_POOL_GROW, 0), "rand_pool_grow"},
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_POOL_NEW, 0), "rand_pool_new"},
+ {ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_PSEUDO_BYTES, 0), "RAND_pseudo_bytes"},
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_WRITE_FILE, 0), "RAND_write_file"},
{0, NULL}
};
const RAND_METHOD *meth = RAND_get_rand_method();
+ if (meth == NULL)
+ return 0;
+
if (meth == RAND_OpenSSL()) {
/* fill random pool and seed the master DRBG */
RAND_DRBG *drbg = RAND_DRBG_get0_master();
{
const RAND_METHOD *meth = RAND_get_rand_method();
- if (meth->seed != NULL)
+ if (meth != NULL && meth->seed != NULL)
meth->seed(buf, num);
}
{
const RAND_METHOD *meth = RAND_get_rand_method();
- if (meth->add != NULL)
+ if (meth != NULL && meth->add != NULL)
meth->add(buf, num, randomness);
}
{
const RAND_METHOD *meth = RAND_get_rand_method();
RAND_DRBG *drbg;
- int ret;
- if (meth != RAND_OpenSSL())
+ if (meth != NULL && meth != RAND_OpenSSL())
return RAND_bytes(buf, num);
drbg = RAND_DRBG_get0_private();
- if (drbg == NULL)
- return 0;
+ if (drbg != NULL)
+ return RAND_DRBG_bytes(drbg, buf, num);
- ret = RAND_DRBG_bytes(drbg, buf, num);
- return ret;
+ return 0;
}
int RAND_bytes(unsigned char *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
- if (meth->bytes != NULL)
+ if (meth != NULL && meth->bytes != NULL)
return meth->bytes(buf, num);
RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
return -1;
{
const RAND_METHOD *meth = RAND_get_rand_method();
- if (meth->pseudorand != NULL)
+ if (meth != NULL && meth->pseudorand != NULL)
return meth->pseudorand(buf, num);
+ RANDerr(RAND_F_RAND_PSEUDO_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
return -1;
}
#endif
{
const RAND_METHOD *meth = RAND_get_rand_method();
- if (meth->status != NULL)
+ if (meth != NULL && meth->status != NULL)
return meth->status();
return 0;
}