in native/src/ssl.c [454:491]
static int ssl_rand_make(const char *file, int len, int base64)
{
int r;
int num = len;
BIO *out = NULL;
out = BIO_new(BIO_s_file());
if (out == NULL)
return 0;
if ((r = BIO_write_filename(out, (char *)file)) < 0) {
BIO_free_all(out);
return 0;
}
if (base64) {
BIO *b64 = BIO_new(BIO_f_base64());
if (b64 == NULL) {
BIO_free_all(out);
return 0;
}
out = BIO_push(b64, out);
}
while (num > 0) {
unsigned char buf[4096];
int len = num;
if (len > sizeof(buf))
len = sizeof(buf);
r = RAND_bytes(buf, len);
if (r <= 0) {
BIO_free_all(out);
return 0;
}
BIO_write(out, buf, len);
num -= len;
}
r = BIO_flush(out);
BIO_free_all(out);
return r > 0 ? 1 : 0;
}